Split up setup.py and move packaging tools to new script
This commit is contained in:
@@ -24,7 +24,7 @@ jobs:
|
|||||||
run: pip install -r docs/source/requirements.txt
|
run: pip install -r docs/source/requirements.txt
|
||||||
|
|
||||||
- name: Build Assets
|
- name: Build Assets
|
||||||
run: python setup.py qtlrelease sample manual
|
run: python pkgutils.py qtlrelease sample manual
|
||||||
|
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@@ -64,7 +64,7 @@ jobs:
|
|||||||
path: novelwriter/assets
|
path: novelwriter/assets
|
||||||
|
|
||||||
- name: Build AppImage
|
- name: Build AppImage
|
||||||
run: python setup.py build-appimage --linux-tag ${{ matrix.linux-tag }} --python-version ${{ matrix.python-version }}
|
run: python pkgutils.py build-appimage --linux-tag ${{ matrix.linux-tag }} --python-version ${{ matrix.python-version }}
|
||||||
|
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pip install -U -r requirements.txt -r requirements-dev.txt
|
pip install -U -r requirements.txt -r requirements-dev.txt
|
||||||
- name: Run Build Commands
|
- name: Run Build Commands
|
||||||
run: python setup.py qtlrelease sample
|
run: python pkgutils.py qtlrelease sample
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: |
|
run: |
|
||||||
export QT_QPA_PLATFORM=offscreen
|
export QT_QPA_PLATFORM=offscreen
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
include setup.py
|
include pkgutils.py
|
||||||
include LICENSE.md
|
include LICENSE.md
|
||||||
include CREDITS.md
|
include CREDITS.md
|
||||||
include CHANGELOG.md
|
include CHANGELOG.md
|
||||||
|
|||||||
@@ -18,21 +18,18 @@ to build the various components like the translation files and documentation.
|
|||||||
``python3`` may be needed instead. Likewise, ``pip`` may need to be replaced with ``pip3``.
|
``python3`` may be needed instead. Likewise, ``pip`` may need to be replaced with ``pip3``.
|
||||||
|
|
||||||
Most of the custom commands for building packages of novelWriter, or building assets, are contained
|
Most of the custom commands for building packages of novelWriter, or building assets, are contained
|
||||||
in the ``setup.py`` script in the root of the source code. You can list the available commands by
|
in the ``pkgutils.py`` script in the root of the source code. You can list the available commands
|
||||||
running:
|
by running:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
python setup.py help
|
python pkgutils.py help
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
Calling ``setup.py install`` has been deprecated for a while, and this approach is no longer
|
Calling ``setup.py install`` has been deprecated for a while, and this approach is no longer
|
||||||
actively supported in novelWriter either.
|
actively supported in novelWriter either.
|
||||||
|
|
||||||
In a future version, the packaging and asset build tools part of the current ``setup.py`` file
|
|
||||||
will be moved to another script and the ``setup.py`` file removed entirely.
|
|
||||||
|
|
||||||
|
|
||||||
.. _a_source_depend:
|
.. _a_source_depend:
|
||||||
|
|
||||||
@@ -116,7 +113,7 @@ You can build the ``.qm`` files with:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
python setup.py qtlrelease
|
python pkgutils.py qtlrelease
|
||||||
|
|
||||||
This requires that the Qt Linguist tool is installed on your system. On Ubuntu and Debian, the
|
This requires that the Qt Linguist tool is installed on your system. On Ubuntu and Debian, the
|
||||||
needed package is called ``qttools5-dev-tools``.
|
needed package is called ``qttools5-dev-tools``.
|
||||||
@@ -137,7 +134,7 @@ the ``assets`` folder of the source. This file can be built from setup script by
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
python setup.py sample
|
python pkgutils.py sample
|
||||||
|
|
||||||
|
|
||||||
.. _a_source_docs:
|
.. _a_source_docs:
|
||||||
@@ -165,7 +162,7 @@ You can also build a PDF manual from the documentation using the setup script:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
python setup.py manual
|
python pkgutils.py manual
|
||||||
|
|
||||||
This will build the documentation as a PDF using LaTeX. The file will then be copied into the
|
This will build the documentation as a PDF using LaTeX. The file will then be copied into the
|
||||||
assets folder and made available in the :guilabel:`Help` menu in novelWriter. The Sphinx build
|
assets folder and made available in the :guilabel:`Help` menu in novelWriter. The Sphinx build
|
||||||
|
|||||||
+2
-2
@@ -76,7 +76,7 @@ The `i18n` folder at the root of the repository contains the `nw_XX.ts` translat
|
|||||||
Whether to add a new language to the translation framework, or to update the file against the
|
Whether to add a new language to the translation framework, or to update the file against the
|
||||||
current source code, you must first run the `qtlupdate` command:
|
current source code, you must first run the `qtlupdate` command:
|
||||||
```bash
|
```bash
|
||||||
python3 setup.py qtlupdate i18n/nw_XX.ts
|
python3 pkgutils.py qtlupdate i18n/nw_XX.ts
|
||||||
```
|
```
|
||||||
|
|
||||||
The file name must be in the correct format. All translation files must be located in the `i18n`
|
The file name must be in the correct format. All translation files must be located in the `i18n`
|
||||||
@@ -101,7 +101,7 @@ The application does not use `.ts` files directly. The `novelwriter/assets/i18n/
|
|||||||
the actual files used to translate the GUI into another language other than the default British
|
the actual files used to translate the GUI into another language other than the default British
|
||||||
English. These files are not generated by default, but they can be built with:
|
English. These files are not generated by default, but they can be built with:
|
||||||
```bash
|
```bash
|
||||||
python3 setup.py qtlrelease
|
python3 pkgutils.py qtlrelease
|
||||||
```
|
```
|
||||||
|
|
||||||
You can now test the translation in novelWriter. The Preferences dialog should list the newly added
|
You can now test the translation in novelWriter. The Preferences dialog should list the newly added
|
||||||
|
|||||||
Executable
+2035
File diff suppressed because it is too large
Load Diff
@@ -1,28 +0,0 @@
|
|||||||
# Build and Install novelWriter
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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).
|
|
||||||
|
|
||||||
In addition, it is a wrapper for `setuptools` and accept all commands associated with this tool.
|
|
||||||
|
|
||||||
To list all custom package and install options in this script, run:
|
|
||||||
```
|
|
||||||
./setup.py help
|
|
||||||
```
|
|
||||||
## Windows Scripts
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
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.
|
|
||||||
@@ -24,13 +24,13 @@ echo "Build Dir: $BUILD_DIR"
|
|||||||
|
|
||||||
pushd "$SRC_DIR" || exit 1
|
pushd "$SRC_DIR" || exit 1
|
||||||
|
|
||||||
VERSION="$(python3 setup.py version)"
|
VERSION="$(python3 pkgutils.py version)"
|
||||||
echo "novelWriter Version: $VERSION"
|
echo "novelWriter Version: $VERSION"
|
||||||
|
|
||||||
# --- Prepare Files ----------------------------------------------------------------------------- #
|
# --- Prepare Files ----------------------------------------------------------------------------- #
|
||||||
|
|
||||||
echo "Generating Info.plist"
|
echo "Generating Info.plist"
|
||||||
python3 setup.py gen-plist
|
python3 pkgutils.py gen-plist
|
||||||
if [ -f $SRC_DIR/setup/macos/Info.plist ]; then
|
if [ -f $SRC_DIR/setup/macos/Info.plist ]; then
|
||||||
echo "Found: setup/macos/Info.plist"
|
echo "Found: setup/macos/Info.plist"
|
||||||
else
|
else
|
||||||
|
|||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ ! -f setup.py ]; then
|
if [ ! -f pkgutils.py ]; then
|
||||||
echo "Must be called from the root folder of the source"
|
echo "Must be called from the root folder of the source"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rfv dist_upload
|
rm -rfv dist_upload
|
||||||
python3 setup.py build-clean
|
python3 pkgutils.py build-clean
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ ! -f setup.py ]; then
|
if [ ! -f pkgutils.py ]; then
|
||||||
echo "Must be called from the root folder of the source"
|
echo "Must be called from the root folder of the source"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -10,7 +10,7 @@ echo ""
|
|||||||
echo " Building Packages"
|
echo " Building Packages"
|
||||||
echo "================================================================================"
|
echo "================================================================================"
|
||||||
echo ""
|
echo ""
|
||||||
python3 setup.py qtlrelease manual sample
|
python3 pkgutils.py qtlrelease manual sample
|
||||||
python3 -m build
|
python3 -m build
|
||||||
mkdir -pv dist_upload
|
mkdir -pv dist_upload
|
||||||
cp -v dist/novelWriter-*.whl dist_upload/
|
cp -v dist/novelWriter-*.whl dist_upload/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ ! -f setup.py ]; then
|
if [ ! -f pkgutils.py ]; then
|
||||||
echo "Must be called from the root folder of the source"
|
echo "Must be called from the root folder of the source"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -10,20 +10,20 @@ echo ""
|
|||||||
echo " Building Dependencies"
|
echo " Building Dependencies"
|
||||||
echo "================================================================================"
|
echo "================================================================================"
|
||||||
echo ""
|
echo ""
|
||||||
python3 setup.py clean-assets
|
python3 pkgutils.py clean-assets
|
||||||
python3 setup.py qtlrelease manual sample
|
python3 pkgutils.py qtlrelease manual sample
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo " Building Minimal Packages"
|
echo " Building Minimal Packages"
|
||||||
echo "================================================================================"
|
echo "================================================================================"
|
||||||
echo ""
|
echo ""
|
||||||
python3 setup.py minimal-zip --target-win
|
python3 pkgutils.py minimal-zip --target-win
|
||||||
python3 setup.py minimal-zip --target-linux
|
python3 pkgutils.py minimal-zip --target-linux
|
||||||
python3 setup.py minimal-zip --target-darwin
|
python3 pkgutils.py minimal-zip --target-darwin
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo " Building Linux Packages"
|
echo " Building Linux Packages"
|
||||||
echo "================================================================================"
|
echo "================================================================================"
|
||||||
echo ""
|
echo ""
|
||||||
python3 setup.py build-deb --sign
|
python3 pkgutils.py build-deb --sign
|
||||||
python3 setup.py build-ubuntu --sign --first
|
python3 pkgutils.py build-ubuntu --sign --first
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ ! -f setup.py ]; then
|
if [ ! -f pkgutils.py ]; then
|
||||||
echo "Must be called from the root folder of the source"
|
echo "Must be called from the root folder of the source"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -10,11 +10,11 @@ echo ""
|
|||||||
echo " Building Dependencies"
|
echo " Building Dependencies"
|
||||||
echo "================================================================================"
|
echo "================================================================================"
|
||||||
echo ""
|
echo ""
|
||||||
python3 setup.py clean-assets
|
python3 pkgutils.py clean-assets
|
||||||
python3 setup.py qtlrelease manual sample
|
python3 pkgutils.py qtlrelease manual sample
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo " Building Linux Snapshots"
|
echo " Building Linux Snapshots"
|
||||||
echo "================================================================================"
|
echo "================================================================================"
|
||||||
echo ""
|
echo ""
|
||||||
python3 setup.py build-ubuntu --sign --snapshot
|
python3 pkgutils.py build-ubuntu --sign --snapshot
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ python --version 2>NUL
|
|||||||
if errorlevel 1 goto errorNoPython
|
if errorlevel 1 goto errorNoPython
|
||||||
echo Python found. OK.
|
echo Python found. OK.
|
||||||
|
|
||||||
if exist setup.py (
|
if exist pkgutils.py (
|
||||||
echo setup.py found. OK.
|
echo pkgutils.py found. OK.
|
||||||
) else (
|
) else (
|
||||||
cd ..
|
cd ..
|
||||||
if exist setup.py (
|
if exist pkgutils.py (
|
||||||
echo setup.py found. OK.
|
echo pkgutils.py found. OK.
|
||||||
) else (
|
) else (
|
||||||
goto errorNoSetup
|
goto errorNoSetup
|
||||||
)
|
)
|
||||||
@@ -23,7 +23,7 @@ echo.
|
|||||||
pip install --user pywin32 -r requirements.txt
|
pip install --user pywin32 -r requirements.txt
|
||||||
|
|
||||||
:: Create the desktop and start menu icons
|
:: Create the desktop and start menu icons
|
||||||
python setup.py win-install
|
python pkgutils.py win-install
|
||||||
|
|
||||||
pause
|
pause
|
||||||
goto:eof
|
goto:eof
|
||||||
@@ -41,9 +41,9 @@ goto:eof
|
|||||||
|
|
||||||
:errorNoSetup
|
:errorNoSetup
|
||||||
echo.
|
echo.
|
||||||
echo ERROR^: Could not find the setup.py script.
|
echo ERROR^: Could not find the pkgutils.py script.
|
||||||
echo.
|
echo.
|
||||||
echo Make sure you run setup.py from the novelWriter root folder.
|
echo Make sure you run pkgutils.py from the novelWriter root folder.
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
pause
|
pause
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ python --version 2>NUL
|
|||||||
if errorlevel 1 goto errorNoPython
|
if errorlevel 1 goto errorNoPython
|
||||||
echo Python found. OK.
|
echo Python found. OK.
|
||||||
|
|
||||||
if exist setup.py (
|
if exist pkgutils.py (
|
||||||
echo setup.py found. OK.
|
echo pkgutils.py found. OK.
|
||||||
) else (
|
) else (
|
||||||
cd ..
|
cd ..
|
||||||
if exist setup.py (
|
if exist pkgutils.py (
|
||||||
echo setup.py found. OK.
|
echo pkgutils.py found. OK.
|
||||||
) else (
|
) else (
|
||||||
goto errorNoSetup
|
goto errorNoSetup
|
||||||
)
|
)
|
||||||
@@ -27,7 +27,7 @@ goto afterUninst
|
|||||||
:doUninst
|
:doUninst
|
||||||
|
|
||||||
:: Remove the desktop and start menu icons
|
:: Remove the desktop and start menu icons
|
||||||
python setup.py win-uninstall
|
python pkgutils.py win-uninstall
|
||||||
|
|
||||||
:: Remove the PyQt5 and pyenchant dependencies
|
:: Remove the PyQt5 and pyenchant dependencies
|
||||||
pip uninstall --yes -r requirements.txt
|
pip uninstall --yes -r requirements.txt
|
||||||
@@ -51,9 +51,9 @@ goto:eof
|
|||||||
|
|
||||||
:errorNoSetup
|
:errorNoSetup
|
||||||
echo.
|
echo.
|
||||||
echo ERROR^: Could not find the setup.py script.
|
echo ERROR^: Could not find the pkgutils.py script.
|
||||||
echo.
|
echo.
|
||||||
echo Make sure you run setup.py from the novelWriter root folder.
|
echo Make sure you run pkgutils.py from the novelWriter root folder.
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
pause
|
pause
|
||||||
|
|||||||
Reference in New Issue
Block a user