From d25284eb2f0554021ddbb7ef61e74bb69ee1492a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 30 Nov 2023 22:31:34 -0800 Subject: [PATCH 1/4] sage -package create --pypi: If --source is not given, use --source=wheel if possible --- build/sage_bootstrap/app.py | 13 ++++++++++++- build/sage_bootstrap/cmdline.py | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/build/sage_bootstrap/app.py b/build/sage_bootstrap/app.py index 8c17541a9b7..d61b3ce3241 100644 --- a/build/sage_bootstrap/app.py +++ b/build/sage_bootstrap/app.py @@ -273,7 +273,7 @@ def fix_checksum(self, package_name): update.fix_checksum() def create(self, package_name, version=None, tarball=None, pkg_type=None, upstream_url=None, - description=None, license=None, upstream_contact=None, pypi=False, source='normal'): + description=None, license=None, upstream_contact=None, pypi=False, source=None): """ Create a package @@ -288,6 +288,13 @@ def create(self, package_name, version=None, tarball=None, pkg_type=None, upstre if '-' in package_name: raise ValueError('package names must not contain dashes, use underscore instead') if pypi: + if source is None: + try: + source = 'wheel' + if not PyPiVersion(package_name, source='wheel').tarball.endswith('-none-any.whl'): + source = 'normal' + except PyPiError: + source = 'normal' pypi_version = PyPiVersion(package_name, source=source) if source == 'normal': if not tarball: @@ -312,6 +319,10 @@ def create(self, package_name, version=None, tarball=None, pkg_type=None, upstre license = pypi_version.license if not upstream_contact: upstream_contact = pypi_version.package_url + if upstream_url and not tarball: + tarball = upstream_url.rpartition('/')[2] + if tarball and source is None: + source = 'normal' if tarball and not pkg_type: # If we set a tarball, also make sure to create a "type" file, # so that subsequent operations (downloading of tarballs) work. diff --git a/build/sage_bootstrap/cmdline.py b/build/sage_bootstrap/cmdline.py index 3ea6b9b7cb8..cb125161560 100644 --- a/build/sage_bootstrap/cmdline.py +++ b/build/sage_bootstrap/cmdline.py @@ -319,7 +319,7 @@ def make_parser(): 'package_name', default=None, type=str, help='Package name.') parser_create.add_argument( - '--source', type=str, default='normal', help='Package source (one of normal, wheel, script, pip)') + '--source', type=str, default=None, help='Package source (one of normal, wheel, script, pip; default depends on provided arguments)') parser_create.add_argument( '--version', type=str, default=None, help='Package version') parser_create.add_argument( From af414b66285f3284125c8b07f77bdce927b3bb2d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 30 Nov 2023 23:13:51 -0800 Subject: [PATCH 2/4] build/pkgs/six: Change to a wheel package --- build/pkgs/six/checksums.ini | 10 +++++----- build/pkgs/six/dependencies | 2 +- build/pkgs/six/spkg-install.in | 3 --- 3 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 build/pkgs/six/spkg-install.in diff --git a/build/pkgs/six/checksums.ini b/build/pkgs/six/checksums.ini index b7226d114b5..a0614f6049b 100644 --- a/build/pkgs/six/checksums.ini +++ b/build/pkgs/six/checksums.ini @@ -1,5 +1,5 @@ -tarball=six-VERSION.tar.gz -sha1=06fa0bb50f2a4e2917fd14c21e9d2d5508ce0163 -md5=a7c927740e4964dd29b72cebfc1429bb -cksum=1693137720 -upstream_url=https://pypi.io/packages/source/s/six/six-VERSION.tar.gz +tarball=six-VERSION-py2.py3-none-any.whl +sha1=79e6f2e4f9e24898f1896df379871b9c9922f147 +md5=529d7fd7e14612ccde86417b4402d6f3 +cksum=2975792266 +upstream_url=https://pypi.io/packages/py2.py3/s/six/six-VERSION-py2.py3-none-any.whl diff --git a/build/pkgs/six/dependencies b/build/pkgs/six/dependencies index 47296a7bace..644ad35f773 100644 --- a/build/pkgs/six/dependencies +++ b/build/pkgs/six/dependencies @@ -1,4 +1,4 @@ - | $(PYTHON_TOOLCHAIN) $(PYTHON) + | pip $(PYTHON) ---------- All lines of this file are ignored except the first. diff --git a/build/pkgs/six/spkg-install.in b/build/pkgs/six/spkg-install.in deleted file mode 100644 index 058b1344dc2..00000000000 --- a/build/pkgs/six/spkg-install.in +++ /dev/null @@ -1,3 +0,0 @@ -cd src - -sdh_pip_install . From ec28623443d413d49b4bf59d5b916b184f61682e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 5 Dec 2023 18:05:17 -0800 Subject: [PATCH 3/4] build/make/Makefile.in: Update documentation of PYTHON_TOOLCHAIN --- build/make/Makefile.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 6031ae7fa2a..ebf5117ee11 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -322,9 +322,8 @@ toolchain-deps: all-toolchain: base-toolchain +$(MAKE_REC) toolchain-deps -# All packages needed as a prerequisite to install other Python packages with -# pip or which are otherwise used by the Python build tools; these should be -# given as a prerequisite to any pip-installed packages +# Shorthand for a list of packages sufficient for building and installing +# typical Python packages from source. Wheel packages only need pip. PYTHON_TOOLCHAIN = setuptools pip setuptools_scm wheel setuptools_wheel # Trac #32056: Avoid installed setuptools leaking into the build of python3 by uninstalling it. From 818468af83560668beb2d2c7b5b57b7e5ec749c2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 5 Dec 2023 18:08:08 -0800 Subject: [PATCH 4/4] build/sage_bootstrap/{app,cmdline}.py: Suggested edits --- build/sage_bootstrap/app.py | 5 +++-- build/sage_bootstrap/cmdline.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build/sage_bootstrap/app.py b/build/sage_bootstrap/app.py index d61b3ce3241..11600bf1b53 100644 --- a/build/sage_bootstrap/app.py +++ b/build/sage_bootstrap/app.py @@ -290,8 +290,9 @@ def create(self, package_name, version=None, tarball=None, pkg_type=None, upstre if pypi: if source is None: try: - source = 'wheel' - if not PyPiVersion(package_name, source='wheel').tarball.endswith('-none-any.whl'): + if PyPiVersion(package_name, source='wheel').tarball.endswith('-none-any.whl'): + source = 'wheel' + else: source = 'normal' except PyPiError: source = 'normal' diff --git a/build/sage_bootstrap/cmdline.py b/build/sage_bootstrap/cmdline.py index cb125161560..1b84cbf6461 100644 --- a/build/sage_bootstrap/cmdline.py +++ b/build/sage_bootstrap/cmdline.py @@ -319,7 +319,7 @@ def make_parser(): 'package_name', default=None, type=str, help='Package name.') parser_create.add_argument( - '--source', type=str, default=None, help='Package source (one of normal, wheel, script, pip; default depends on provided arguments)') + '--source', type=str, default=None, help='Package source (one of normal, wheel, script, pip); default depends on provided arguments') parser_create.add_argument( '--version', type=str, default=None, help='Package version') parser_create.add_argument(