Opened 9 months ago
Last modified 2 months ago
#31314 new defect
Failing sage_setup doctests when PYTHONPYCACHEPREFIX is set
Reported by:  mkoeppe  Owned by:  

Priority:  critical  Milestone:  sage9.5 
Component:  build  Keywords:  
Cc:  jhpalmieri, ghtobiasdiez  Merged in:  
Authors:  Reviewers:  
Report Upstream:  N/A  Work issues:  
Branch:  u/mkoeppe/failing_sage_setup_doctests_when_pythonpycacheprefix_is_set (Commits, GitHub, GitLab)  Commit:  ee1be0aa085a2b775e21689b75a3719a433673d4 
Dependencies:  Stopgaps: 
Description (last modified by )
(from #31227)
https://docs.python.org/3/using/cmdline.html#envvarPYTHONPYCACHEPREFIX
also, python3.8 from xcode 12 is preconfigured with a nonNone
sys.pycache_prefix
Change History (14)
comment:1 Changed 9 months ago by
comment:2 Changed 9 months ago by
 Description modified (diff)
comment:3 Changed 9 months ago by
I think this is basically just the sorting order that's changed
comment:4 Changed 9 months ago by
 Branch set to u/mkoeppe/failing_sage_setup_doctests_when_pythonpycacheprefix_is_set
comment:5 Changed 9 months ago by
 Commit set to ee1be0aa085a2b775e21689b75a3719a433673d4
What about the stale files?
New commits:
ee1be0a  src/sage_setup/find.py: Fix doctest for nonNone sys.pycache_prefix

comment:6 Changed 9 months ago by
(untested)
comment:7 Changed 9 months ago by
sage_setup.clean._find_stale_files
will need a closer look. Related: #28925
comment:8 Changed 9 months ago by
In my situation, the basenames are '__init__.cpython38.pyc'
and '__init__.py'
. Will the first of these sometimes instead be '__init__.pyc'
? This is ugly but I think it works:

src/sage_setup/find.py
diff git a/src/sage_setup/find.py b/src/sage_setup/find.py index 413f062e07..4a87f142c3 100644
a b def installed_files_by_module(site_packages, modules=('sage',)): 274 274 sage: from sage.misc.sageinspect import loadable_module_extension 275 275 sage: (f,) = files_by_module['sage.structure.sage_object']; f 276 276 'sage/structure/sage_object...' 277 sage: f rom os.path import basename278 sage: (f1, f2) = sorted(files_by_module['sage.structure'], key=basename)277 sage: f1 = [f for f in files_by_module['sage.structure'] if f.endswith('.py')][0] 278 sage: f2 = [f for f in files_by_module['sage.structure'] if f.endswith('.pyc')][0] 279 279 sage: f1 280 280 'sage/structure/__init__.py' 281 281 sage: f2
comment:9 Changed 9 months ago by
Maybe it always includes cpython
, so keep the sorting but interchange f1
and f2
.
comment:10 Changed 9 months ago by
 Priority changed from minor to major
comment:11 Changed 9 months ago by
 Priority changed from major to critical
comment:12 Changed 9 months ago by
 Cc ghtobiasdiez added
comment:13 Changed 7 months ago by
 Milestone changed from sage9.3 to sage9.4
Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review of ticket status, priority, and last modification date.
comment:14 Changed 2 months ago by
 Milestone changed from sage9.4 to sage9.5
See also https://docs.python.org/3/library/sys.html#sys.pycache_prefix:
sys.pycache_prefix
seems to be set for/usr/bin/python3
on OS X.