Skip to content

Commit

Permalink
Trac #33070: Package upgrades for Python 3.10 support
Browse files Browse the repository at this point in the history
We add an option `--commit` to `sage --package update` and `sage
--package update-latest` and use it to make the following updates:

- `prometheus-client` -
https://github.com/prometheus/client_python/releases/tag/v0.12.0
- `gmpy2` 2.1.1 - https://github.com/aleaxit/gmpy/commits/master
- `distlib`
 0.3.4 - https://distlib.readthedocs.io/en/stable/overview.html#id1
- `debugpy` 1.5.1 - https://github.com/microsoft/debugpy/releases
- `defusedxml` -
https://github.com/tiran/defusedxml/blob/main/CHANGES.txt
- `decorator` 5.0.9 (not 5.1.0) - https://github.com/micheles/decorator/
blob/master/CHANGES.md#509-2021-05-16
- `jsonschema` 4.3.2 -
https://github.com/Julian/jsonschema/blob/main/CHANGELOG.rst
- `nest_asyncio` 1.5.4 -
https://github.com/erdewit/nest_asyncio/commits/master
- `packaging` 21.3 - https://github.com/pypa/packaging/releases
- `pycparser` 2.21 -
https://github.com/eliben/pycparser/blob/master/CHANGES

Separate tickets:
- #32930 ipython/jupyter
- #32510 igraph

URL: https://trac.sagemath.org/33070
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): Michael Orlitzky, Dima Pasechnik
  • Loading branch information
Release Manager committed Feb 12, 2022
2 parents e4f3f1d + 670634e commit 733ed25
Show file tree
Hide file tree
Showing 25 changed files with 69 additions and 51 deletions.
6 changes: 3 additions & 3 deletions build/pkgs/debugpy/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tarball=debugpy-VERSION.zip
sha1=c0162bd8d68a43702eea2591c67624fd5b4aa87b
md5=0c1103c7234b1f547eb705aff150ab31
cksum=676752698
sha1=169efd648ce0903c30cd300f8040136ec0ee16cc
md5=7c8ef4f136c9bcf501e80a12b8e21ac1
cksum=422456395
upstream_url=https://pypi.io/packages/source/d/debugpy/debugpy-VERSION.zip
2 changes: 1 addition & 1 deletion build/pkgs/debugpy/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.1
1.5.1
7 changes: 4 additions & 3 deletions build/pkgs/decorator/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tarball=decorator-VERSION.tar.gz
sha1=24d4560ff3e89a6cec068d323383577343c086fb
md5=d83c624cce93e6bdfab144821b526e1d
cksum=1324765948
sha1=4035760ce781a93181eeb3f8a36435eb799ceb76
md5=a90526e45e7a30cf2710d6467f403e03
cksum=1796541525
upstream_url=https://pypi.io/packages/source/d/decorator/decorator-VERSION.tar.gz
1 change: 0 additions & 1 deletion build/pkgs/decorator/dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN)

----------
All lines of this file are ignored except the first.
It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile.
2 changes: 1 addition & 1 deletion build/pkgs/decorator/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.4.2
5.0.9
7 changes: 4 additions & 3 deletions build/pkgs/defusedxml/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tarball=defusedxml-VERSION.tar.gz
sha1=0bba33cc1e6d59f8fc71ceb8d12ad951072ad122
md5=a59741f675c4cba649de40a99f732897
cksum=2504737728
sha1=37667af1dc1357eb96b005c4f408ad5292d77b9f
md5=a50e7f21aa60a741efe6b1b658dfb3f8
cksum=3442371004
upstream_url=https://pypi.io/packages/source/d/defusedxml/defusedxml-VERSION.tar.gz
1 change: 0 additions & 1 deletion build/pkgs/defusedxml/dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ $(PYTHON) | $(PYTHON_TOOLCHAIN)

