-
Notifications
You must be signed in to change notification settings - Fork 34
setup.py -> pyproject.toml #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
11a8c2b
fcbc412
b7b8165
8bc4ee8
46056b1
9389487
3b3b1ea
b2b6e87
deef084
9fee73c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| prune debian | ||
| prune .github | ||
| prune docs | ||
| global-exclude *.py[cod] __pycache__ *.so *.spec *.txt .gitignore |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,100 +1,95 @@ | ||
| PYTHON=$(shell which python 2>/dev/null || which python3 2>/dev/null) | ||
| DESTDIR=/ | ||
| BUILDIR=$(CURDIR)/debian/aexpect | ||
| PROJECT=aexpect | ||
| VERSION="1.8.0" | ||
| VERSION=$(shell $(PYTHON) -m setuptools_scm) | ||
| COMMIT=$(shell git log --pretty=format:'%H' -n 1) | ||
| SHORT_COMMIT=$(shell git log --pretty=format:'%h' -n 1) | ||
| COMMIT_DATE=$(shell git log --pretty='format:%cd' --date='format:%Y%m%d' -n 1) | ||
| MOCK_CONFIG=default | ||
|
|
||
| all: | ||
| @echo "make check - Runs tree static check, unittests and functional tests. Some tests are only executed when AEXPECT_TIME_SENSITIVE=yes is set." | ||
| @echo "make clean - Get rid of scratch and byte files" | ||
| @echo "make source - Create source package" | ||
| @echo "make install - Install on local system" | ||
| @echo "make build-deb-src - Generate a source debian package" | ||
| @echo "make build-deb-bin - Generate a binary debian package" | ||
| @echo "make build-deb-all - Generate both source and binary debian packages" | ||
| @echo "RPM related targets:" | ||
| @echo "make srpm: Generate a source RPM package (.srpm)" | ||
| @echo "make rpm: Generate binary RPMs" | ||
| @echo "make check - Run lint and tests" | ||
| @echo "make clean - Remove build artifacts" | ||
| @echo "make source - Create source package (commit snapshot)" | ||
| @echo "make source-release - Create source package (versioned tag)" | ||
| @echo "make install - Install from built wheel" | ||
| @echo "make develop - Editable install" | ||
| @echo "make pypi - Build wheel+sdist (ready for upload)" | ||
| @echo | ||
| @echo "Release related targets:" | ||
| @echo "source-release: Create source package for the latest tagged release" | ||
| @echo "srpm-release: Generate a source RPM package (.srpm) for the latest tagged release" | ||
| @echo "rpm-release: Generate binary RPMs for the latest tagged release" | ||
| @echo "Debian targets: build-deb-src, build-deb-bin, build-deb-all" | ||
| @echo "RPM targets: srpm, rpm, srpm-release, rpm-release" | ||
|
|
||
| # --- Packaging --- | ||
| source: clean | ||
| if test ! -d SOURCES; then mkdir SOURCES; fi | ||
| git archive --prefix="aexpect-$(COMMIT)/" -o "SOURCES/aexpect-$(SHORT_COMMIT).tar.gz" HEAD | ||
| mkdir -p SOURCES | ||
| git archive --prefix="$(PROJECT)-$(COMMIT)/" -o "SOURCES/$(PROJECT)-$(SHORT_COMMIT).tar.gz" HEAD | ||
|
|
||
| source-release: clean | ||
| if test ! -d SOURCES; then mkdir SOURCES; fi | ||
| git archive --prefix="aexpect-$(VERSION)/" -o "SOURCES/aexpect-$(VERSION).tar.gz" $(VERSION) | ||
| mkdir -p SOURCES | ||
| git archive --prefix="$(PROJECT)-$(VERSION)/" -o "SOURCES/$(PROJECT)-$(VERSION).tar.gz" $(VERSION) | ||
|
|
||
| install: | ||
| $(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE) | ||
| rm -r dist 2>/dev/null || true | ||
| $(PYTHON) -m pip install --upgrade pip build wheel | ||
| $(PYTHON) -m build | ||
| $(PYTHON) -m pip install --no-deps --force-reinstall dist/*.whl | ||
|
|
||
| develop: | ||
| $(PYTHON) -m pip install --editable .[dev] | ||
|
|
||
| pypi: clean | ||
| $(PYTHON) -m build | ||
| $(PYTHON) -m twine check dist/* | ||
| @echo | ||
| @echo | ||
| @echo "Use 'python3 -m twine upload dist/*'" | ||
| @echo "to upload this release" | ||
|
|
||
| # --- Checks --- | ||
| check: clean | ||
| inspekt checkall --disable-lint R0917,R0205,R0801,W4901,W0703,W0511 --disable-style E203,E501,E265,W601,E402 --exclude .venv* | ||
| $(PYTHON) -m black --check -- $(shell git ls-files -- "*.py") | ||
| $(PYTHON) -m isort --check-only -- $(shell git ls-files -- "*.py") | ||
| $(PYTHON) -m pytest | ||
|
|
||
| test: check | ||
|
|
||
| # --- Distro packaging (unchanged except cosmetic) --- | ||
| prepare-source: | ||
| # build the source package in the parent directory | ||
| # then rename it to project_version.orig.tar.gz | ||
| dch -D "utopic" -M -v "$(VERSION)" "Automated (make builddeb) build." | ||
| $(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../ | ||
| $(PYTHON) -m build --sdist --outdir ../ | ||
| rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../* | ||
|
|
||
| build-deb-src: prepare-source | ||
| # build the source package | ||
| dpkg-buildpackage -S [email protected] -rfakeroot | ||
|
|
||
| build-deb-bin: prepare-source | ||
| # build binary package | ||
| dpkg-buildpackage -b -rfakeroot | ||
|
|
||
| build-deb-all: prepare-source | ||
| # build both source and binary packages | ||
| dpkg-buildpackage -i -I -rfakeroot | ||
|
|
||
| srpm: source | ||
| if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi | ||
| mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --buildsrpm --spec python-aexpect.spec --sources SOURCES | ||
| mkdir -p BUILD/SRPM | ||
| mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --buildsrpm --spec python-$(PROJECT).spec --sources SOURCES | ||
|
|
||
| rpm: srpm | ||
| if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi | ||
| mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --rebuild BUILD/SRPM/python-aexpect-$(VERSION)-*.src.rpm | ||
| mkdir -p BUILD/RPM | ||
| mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 0" -D "commit $(COMMIT)" -D "commit_date $(COMMIT_DATE)" --rebuild BUILD/SRPM/python-$(PROJECT)-$(VERSION)-*.src.rpm | ||
|
|
||
| srpm-release: source-release | ||
| if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi | ||
| mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "rel_build 1" --buildsrpm --spec python-aexpect.spec --sources SOURCES | ||
| mkdir -p BUILD/SRPM | ||
| mock -r $(MOCK_CONFIG) --resultdir BUILD/SRPM -D "rel_build 1" --buildsrpm --spec python-$(PROJECT).spec --sources SOURCES | ||
|
|
||
| rpm-release: srpm-release | ||
| if test ! -d BUILD/RPM; then mkdir -p BUILD/RPM; fi | ||
| mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 1" --rebuild BUILD/SRPM/python-aexpect-$(VERSION)-*.src.rpm | ||
|
|
||
| check: clean | ||
| inspekt checkall --disable-lint R0917,R0205,R0801,W4901,W0703,W0511 --disable-style E203,E501,E265,W601,E402 --exclude .venv* | ||
| $(PYTHON) -m black --line-length 79 --check -- $(shell git ls-files -- "*.py") | ||
| $(PYTHON) -m pip install -e . | ||
| $(PYTHON) -m pytest tests | ||
| mkdir -p BUILD/RPM | ||
| mock -r $(MOCK_CONFIG) --resultdir BUILD/RPM -D "rel_build 1" --rebuild BUILD/SRPM/python-$(PROJECT)-$(VERSION)-*.src.rpm | ||
|
|
||
| clean: | ||
| $(PYTHON) setup.py clean | ||
| $(MAKE) -f $(CURDIR)/debian/rules clean || true | ||
| rm -rf build/ MANIFEST BUILD BUILDROOT SPECS RPMS SRPMS SOURCES | ||
| rm -rf .mypy_cache *.egg-info MANIFEST BUILD BUILDROOT SPECS RPMS SRPMS SOURCES dist | ||
| find . -name '*.pyc' -delete | ||
| find . -name '__pycache__' -delete | ||
|
|
||
| pypi: clean | ||
| if test ! -d PYPI_UPLOAD; then mkdir PYPI_UPLOAD; fi | ||
| $(PYTHON) setup.py bdist_wheel -d PYPI_UPLOAD | ||
| $(PYTHON) setup.py sdist -d PYPI_UPLOAD | ||
| @echo | ||
| @echo "Please use the files on PYPI_UPLOAD dir to upload a new version to PyPI" | ||
| @echo "The URL to do that may be a bit tricky to find, so here it is:" | ||
| @echo " https://pypi.python.org/pypi?%3Aaction=submit_form" | ||
| @echo | ||
| @echo "Alternatively, you can also run a command like: " | ||
| @echo " twine upload -u <PYPI_USERNAME> PYPI_UPLOAD/*.{tar.gz,whl}" | ||
| @echo | ||
|
|
||
| .PHONY: source install clean | ||
| .PHONY: all source source-release install develop pypi check test clean \ | ||
| build-deb-src build-deb-bin build-deb-all srpm rpm srpm-release rpm-release prepare-source | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -57,13 +57,13 @@ | |||||||||||||||||||||||||||
| # disable too-many/few-* as we need them pylint: disable=R0903,R0912,R0913,R0914,R0915,R0917,C0302 | ||||||||||||||||||||||||||||
| # ..todo:: we could reduce the disabled issues after more significant refactoring | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| import importlib | ||||||||||||||||||||||||||||
| import inspect | ||||||||||||||||||||||||||||
| import logging | ||||||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||||||
| import re | ||||||||||||||||||||||||||||
| import logging | ||||||||||||||||||||||||||||
| import inspect | ||||||||||||||||||||||||||||
| import importlib | ||||||||||||||||||||||||||||
| import threading | ||||||||||||||||||||||||||||
| import tempfile | ||||||||||||||||||||||||||||
| import threading | ||||||||||||||||||||||||||||
| import time | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # NOTE: enable this before importing the Pyro backend in order to debug issues | ||||||||||||||||||||||||||||
|
|
@@ -72,13 +72,10 @@ | |||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||
| # noinspection PyPackageRequirements,PyUnresolvedReferences | ||||||||||||||||||||||||||||
| from Pyro5.compatibility import Pyro4 | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # noinspection PyPackageRequirements | ||||||||||||||||||||||||||||
| from Pyro5 import server | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # noinspection PyPackageRequirements | ||||||||||||||||||||||||||||
| from Pyro5 import nameserver | ||||||||||||||||||||||||||||
| from Pyro5 import nameserver, server | ||||||||||||||||||||||||||||
| from Pyro5.compatibility import Pyro4 | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| NS_MODULE = "Pyro5.nameserver" | ||||||||||||||||||||||||||||
| except ImportError: | ||||||||||||||||||||||||||||
|
Comment on lines
+77
to
81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix: Pyro5 path may raise AttributeError due to missing server.is_private_attribute In the Pyro5 branch, server.is_private_attribute may not exist, but it’s used later (e.g., in share_local_object). This will raise AttributeError at runtime when Pyro5 is available. Define a compatible predicate in the Pyro5 path. Apply this diff after the Pyro5 imports: from Pyro5 import nameserver, server
from Pyro5.compatibility import Pyro4
NS_MODULE = "Pyro5.nameserver"
+ # Ensure attribute-filter API used below exists under Pyro5 as well
+ if not hasattr(server, "is_private_attribute"):
+ server.is_private_attribute = lambda name: name.startswith("_")📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source-release may fail if setuptools_scm strips a 'v' tag prefix
If your git tag is v1.8.0, setuptools_scm yields 1.8.0, and git archive $(VERSION) will fail. Resolve by mapping version to the tag commit.
Apply this diff to resolve within the current line:
Run a quick check:
🤖 Prompt for AI Agents