1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Transition from setup.py to pyproject.toml

This commit is contained in:
dmiller
2024-03-21 20:20:00 +00:00
parent f4f2e60d9e
commit a946c5682d
6 changed files with 12 additions and 17 deletions

View File

@@ -251,7 +251,6 @@ clean-liblinear:
-cd $(LIBLINEARDIR) && $(MAKE) clean -cd $(LIBLINEARDIR) && $(MAKE) clean
clean-zenmap: clean-zenmap:
-cd $(ZENMAPDIR) && $(PYTHON) setup.py clean --all
rm -f $(ZENMAPDIR)/zenmapCore/__init__.pyc rm -f $(ZENMAPDIR)/zenmapCore/__init__.pyc
rm -f $(ZENMAPDIR)/zenmapCore/Version.pyc rm -f $(ZENMAPDIR)/zenmapCore/Version.pyc
rm -f $(ZENMAPDIR)/zenmapCore/Name.pyc rm -f $(ZENMAPDIR)/zenmapCore/Name.pyc
@@ -361,15 +360,12 @@ tests/%: tests/%.cc $(OBJS)
# local installation. # local installation.
DEFAULT_PYTHON_PATH = /usr/bin/env python3 DEFAULT_PYTHON_PATH = /usr/bin/env python3
build-zenmap: $(ZENMAPDIR)/setup.py $(ZENMAPDIR)/zenmapCore/Version.py build-zenmap: $(ZENMAPDIR)/pyproject.toml $(ZENMAPDIR)/zenmapCore/Version.py
# When DESTDIR is defined, assume we're building an executable $(PYTHON) -m build $(ZENMAPDIR)
# distribution rather than a local installation and force a generic
# Python interpreter location.
cd $(ZENMAPDIR) && $(PYTHON) setup.py build $(if $(DESTDIR),--executable "$(DEFAULT_PYTHON_PATH)")
install-zenmap: $(ZENMAPDIR)/setup.py install-zenmap: $(ZENMAPDIR)/pyproject.toml
$(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 $(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
cd $(ZENMAPDIR) && $(PYTHON) setup.py --quiet install --prefix "$(prefix)" --force $(if $(DESTDIR),--root "$(DESTDIR)") $(PYTHON) -m pip install $(ZENMAPDIR) $(if $(DESTDIR),--root "$(DESTDIR)")
$(INSTALL) -c -m 644 docs/zenmap.1 $(DESTDIR)$(mandir)/man1/ $(INSTALL) -c -m 644 docs/zenmap.1 $(DESTDIR)$(mandir)/man1/
# Create a symlink from nmapfe to zenmap if nmapfe doesn't exist or is # Create a symlink from nmapfe to zenmap if nmapfe doesn't exist or is
# already a link. # already a link.
@@ -426,7 +422,7 @@ uninstall-nmap:
rm -rf $(DESTDIR)$(nmapdatadir) rm -rf $(DESTDIR)$(nmapdatadir)
uninstall-zenmap: uninstall-zenmap:
cd $(ZENMAPDIR) && $(PYTHON) setup.py uninstall $(PYTHON) -m pip uninstall $(ZENMAPDIR)
rm -f $(DESTDIR)$(mandir)/man1/zenmap.1 rm -f $(DESTDIR)$(mandir)/man1/zenmap.1
# Uninstall nmapfe only if it's a symlink. # Uninstall nmapfe only if it's a symlink.
if [ -L $(DESTDIR)$(bindir)/nmapfe ]; then \ if [ -L $(DESTDIR)$(bindir)/nmapfe ]; then \

View File

@@ -72,7 +72,7 @@ $(IMAGE_NAME): tool-checks $(IMAGE_STAGING_DIR)/$(PKG_NAME)
# Check the created disk image for the sizes, backgrounds and icons presence and positions # Check the created disk image for the sizes, backgrounds and icons presence and positions
./check_test.sh $(README_FILE) $(LICENSE_FILE) $(3RD_P_LIC_FILE) $(LICENSES_FILE) ./check_test.sh $(README_FILE) $(LICENSE_FILE) $(3RD_P_LIC_FILE) $(LICENSES_FILE)
tool-checks: have-$(CC) have-jhbuild have-gtk-mac-bundler tool-checks: have-jhbuild have-gtk-mac-bundler
have-%: have-%:
which $* which $*

View File

@@ -47,7 +47,7 @@ Default (source) Installation
Zenmap is packaged using Python setuptools. To install Zenmap Zenmap is packaged using Python setuptools. To install Zenmap
independently of Nmap, enter the zenmap subdirectory and run independently of Nmap, enter the zenmap subdirectory and run
python setup.py install python3 -m pip install .
Links: Links:

View File

@@ -25,7 +25,7 @@ $CC $CPPFLAGS $CFLAGS $LDFLAGS -L$PREFIX/lib `python3-config --cflags --ldflags
~/gtk-mac-bundler/examples/python-launcher.c ~/gtk-mac-bundler/examples/python-launcher.c
echo "Installing Zenmap to local system" echo "Installing Zenmap to local system"
python3 setup.py install vanilla --prefix "$PREFIX" python3 -m pip install --ignore-installed --target "$PREFIX/lib/python-3.11/site-packages" .
echo "Generating dependencies" echo "Generating dependencies"
# Have to run this with ~/gtk/inst/python3 or deps have wrong paths # Have to run this with ~/gtk/inst/python3 or deps have wrong paths
@@ -79,8 +79,7 @@ python -m compileall "$PYTHONLIB"/site-packages #|| true
echo "Stripping unoptimized Python libraries" echo "Stripping unoptimized Python libraries"
echo "Building using setuptools" echo "Building using setuptools"
python3 setup.py build --executable "/usr/bin/env python3" python3 -m pip install --ignore-installed --target "$BASE/Resources/lib/python-3.11/site-packages" .
python3 setup.py install vanilla --prefix "$BASE/Resources"
echo "Renaming main Zenmap executable." echo "Renaming main Zenmap executable."
mv $BASE/MacOS/$APP_NAME $BASE/MacOS/zenmap.bin mv $BASE/MacOS/$APP_NAME $BASE/MacOS/zenmap.bin

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE app-bundle [ <!DOCTYPE app-bundle [
<!ENTITY PYVER "3.10"> <!ENTITY PYVER "3.11">
<!ENTITY pyreqs SYSTEM "pyreqs.xml"> <!ENTITY pyreqs SYSTEM "pyreqs.xml">
]> ]>
<app-bundle> <app-bundle>

View File

@@ -25,8 +25,8 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
package() { package() {
cd "${NMAP_DIR}/zenmap" cd "${NMAP_DIR}/zenmap"
${MINGW_PREFIX}/bin/python setup.py build #${MINGW_PREFIX}/bin/python -m pip build
MSYS2_ARG_CONV_EXCL="--prefix=" \ MSYS2_ARG_CONV_EXCL="--prefix=" \
${MINGW_PREFIX}/bin/python setup.py install vanilla --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1 ${MINGW_PREFIX}/bin/python -m pip install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1
install -Dm644 install_scripts/unix/zenmap.desktop "${pkgdir}${MINGW_PREFIX}/share/applications/zenmap.desktop" install -Dm644 install_scripts/unix/zenmap.desktop "${pkgdir}${MINGW_PREFIX}/share/applications/zenmap.desktop"
} }