----------
All lines of this file are ignored except the first.
It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile.
2 changes: 1 addition & 1 deletion build/pkgs/defusedxml/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.0
0.7.1
6 changes: 3 additions & 3 deletions build/pkgs/distlib/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tarball=distlib-VERSION.zip
sha1=47db238631902dbd0fbf730ca303438eaecbb0c8
md5=442dc114d7e59deec1c727b8a27d7e7c
cksum=4135782264
sha1=e7927ebc964676c17d466ed6a345222c34167a85
md5=c886b7d99b4085c5d960e7435dcbd397
cksum=10374426
upstream_url=https://pypi.io/packages/source/d/distlib/distlib-VERSION.zip
2 changes: 1 addition & 1 deletion build/pkgs/distlib/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.3
0.3.4
6 changes: 3 additions & 3 deletions build/pkgs/gmpy2/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tarball=gmpy2-VERSION.tar.gz
sha1=6564cfd78f552a8db82136c10b19aa7465856865
md5=a1555e0d7ca28b3a49c9a81aa06e2bb6
cksum=2826987588
sha1=fcb929ab9a44d96bfb47b7ed411cc2f048b484b2
md5=877d324e676b162053772affda5c0de7
cksum=2408333571
upstream_url=https://pypi.io/packages/source/g/gmpy2/gmpy2-VERSION.tar.gz
4 changes: 1 addition & 3 deletions build/pkgs/gmpy2/install-requires.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# We would like to write gmpy2 >=2.1.0b5, but pipenv does not accept prereleases in version ranges
# https://github.com/pypa/pipenv/issues/1760
gmpy2 ==2.1.0rc1
gmpy2 >=2.1.0
2 changes: 1 addition & 1 deletion build/pkgs/gmpy2/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.0rc1
2.1.1
6 changes: 3 additions & 3 deletions build/pkgs/jsonschema/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tarball=jsonschema-VERSION.tar.gz
sha1=fbca135887b3c79e7f08fff6a34fef053746151b
md5=f1a0b5011f05a02a8dee1070cd10a26d
cksum=3852093817
sha1=f804244e37c3f8f1c587ed6aee8f1f6a851f90f5
md5=87cf45f980c9b48e040c0c5897e574c4
cksum=1105743845
upstream_url=https://pypi.io/packages/source/j/jsonschema/jsonschema-VERSION.tar.gz
2 changes: 1 addition & 1 deletion build/pkgs/jsonschema/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.0
4.3.2
6 changes: 3 additions & 3 deletions build/pkgs/nest_asyncio/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tarball=nest_asyncio-VERSION.tar.gz
sha1=7ef28133a6703242618104a92263a867957b98d8
md5=6271f5e4181736c2e711657ef1eae915
cksum=1746231914
sha1=a139466f747bcd3324b8e080e00fc443603e8fa6
md5=a97d6622335d35563baeabb87afb758f
cksum=2526839264
upstream_url=https://pypi.io/packages/source/n/nest_asyncio/nest_asyncio-VERSION.tar.gz
2 changes: 1 addition & 1 deletion build/pkgs/nest_asyncio/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.1
1.5.4
6 changes: 3 additions & 3 deletions build/pkgs/packaging/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tarball=packaging-VERSION.tar.gz
sha1=6ba3b8ff3ee43d1d4c0b658241f4fd6036ee7c78
md5=240ba5823ed31051a1254e74c9d18d55
cksum=3836397838
sha1=b8caff3bec760723db6af4092c68075e22bdb769
md5=e713c1939f294fd729af4a7be40dd141
cksum=2539089468
upstream_url=https://pypi.io/packages/source/p/packaging/packaging-VERSION.tar.gz
2 changes: 1 addition & 1 deletion build/pkgs/packaging/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21.0
21.3
6 changes: 3 additions & 3 deletions build/pkgs/prometheus_client/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tarball=prometheus_client-VERSION.tar.gz
sha1=3d8077107a06a2ec413c64afaf8ca9a7124b283e
md5=eeb8c4ebac21508e1bb420d6fd90fa95
cksum=144951026
sha1=78932e768ad69d5ffe1f12abb41c51554ef12eb8
md5=4439c954aa7bc68b15915c6360967851
cksum=4269644267
upstream_url=https://pypi.io/packages/source/p/prometheus-client/prometheus_client-VERSION.tar.gz
2 changes: 1 addition & 1 deletion build/pkgs/prometheus_client/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.0
0.12.0
6 changes: 3 additions & 3 deletions build/pkgs/pycparser/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tarball=pycparser-VERSION.tar.gz
sha1=0ae93d89b69fab48af3a407a2f8663bcea270c3d
md5=b8f88de737db8c346ee8d31c07c7a25a
cksum=3289554032
sha1=359c718c6ece361047f61846b9fa4ea0239576dc
md5=48f7d743bf018f7bb2ffc5fb976d1492
cksum=1065143416
upstream_url=https://pypi.io/packages/source/p/pycparser/pycparser-VERSION.tar.gz
2 changes: 1 addition & 1 deletion build/pkgs/pycparser/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.20
2.21
22 changes: 18 additions & 4 deletions build/sage_bootstrap/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,17 @@ def apropos(self, incorrect_name):
print('There is no package similar to {0}'.format(incorrect_name))
print('You can find further packages at http://files.sagemath.org/spkg/')

