Remove setup.py (#1483)
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
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Install Dependencies (pip)
|
- name: Install Dependencies (pip)
|
||||||
run: |
|
run: |
|
||||||
pip install -U -r requirements.txt -r requirements-dev.txt
|
pip install -U -r requirements.txt -r tests/requirements.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
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Install Dependencies (pip)
|
- name: Install Dependencies (pip)
|
||||||
run: |
|
run: |
|
||||||
pip install -U pyobjc -r requirements.txt -r requirements-dev.txt
|
pip install -U pyobjc -r requirements.txt -r tests/requirements.txt
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: |
|
run: |
|
||||||
export QT_QPA_PLATFORM=offscreen
|
export QT_QPA_PLATFORM=offscreen
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Install Dependencies (pip)
|
- name: Install Dependencies (pip)
|
||||||
run: |
|
run: |
|
||||||
pip install -U -r requirements.txt -r requirements-dev.txt
|
pip install -U -r requirements.txt -r tests/requirements.txt
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
run: |
|
run: |
|
||||||
pytest -v --cov=novelwriter --timeout=60
|
pytest -v --cov=novelwriter --timeout=60
|
||||||
|
|||||||
+2
-3
@@ -1,7 +1,6 @@
|
|||||||
include setup.py
|
include pkgutils.py
|
||||||
include LICENSE.md
|
include LICENSE.md
|
||||||
include CREDITS.md
|
include CREDITS.md
|
||||||
include CHANGELOG.md
|
include CHANGELOG.md
|
||||||
recursive-include setup *
|
|
||||||
recursive-include novelwriter/assets *
|
recursive-include novelwriter/assets *
|
||||||
recursive-include sample *.nwx *.nwd
|
recursive-include setup *
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ The dependencies for running the tests can be installed with:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
pip install -r requirements-dev.txt
|
pip install -r tests/requirements.txt
|
||||||
|
|
||||||
This will install a couple of extra packages for coverage and test management. The minimum
|
This will install a couple of extra packages for coverage and test management. The minimum
|
||||||
requirement is ``pytest`` and ``pytest-qt``.
|
requirement is ``pytest`` and ``pytest-qt``.
|
||||||
|
|||||||
+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
|
||||||
|
|||||||
+31
-70
@@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
novelWriter – Main Setup Script
|
novelWriter – Packaging Utils
|
||||||
===============================
|
=============================
|
||||||
The main setup and install script for all operating systems
|
|
||||||
|
|
||||||
File History:
|
File History:
|
||||||
Created: 2019-05-16 [0.5.1]
|
Created: 2019-05-16 [0.5.1]
|
||||||
|
Renamed: 2023-07-26 [2.1b1]
|
||||||
|
|
||||||
This file is a part of novelWriter
|
This file is a part of novelWriter
|
||||||
Copyright 2018–2023, Veronica Berglyd Olsen
|
Copyright 2018–2023, Veronica Berglyd Olsen
|
||||||
@@ -74,14 +74,12 @@ def extractVersion(beQuiet=False):
|
|||||||
|
|
||||||
|
|
||||||
def compactVersion(version):
|
def compactVersion(version):
|
||||||
"""Make the version number more compact.
|
"""Make the version number more compact."""
|
||||||
"""
|
|
||||||
return version.replace("-alpha", "a").replace("-beta", "b").replace("-rc", "rc")
|
return version.replace("-alpha", "a").replace("-beta", "b").replace("-rc", "rc")
|
||||||
|
|
||||||
|
|
||||||
def sysCall(callArgs, cwd=None):
|
def sysCall(callArgs, cwd=None):
|
||||||
"""Wrapper function for system calls.
|
"""Wrapper function for system calls."""
|
||||||
"""
|
|
||||||
sysP = subprocess.Popen(
|
sysP = subprocess.Popen(
|
||||||
callArgs, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
callArgs, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||||
shell=True, cwd=cwd
|
shell=True, cwd=cwd
|
||||||
@@ -91,21 +89,19 @@ def sysCall(callArgs, cwd=None):
|
|||||||
|
|
||||||
|
|
||||||
def readFile(fileName):
|
def readFile(fileName):
|
||||||
"""Read an entire file and return as a string.
|
"""Read an entire file and return as a string."""
|
||||||
"""
|
|
||||||
with open(fileName, mode="r", encoding="utf-8") as inFile:
|
with open(fileName, mode="r", encoding="utf-8") as inFile:
|
||||||
return inFile.read()
|
return inFile.read()
|
||||||
|
|
||||||
|
|
||||||
def writeFile(fileName, writeText):
|
def writeFile(fileName, writeText):
|
||||||
"""Write string to file.
|
"""Write string to file."""
|
||||||
"""
|
|
||||||
with open(fileName, mode="w+", encoding="utf-8") as outFile:
|
with open(fileName, mode="w+", encoding="utf-8") as outFile:
|
||||||
outFile.write(writeText)
|
outFile.write(writeText)
|
||||||
|
|
||||||
|
|
||||||
def toUpload(srcPath, dstName=None):
|
def toUpload(srcPath, dstName=None):
|
||||||
"""Copy a file produced by one of the build functions to the uplaod
|
"""Copy a file produced by one of the build functions to the upload
|
||||||
directory. The file can optionally be given a new name.
|
directory. The file can optionally be given a new name.
|
||||||
"""
|
"""
|
||||||
uplDir = "dist_upload"
|
uplDir = "dist_upload"
|
||||||
@@ -118,8 +114,7 @@ def toUpload(srcPath, dstName=None):
|
|||||||
|
|
||||||
|
|
||||||
def makeCheckSum(sumFile, cwd=None):
|
def makeCheckSum(sumFile, cwd=None):
|
||||||
"""Create a SHA256 checkcusm file.
|
"""Create a SHA256 checksum file."""
|
||||||
"""
|
|
||||||
try:
|
try:
|
||||||
if cwd is None:
|
if cwd is None:
|
||||||
shaFile = sumFile+".sha256"
|
shaFile = sumFile+".sha256"
|
||||||
@@ -178,8 +173,7 @@ def installPackages(hostOS):
|
|||||||
##
|
##
|
||||||
|
|
||||||
def cleanBuildDirs():
|
def cleanBuildDirs():
|
||||||
"""Recursively delete the 'build' and 'dist' folders.
|
"""Recursively delete the 'build' and 'dist' folders."""
|
||||||
"""
|
|
||||||
print("")
|
print("")
|
||||||
print("Cleaning up build environment ...")
|
print("Cleaning up build environment ...")
|
||||||
print("")
|
print("")
|
||||||
@@ -207,7 +201,7 @@ def cleanBuildDirs():
|
|||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
# Additional Buiilds
|
# Additional Builds
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -215,8 +209,7 @@ def cleanBuildDirs():
|
|||||||
##
|
##
|
||||||
|
|
||||||
def buildPdfManual():
|
def buildPdfManual():
|
||||||
"""This function will build the documentation as manual.pdf.
|
"""This function will build the documentation as manual.pdf."""
|
||||||
"""
|
|
||||||
print("")
|
print("")
|
||||||
print("Building PDF Manual")
|
print("Building PDF Manual")
|
||||||
print("===================")
|
print("===================")
|
||||||
@@ -270,8 +263,7 @@ def buildPdfManual():
|
|||||||
##
|
##
|
||||||
|
|
||||||
def buildQtI18n():
|
def buildQtI18n():
|
||||||
"""Build the lang.qm files for Qt Linguist.
|
"""Build the lang.qm files for Qt Linguist."""
|
||||||
"""
|
|
||||||
print("")
|
print("")
|
||||||
print("Building Qt Localisation Files")
|
print("Building Qt Localisation Files")
|
||||||
print("==============================")
|
print("==============================")
|
||||||
@@ -324,8 +316,7 @@ def buildQtI18n():
|
|||||||
##
|
##
|
||||||
|
|
||||||
def buildQtI18nTS(sysArgs):
|
def buildQtI18nTS(sysArgs):
|
||||||
"""Build the lang.ts files for Qt Linguist.
|
"""Build the lang.ts files for Qt Linguist."""
|
||||||
"""
|
|
||||||
print("")
|
print("")
|
||||||
print("Building Qt Translation Files")
|
print("Building Qt Translation Files")
|
||||||
print("=============================")
|
print("=============================")
|
||||||
@@ -404,8 +395,7 @@ def buildQtI18nTS(sysArgs):
|
|||||||
##
|
##
|
||||||
|
|
||||||
def genMacOSPlist():
|
def genMacOSPlist():
|
||||||
"""Set necessary values for .plist file for MacOS build.
|
"""Set necessary values for .plist file for MacOS build."""
|
||||||
"""
|
|
||||||
numVers, _, _ = extractVersion()
|
numVers, _, _ = extractVersion()
|
||||||
pkgVers = compactVersion(numVers)
|
pkgVers = compactVersion(numVers)
|
||||||
outDir = "setup/macos"
|
outDir = "setup/macos"
|
||||||
@@ -471,8 +461,7 @@ def buildSampleZip():
|
|||||||
|
|
||||||
|
|
||||||
def cleanBuiltAssets():
|
def cleanBuiltAssets():
|
||||||
"""Remove assets built by this script.
|
"""Remove assets built by this script."""
|
||||||
"""
|
|
||||||
print("")
|
print("")
|
||||||
print("Removing Built Assets")
|
print("Removing Built Assets")
|
||||||
print("=====================")
|
print("=====================")
|
||||||
@@ -536,8 +525,7 @@ def checkAssetsExist():
|
|||||||
##
|
##
|
||||||
|
|
||||||
def importI18nUpdates(sysArgs):
|
def importI18nUpdates(sysArgs):
|
||||||
"""Import new translation files from a zip file.
|
"""Import new translation files from a zip file."""
|
||||||
"""
|
|
||||||
print("")
|
print("")
|
||||||
print("Import Updated Translations")
|
print("Import Updated Translations")
|
||||||
print("===========================")
|
print("===========================")
|
||||||
@@ -577,8 +565,7 @@ def importI18nUpdates(sysArgs):
|
|||||||
##
|
##
|
||||||
|
|
||||||
def makeMinimalPackage(targetOS):
|
def makeMinimalPackage(targetOS):
|
||||||
"""Pack the core source file in a single zip file.
|
"""Pack the core source file in a single zip file."""
|
||||||
"""
|
|
||||||
from zipfile import ZipFile, ZIP_DEFLATED
|
from zipfile import ZipFile, ZIP_DEFLATED
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
@@ -626,7 +613,7 @@ def makeMinimalPackage(targetOS):
|
|||||||
"CREDITS.md",
|
"CREDITS.md",
|
||||||
"CHANGELOG.md",
|
"CHANGELOG.md",
|
||||||
"requirements.txt",
|
"requirements.txt",
|
||||||
"setup.py",
|
"pkgutils.py",
|
||||||
"setup.cfg",
|
"setup.cfg",
|
||||||
"pyproject.toml",
|
"pyproject.toml",
|
||||||
]
|
]
|
||||||
@@ -694,12 +681,12 @@ def makeMinimalPackage(targetOS):
|
|||||||
##
|
##
|
||||||
|
|
||||||
def makeDebianPackage(signKey=None, sourceBuild=False, distName="unstable", buildName=""):
|
def makeDebianPackage(signKey=None, sourceBuild=False, distName="unstable", buildName=""):
|
||||||
"""Build a Debian package.
|
"""Build a Debian package."""
|
||||||
"""
|
|
||||||
print("")
|
print("")
|
||||||
print("Build Debian Package")
|
print("Build Debian Package")
|
||||||
print("====================")
|
print("====================")
|
||||||
print("On Debian/Ubuntu install: dh-python python3-all debhelper devscripts")
|
print("On Debian/Ubuntu install: dh-python python3-all debhelper devscripts ")
|
||||||
|
print(" pybuild-plugin-pyproject")
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
# Version Info
|
# Version Info
|
||||||
@@ -868,8 +855,7 @@ def makeDebianPackage(signKey=None, sourceBuild=False, distName="unstable", buil
|
|||||||
##
|
##
|
||||||
|
|
||||||
def makeForLaunchpad(doSign=False, isFirst=False, isSnapshot=False):
|
def makeForLaunchpad(doSign=False, isFirst=False, isSnapshot=False):
|
||||||
"""Wrapper for building debian packages for launchpad.
|
"""Wrapper for building Debian packages for Launchpad."""
|
||||||
"""
|
|
||||||
print("")
|
print("")
|
||||||
print("Launchpad Packages")
|
print("Launchpad Packages")
|
||||||
print("==================")
|
print("==================")
|
||||||
@@ -885,8 +871,8 @@ def makeForLaunchpad(doSign=False, isFirst=False, isSnapshot=False):
|
|||||||
distLoop = [
|
distLoop = [
|
||||||
("20.04", "focal"),
|
("20.04", "focal"),
|
||||||
("22.04", "jammy"),
|
("22.04", "jammy"),
|
||||||
("22.10", "kinetic"),
|
|
||||||
("23.04", "lunar"),
|
("23.04", "lunar"),
|
||||||
|
("23.10", "mantic"),
|
||||||
]
|
]
|
||||||
|
|
||||||
tStamp = datetime.datetime.now().strftime("%Y%m%d~%H%M%S")
|
tStamp = datetime.datetime.now().strftime("%Y%m%d~%H%M%S")
|
||||||
@@ -938,8 +924,7 @@ def makeForLaunchpad(doSign=False, isFirst=False, isSnapshot=False):
|
|||||||
##
|
##
|
||||||
|
|
||||||
def makeAppImage(sysArgs):
|
def makeAppImage(sysArgs):
|
||||||
"""Build an AppImage.
|
"""Build an AppImage."""
|
||||||
"""
|
|
||||||
import glob
|
import glob
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
@@ -1388,8 +1373,7 @@ def makeWindowsEmbedded(sysArgs):
|
|||||||
##
|
##
|
||||||
|
|
||||||
def xdgInstall():
|
def xdgInstall():
|
||||||
"""Will attempt to install icons and make a launcher.
|
"""Will attempt to install icons and make a launcher."""
|
||||||
"""
|
|
||||||
print("")
|
print("")
|
||||||
print("XDG Install")
|
print("XDG Install")
|
||||||
print("===========")
|
print("===========")
|
||||||
@@ -1525,8 +1509,7 @@ def xdgInstall():
|
|||||||
##
|
##
|
||||||
|
|
||||||
def xdgUninstall():
|
def xdgUninstall():
|
||||||
"""Will attempt to uninstall icons and make a launcher.
|
"""Will attempt to uninstall icons and the launcher."""
|
||||||
"""
|
|
||||||
print("")
|
print("")
|
||||||
print("XDG Uninstall")
|
print("XDG Uninstall")
|
||||||
print("=============")
|
print("=============")
|
||||||
@@ -1596,15 +1579,14 @@ def xdgUninstall():
|
|||||||
##
|
##
|
||||||
|
|
||||||
def winInstall():
|
def winInstall():
|
||||||
"""Will attempt to install icons and make a launcher for Windows.
|
"""Will attempt to install icons and make a launcher for Windows."""
|
||||||
"""
|
|
||||||
import winreg
|
import winreg
|
||||||
try:
|
try:
|
||||||
import win32com.client
|
import win32com.client
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print(
|
print(
|
||||||
"ERROR: Package 'pywin32' is missing on this system.\n"
|
"ERROR: Package 'pywin32' is missing on this system.\n"
|
||||||
" Please run 'setup.py pip' to automatically install\n"
|
" Please run 'pkgutils.py pip' to automatically install\n"
|
||||||
" dependecies, or run 'pip install --user pywin32'."
|
" dependecies, or run 'pip install --user pywin32'."
|
||||||
)
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@@ -1724,8 +1706,7 @@ def winInstall():
|
|||||||
##
|
##
|
||||||
|
|
||||||
def winUninstall():
|
def winUninstall():
|
||||||
"""Will attempt to uninstall icons previously installed.
|
"""Will attempt to uninstall icons previously installed."""
|
||||||
"""
|
|
||||||
import winreg
|
import winreg
|
||||||
try:
|
try:
|
||||||
import win32com.client
|
import win32com.client
|
||||||
@@ -1812,8 +1793,7 @@ def winUninstall():
|
|||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
"""Parse command line options and run the commands.
|
"""Parse command line options and run the commands."""
|
||||||
"""
|
|
||||||
# Detect OS
|
# Detect OS
|
||||||
if sys.platform.startswith("linux"):
|
if sys.platform.startswith("linux"):
|
||||||
hostOS = OS_LINUX
|
hostOS = OS_LINUX
|
||||||
@@ -2053,23 +2033,4 @@ if __name__ == "__main__":
|
|||||||
print("ERROR: Command 'win-uninstall' can only be used on Windows")
|
print("ERROR: Command 'win-uninstall' can only be used on Windows")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Actions
|
|
||||||
# =======
|
|
||||||
|
|
||||||
if len(sys.argv) <= 1:
|
|
||||||
# Nothing more to do
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
# Run the standard setup
|
|
||||||
import setuptools # noqa: F401
|
|
||||||
import warnings # noqa: F401
|
|
||||||
warnings.warn(
|
|
||||||
"The setuptools section of setup.py is deprecated and will be removed "
|
|
||||||
"in a future release and the setup.py file will be renamed to avoid "
|
|
||||||
"conflicts with build tools. Please don't use the 'setup.py install' "
|
|
||||||
"command, and instead use the pip and build commands.",
|
|
||||||
DeprecationWarning
|
|
||||||
)
|
|
||||||
setuptools.setup()
|
|
||||||
|
|
||||||
# END Main
|
# END Main
|
||||||
@@ -38,7 +38,7 @@ install_requires =
|
|||||||
pyenchant>=3.0.0
|
pyenchant>=3.0.0
|
||||||
|
|
||||||
[options.packages.find]
|
[options.packages.find]
|
||||||
exclude = docs, tests, sample
|
include = novelwriter*
|
||||||
|
|
||||||
[options.entry_points]
|
[options.entry_points]
|
||||||
console_script =
|
console_script =
|
||||||
|
|||||||
@@ -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