Cleanup the setup instructions and rename the windows setup scripts

This commit is contained in:
Veronica K. B. Olsen
2021-04-19 20:02:58 +02:00
parent 71f9f3d230
commit c9785bc57b
6 changed files with 84 additions and 102 deletions
+2 -2
View File
@@ -175,8 +175,8 @@ Windows doesn't by default come with Python installed. If you haven't installed
from [python.org/downloads](https://www.python.org/downloads/). Remember to select "Add Python to
PATH" during the installation.
The script `setup_windows.bat` can be used to create desktop and start menu icons for novelWriter.
The script will also install dependencies for you from PyPi.
The script `setup\windows_install.bat` can be used to create desktop and start menu icons for
novelWriter. The script will also install dependencies for you from PyPi.
## Internationalisation
+2 -2
View File
@@ -76,7 +76,7 @@ Step 2: Dependencies and Icons
**Alternative A: By Script**
Open the folder where you extracted novelWriter, and double-click the file named
``setup_windows.bat``. This should open a command line window and run the setup script to install
``windows_install.bat``. This should open a command line window and run the setup script to install
dependencies, and add desktop and start menu icons.
.. note::
@@ -119,7 +119,7 @@ Uninstalling
**Alternative A: By Script**
Open the folder where you keep the novelWriter files, and double-click the file named
``uninstall_windows.bat``. This should open a command line window and run the setup script to
``windows_uninstall.bat``. This should open a command line window and run the setup script to
remove the main dependency packages and remove desktop and start menu icons.
.. note::
+60 -50
View File
@@ -367,10 +367,10 @@ def makeMinimalPackage(targetOS):
if targetOS == OS_WIN:
zipObj.write("novelWriter.py", "novelWriter.pyw")
print("Adding File: novelWriter.pyw")
zipObj.write(os.path.join("setup", "setup_windows.bat"), "setup_windows.bat")
print("Adding File: setup_windows.bat")
zipObj.write(os.path.join("setup", "uninstall_windows.bat"), "uninstall_windows.bat")
print("Adding File: uninstall_windows.bat")
zipObj.write(os.path.join("setup", "windows_install.bat"), "windows_install.bat")
print("Adding File: windows_install.bat")
zipObj.write(os.path.join("setup", "windows_uninstall.bat"), "windows_uninstall.bat")
print("Adding File: windows_uninstall.bat")
else:
zipObj.write("novelWriter.py")
print("Adding File: novelWriter.py")
@@ -1056,51 +1056,61 @@ if __name__ == "__main__":
else:
targetOS = hostOS
helpMsg = (
"\n"
"novelWriter Setup Tool\n"
"======================\n"
"\n"
"This tool provides setup and build commands for installing or distibuting novelWriter\n"
"as a package on Linux, Mac and Windows. The available options are as follows:\n"
"\n"
"Some of the commands can be targeted towards a different OS than the host OS. To target\n"
"the command, add one of '--target-linux', '--target-darwin' or '--target-win'.\n"
"\n"
"General:\n"
"\n"
" help Print the help message.\n"
" pip Install all package dependencies for novelWriter using pip.\n"
" clean Will attempt to delete the 'build' and 'dist' folders.\n"
"\n"
"Additional Builds:\n"
"\n"
" qthelp Build the help documentation for use with the Qt Assistant. Run before\n"
" install to have local help enable in the the installed version.\n"
" qtlupdate Update the translation files for internationalisation.\n"
" qtlrelease Build the language files for internationalisation.\n"
" sample Build the sample project as a zip file. Run before install to enable\n"
" creating sample projects in the in-app New Project Wizard.\n"
"\n"
"Python Packaging:\n"
"\n"
" minimal-zip Creates a minimal zip file of the core application without all the\n"
" other source files. Accepts a target OS flag.\n"
" pack-pyz Creates a pyz package in a folder with all dependencies using the\n"
" zipapp tool. On Windows, python embeddable is added to the folder.\n"
" setup-pyz Build a Windows installer from a zipapp package using Inno Setup.\n"
"\n"
"System Install:\n"
"\n"
" install Installs novelWriter to the system's Python install location. Run as \n"
" root or with sudo for system-wide install, or as user for single user \n"
" install.\n"
" xdg-install Install launcher and icons for freedesktop systems. Run as root or \n"
" with sudo for system-wide install, or as user for single user install.\n"
" Running 'xdg-uninstall' will remove the icons.\n"
" win-install Install desktop and start menu icons for Windows systems.\n"
" Running 'win-uninstall' will remove the icons.\n"
)
helpMsg = [
"",
"novelWriter Setup Tool",
"======================",
"",
"This tool provides setup and build commands for installing or distibuting",
"novelWriter as a package on Linux, Mac and Windows. The available options",
"are as follows:",
"",
"Some of the commands can be targeted towards a different OS than the host OS.",
"To target the command, add one of '--target-linux', '--target-darwin' or",
"'--target-win'.",
"",
"General:",
"",
" help Print the help message.",
" pip Install all package dependencies for novelWriter using pip.",
" clean Will attempt to delete the 'build' and 'dist' folders.",
"",
"Additional Builds:",
"",
" qthelp Build the help documentation for use with the Qt Assistant.",
" qtlupdate Update the translation files for internationalisation.",
" qtlrelease Build the language files for internationalisation.",
" sample Build the sample project zip file and add it to assets.",
"",
"Python Packaging:",
"",
" minimal-zip Creates a minimal zip file of the core application without",
" all the other source files. Defaults to tailor the zip file",
" for the current OS, but accepts a target OS flag to build",
" for another OS.",
" pack-pyz Creates a .pyz package in a folder with all dependencies",
" using the zipapp tool. On Windows, python embeddable is",
" added to the folder.",
" setup-pyz Build a Windows executable installer from a zipapp package",
" using Inno Setup. Must run 'pack-pyz' first.",
"",
"System Install:",
"",
" install Installs novelWriter to the system's Python install",
" location. Run as root or with sudo for system-wide install,",
" or as user for single user install.",
" xdg-install Install launcher and icons for freedesktop systems. Run as",
" root or with sudo for system-wide install, or as user for",
" single user install.",
" xdg-uninstall Remove the launcher and icons for the current system as",
" installed by the 'xdg-install' command.",
" win-install Install desktop icon, start menu icon, and registry entries",
" for file association with .nwx files for Windows systems.",
" win-uninstall Remove desktop icon, start menu icon, and registry keys,",
" for the current system. Note that it only removes icons for",
" the version number of the package the command is run from.",
"",
]
# Flags and Variables
makeSetupPyz = False
@@ -1112,7 +1122,7 @@ if __name__ == "__main__":
if "help" in sys.argv:
sys.argv.remove("help")
print(helpMsg)
print("\n".join(helpMsg))
sys.exit(0)
if "version" in sys.argv:
+20 -48
View File
@@ -1,56 +1,28 @@
# Build and Install novelWriter
The root folder of the repository contains two scripts for setup and install:
The root folder of the repository contains a standard `setup.py` script. The `setup` folder
contains necessary files for the setup process, like icons and other files, and it also contains
additional scripts that are included in the minimal zip packages.
## Setup Script
## Script `setup.py`
The `setup.py` script in the root folder has all the necessary commands for generating packages,
installing icons, launcher, and file associations on Linux and Windows (no macOS support yet).
The `setup.py` is a standard Python setup script with a couple of additional
options:
In addition, it is a wrapper for `setuptools` and accept all commands associated with this tool.
Some of the commands can be targeted towards a different OS than the host OS.
To target the command, add one of `--target-linux`, `--target-darwin` or
`--target-win`.
To list all custom package and install options in this script, run:
```
./setup.py help
```
## Windows Scripts
### General
The `windows_install.bat` and `windows_uninstall.bat` are provided as convenience scripts for
Windows users who aren't used to running commands from command line. They are both located in the
`setup` folder in the source package, but in the minimal zip package for Windows, they can be
found in the root folder.
`help` Print the help message.
`pip` Install all package dependencies for novelWriter using pip.
`clean` Will attempt to delete the `build` and `dist` folders.
### Additional Builds
`qthelp` Build the help documentation for use with the Qt Assistant. Run
before install to have local help enable in the the installed version
`qtlupdate` Update the translation files for internationalisation.
`qtlrelease` Build the language files for internationalisation.
`sample` Build the sample project as a zip file. Run before install to enable
creating sample projects in the in-app New Project Wizard.
### Python Packaging
`minimal-zip` Creates a minimal zip file of the core application without all
the other source files.
`pack-pyz` Creates a pyz package in a folder with all dependencies using the
zipapp tool. On Windows, python embeddable is added to the folder.
`setup-pyz` Build a Windows installer from a zipapp package using Inno Setup.
### System Install
`install` Installs novelWriter to the system's Python install location. Run
as root or with sudo for system-wide install, or as user for single user
install.
`xdg-install` Install launcher and icons for freedesktop systems. Run as root
or with sudo for system-wide install, or as user for single user install.
Running `xdg-uninstall` will remove the icons.
`win-install` Install desktop and start menu icons for Windows systems.
Running `win-uninstall` will remove the icons.
These scripts are designed to be double-clicked by the user, but can also be run from the command
line tool. In either case, they will check if Python is properly installed, and then run the
commands to install or uninstall the core dependencies of novelWriter, and then setup or remove the
desktop icon, start menu icon and registry entries.