def update(self, package_name, new_version, url=None):
def commit(self, package_name, message=None):
"""
Commit the changes to the Sage source tree for the given package
"""
import os
package = Package(package_name)
if message is None:
message = 'build/pkgs/{0}: Update to {1}'.format(package_name, package.version)
os.system('git commit -m "{0}" {1}'.format(message, package.path))

def update(self, package_name, new_version, url=None, commit=False):
"""
Update a package. This modifies the Sage sources.
Expand All @@ -126,8 +136,10 @@ def update(self, package_name, new_version, url=None):
log.debug('Downloading %s', url)
update.download_upstream(url)
update.fix_checksum()
if commit:
self.commit(package_name)

def update_latest(self, package_name):
def update_latest(self, package_name, commit=False):
"""
Update a package to the latest version. This modifies the Sage sources.
"""
Expand All @@ -138,8 +150,10 @@ def update_latest(self, package_name):
return
else:
pypi.update(Package(package_name))
if commit:
self.commit(package_name)

def update_latest_cls(self, package_name_or_class):
def update_latest_cls(self, package_name_or_class, commit=False):
exclude = [
'cypari' # Name conflict
]
Expand All @@ -152,7 +166,7 @@ def update_latest_cls(self, package_name_or_class):
log.debug('skipping %s because of pypi name collision', package_name)
continue
try:
self.update_latest(package_name)
self.update_latest(package_name, commit=commit)
except PyPiError as e:
log.warn('updating %s failed: %s', package_name, e)

Expand Down
10 changes: 8 additions & 2 deletions build/sage_bootstrap/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,19 @@ def make_parser():
'new_version', type=str, help='New version')
parser_update.add_argument(
'--url', type=str, default=None, help='Download URL')
parser_update.add_argument(
'--commit', action="store_true",
help='Whether to run "git commit"')

parser_update_latest = subparsers.add_parser(
'update-latest', epilog=epilog_update_latest,
formatter_class=argparse.RawDescriptionHelpFormatter,
help='Update a package to the latest version. This modifies the Sage sources.')
parser_update_latest.add_argument(
'package_name', type=str, help='Package name (:all: for all packages)')
parser_update_latest.add_argument(
'--commit', action="store_true",
help='Whether to run "git commit"')

parser_download = subparsers.add_parser(
'download', epilog=epilog_download,
Expand Down Expand Up @@ -329,9 +335,9 @@ def run():
elif args.subcommand == 'apropos':
app.apropos(args.incorrect_name)
elif args.subcommand == 'update':
app.update(args.package_name, args.new_version, url=args.url)
app.update(args.package_name, args.new_version, url=args.url, commit=args.commit)
elif args.subcommand == 'update-latest':
app.update_latest_cls(args.package_name)
app.update_latest_cls(args.package_name, commit=args.commit)
elif args.subcommand == 'download':
app.download_cls(args.package_name,
allow_upstream=args.allow_upstream,
Expand Down

0 comments on commit 733ed25

Please sign in to comment.