Skip to content

Commit 81a374d

Browse files
author
Release Manager
committed
gh-37290: sagemath-standard: don't require Cython to create sdist
The implementation of sage.misc.package_dir.read_distributions uses the function `Cython.Utils.open_source_file()` to open a file instead of `io.open()`. This function was introduced in #29701 (b582789). The only difference between `open_source_file()` and `io.open()` is that the former will open the file as binary to check the encoding. But all our files should be utf-8 so we don't need this trick. In case I’m mistaken and there is a reason this trick is really necessary (@mkoeppe?) it seems better to include a version of open_source_file(), for two main reasons: (a) we don’t pull the whole of Cython just for a trivial function; (b) changes in Cython don’t affect sagemath (this is not a documented function of Cython, afaict) ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. URL: #37290 Reported by: Gonzalo Tornaría Reviewer(s): Gonzalo Tornaría, Matthias Köppe
2 parents f71381c + 487a02f commit 81a374d

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

build/pkgs/configure/checksums.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=84c8bfc8a84399d50eac5f0e75672da0e36216ae
3-
md5=1171b0a7cd69002c426fb7b48e9026e4
4-
cksum=2998629640
2+
sha1=6517328415e972b571db0ef97c780ae45bb90745
3+
md5=671ce9d8afcf9ad5faa6a918d7ab2829
4+
cksum=2336342933
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
128d437fcc7f3917b314662fdee34aeaab968b67
1+
8dd853eddb146b36c5ce10362ac9b4ca5faf622b

src/sage/misc/package_dir.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ def read_distribution(src_file):
118118
sage: read_distribution(os.path.join(SAGE_SRC, 'sage', 'graphs', 'graph_decompositions', 'modular_decomposition.py'))
119119
''
120120
"""
121-
from Cython.Utils import open_source_file
122-
with open_source_file(src_file, error_handling='ignore') as fh:
121+
with open(src_file, encoding='utf-8', errors='ignore') as fh:
123122
for line in fh:
124123
# Adapted from Cython's Build/Dependencies.py
125124
line = line.lstrip()

0 commit comments

Comments
 (0)