Update setup files (#1436)

This commit is contained in:
Veronica Berglyd Olsen
2023-05-05 00:26:28 +02:00
committed by GitHub
5 changed files with 49 additions and 25 deletions
+31 -17
View File
@@ -17,6 +17,22 @@ to build the various components like the translation files and documentation.
now deprecated, but many systems still have both Python 2 and 3. For such systems, the command
``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
in the ``setup.py`` script in the root of the source code. You can list the available commands by
running:
.. code-block:: bash
python setup.py help
.. warning::
Calling ``setup.py install`` has been deprecated for a while, and this approach is no longer
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:
@@ -58,37 +74,35 @@ source, dependencies can still be installed from PyPi with:
.. _a_source_install:
Install from Source
===================
Build and Install from Source
=============================
You can download the latest version of novelWriter from the source repository on GitHub_ and run
the setup manually. It is equivalent to what the ``pip install`` command does, and it installs
novelWriter to the default location for Python packages.
This step requires that you have ``setuptools`` installed on your system. If you don't have it
installed, it can usually be installed from your distro's repository. For Debian and Ubuntu this is
achieved with:
If you want to install novelWriter directly from the source available on GitHub_, you must first
build the package using the Python Packaging Authority's build tool. It can be installed with:
.. code-block:: bash
sudo apt install python3-setuptools
pip install --upgrade build
The package is also available from PyPi:
On Debian-based systems the tool can also be installed with:
.. code-block:: bash
pip install --user setuptools
sudo apt install python3-build
With ``setuptools`` in place, novelWriter can be installed to the user space with:
With the tool installed, run the following command from the root of the novelWriter source code:
.. code-block:: bash
python setup.py install --user
python -m build
.. tip::
This should generate two files in the ``dist/`` folder at your current location. One with file
extension ``.tar.gz`` and one with extension ``.whl``. The latter is the package you want to
install, here with example version number 2.0.7, but your may be different:
The main setup script has a number of options that may be useful to you. You can list them by
running ``python setup.py help``.
.. code-block:: bash
pip install --user dist/novelWriter-2.0.7-py3-none-any.whl
.. _a_source_i18n:
+1 -2
View File
@@ -1,4 +1,3 @@
# Minimal PEP 518 pyproject file
[build-system]
requires = ["setuptools", "wheel"]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
+3 -2
View File
@@ -7,7 +7,7 @@ description = A markdown-like text editor for planning and writing novels
url = https://novelwriter.io
long_description = file: setup/description_pypi.md
long_description_content_type = text/markdown
license_file = LICENSE.md
license_files = LICENSE.md
license = GNU General Public License v3
classifiers =
Programming Language :: Python :: 3 :: Only
@@ -29,9 +29,10 @@ project_urls =
Source Code = https://github.com/vkbo/novelWriter
[options]
zip_safe = False
python_requires = >=3.7
include_package_data = True
packages = find:
packages = find_namespace:
install_requires =
pyqt5>=5.10
lxml>=4.2.0
+9 -3
View File
@@ -1909,9 +1909,7 @@ if __name__ == "__main__":
"",
"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.",
" install Deprecated. Use pip or build.",
" 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.",
@@ -2064,6 +2062,14 @@ if __name__ == "__main__":
# 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
+5 -1
View File
@@ -11,9 +11,13 @@ echo " Building Packages"
echo "================================================================================"
echo ""
python3 setup.py qtlrelease manual sample
python3 setup.py sdist bdist_wheel
python3 -m build
mkdir -pv dist_upload
cp -v dist/novelWriter-*.whl dist_upload/
cd dist_upload
FILE=$(ls -t | head -1)
shasum -a 256 $FILE | tee $FILE.sha256
cd ..
echo ""
echo " Checking Packages"