From f364b8102dbf9b03dadd874f5d5e5bfe95833a1e Mon Sep 17 00:00:00 2001 From: Morten Brekkevold Date: Fri, 8 Nov 2024 15:08:28 +0100 Subject: [PATCH 1/5] Delete the obsolete setup.py libsass is gone, and `setuptools_scm` no longer requires `setup.py`, so our transition to using only `pyproject.toml` should be complete. --- setup.py | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index c6b6bc2c1d..0000000000 --- a/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -from setuptools import setup - -setup( - setup_requires=['setuptools_scm'], -) From 8d71f523cc5cdf3740abaeac17a765979517e2e9 Mon Sep 17 00:00:00 2001 From: Morten Brekkevold Date: Fri, 8 Nov 2024 15:09:57 +0100 Subject: [PATCH 2/5] Update the install-from-source docs This removes mentions of the removed `setup.py` script, but also changes the installation guide to recommend a virtualenv for installing NAV. Using a virtualenv has become obligatory for Debian-based distros, unless everything is packaged as a .deb package. --- doc/howto/generic-install-from-source.rst | 33 ++++++++++++++++------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/doc/howto/generic-install-from-source.rst b/doc/howto/generic-install-from-source.rst index 9440358fc3..d0fd370281 100644 --- a/doc/howto/generic-install-from-source.rst +++ b/doc/howto/generic-install-from-source.rst @@ -43,11 +43,14 @@ To run NAV, these software packages are required: PostgreSQL and Graphite are services that do not necessarily need to run on the same server as NAV. -The required Python modules can be installed either from your OS package -manager, or from the Python Package Index (PyPI_) using the regular ``setup.py`` -method described below. The packages can also be installed from PyPI_ in a -separate step, using the pip_ tool and the provided requirements and constraints -files:: +While the required Python modules can be installed from your OS package +manager, most distributions do not provide all of them, or cannot provide them +in the required versions. We recommend creating a Python virtual environment +(virtualenv), which will ensure NAV's Python requirements do not interfere with +your system Python libraries. Use pip_ to install all Python requirements +from the Python Package Index (PyPI_), using the method described below. The +packages can also be installed from PyPI_ in a separate step, using the pip_ +tool and the provided requirements and constraints files:: pip install -r requirements.txt -c constraints.txt @@ -90,13 +93,25 @@ the following command to build the CSS assets:: This will build the CSS assets and place them in the :file:`python/nav/web/static/css` directory. -To build and install NAV and all its Python dependencies:: +We recommend installing NAV into a Python virtual environment, to avoid +interfering with your system-wide Python libraries. Pick a suitable path for +the virtual environment (e.g. :file:`/opt/nav`), create it and activate it in +your shell before installing NAV:: + + python3 -m venv /opt/nav + source /opt/nav/bin/activate + +To build and install NAV and all its Python dependencies in the activated +virtual environment, run:: pip install -r requirements.txt -c constraints.txt . -This will build and install NAV in the default system-wide directories for your -system. If you wish to customize the install locations, please consult the -output of ``python setup.py install --help``. +If you want to make sure you can run all NAV programs without first explicitly +activating the virtual environment in a shell, you can add the virtual +environment's :file:`bin` directory to your system's :envvar:`PATH` variable, +e.g.:: + + export PATH=$PATH:/opt/nav/bin .. _initializing-the-configuration-files: From 01a34b329a6dace07d742bd89815c168355174c4 Mon Sep 17 00:00:00 2001 From: Morten Brekkevold Date: Fri, 8 Nov 2024 15:14:37 +0100 Subject: [PATCH 3/5] Remove obsolete `setup.py build_sphinx` command These install docs were obsolete, and even more so now that `setup.py` is gone. Fixes #3141 --- doc/howto/generic-install-from-source.rst | 2 +- doc/howto/manual-install-on-debian.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/howto/generic-install-from-source.rst b/doc/howto/generic-install-from-source.rst index d0fd370281..a18072d27e 100644 --- a/doc/howto/generic-install-from-source.rst +++ b/doc/howto/generic-install-from-source.rst @@ -217,7 +217,7 @@ Building the documentation If you wish, this HTML documentation can be built separately using this step:: - python setup.py build_sphinx + sphinx-build The resulting files will typically be placed in :file:`build/sphinx/html/`. diff --git a/doc/howto/manual-install-on-debian.rst b/doc/howto/manual-install-on-debian.rst index 2e849434a7..71358adc20 100644 --- a/doc/howto/manual-install-on-debian.rst +++ b/doc/howto/manual-install-on-debian.rst @@ -59,7 +59,7 @@ actually find :file:`nav.conf`:: If you like, you can build the complete HTML documentation thus:: - python setup.py build_sphinx + sphinx-build 6. Initialize the database From 0fb5a0d6d9572a604150d0e6be213d76bdf6cb18 Mon Sep 17 00:00:00 2001 From: Morten Brekkevold Date: Fri, 8 Nov 2024 15:16:39 +0100 Subject: [PATCH 4/5] Fix obsolete verification of source code presence There is no longer a `setup.py` in the source root, but rather `pyproject.toml`. This ensures the Docker container's verification that the source code seems to be mounted on `/source` is still up to snuff. --- tools/docker/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/docker/build.sh b/tools/docker/build.sh index 74cea59df3..d66f33bb37 100755 --- a/tools/docker/build.sh +++ b/tools/docker/build.sh @@ -2,7 +2,7 @@ set -ex -if [[ ! -f "/source/setup.py" ]]; then +if [[ ! -f "/source/pyproject.toml" ]]; then echo NAV source code does not appear to be mounted at /source exit 1 fi From 14f00739e2b6d572178c75ab683e838af698c1ce Mon Sep 17 00:00:00 2001 From: Morten Brekkevold Date: Fri, 8 Nov 2024 15:24:32 +0100 Subject: [PATCH 5/5] Add news fragment --- changelog.d/3176.changed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/3176.changed.md diff --git a/changelog.d/3176.changed.md b/changelog.d/3176.changed.md new file mode 100644 index 0000000000..51948389ce --- /dev/null +++ b/changelog.d/3176.changed.md @@ -0,0 +1 @@ +The old-style `setup.py` script was removed and installation docs were updated