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: sage-9.5
Component: build Keywords:
Cc: jhpalmieri, gh-tobiasdiez 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:

Status badges

Description (last modified by mkoeppe)

(from #31227)

https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPYCACHEPREFIX

also, python3.8 from xcode 12 is preconfigured with a non-None sys.pycache_prefix

Change History (14)

comment:1 Changed 9 months ago by jhpalmieri

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.

Last edited 9 months ago by jhpalmieri (previous) (diff)

comment:2 Changed 9 months ago by mkoeppe

  • Description modified (diff)

comment:3 Changed 9 months ago by mkoeppe

I think this is basically just the sorting order that's changed

comment:4 Changed 9 months ago by mkoeppe

  • Branch set to u/mkoeppe/failing_sage_setup_doctests_when_pythonpycacheprefix_is_set

comment:5 Changed 9 months ago by jhpalmieri

  • Commit set to ee1be0aa085a2b775e21689b75a3719a433673d4

What about the stale files?


New commits:

ee1be0asrc/sage_setup/find.py: Fix doctest for non-None sys.pycache_prefix

comment:6 Changed 9 months ago by mkoeppe

(untested)

comment:7 Changed 9 months ago by mkoeppe

sage_setup.clean._find_stale_files will need a closer look. Related: #28925

comment:8 Changed 9 months ago by jhpalmieri

In my situation, the basenames are '__init__.cpython-38.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',)): 
    274274        sage: from sage.misc.sageinspect import loadable_module_extension
    275275        sage: (f,) = files_by_module['sage.structure.sage_object']; f
    276276        'sage/structure/sage_object...'
    277         sage: from os.path import basename
    278         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]
    279279        sage: f1
    280280        'sage/structure/__init__.py'
    281281        sage: f2
Last edited 9 months ago by jhpalmieri (previous) (diff)

comment:9 Changed 9 months ago by jhpalmieri

Maybe it always includes cpython, so keep the sorting but interchange f1 and f2.

comment:10 Changed 9 months ago by mkoeppe

  • Priority changed from minor to major

comment:11 Changed 9 months ago by mkoeppe

  • Priority changed from major to critical

comment:12 Changed 9 months ago by mkoeppe

  • Cc gh-tobiasdiez added

comment:13 Changed 7 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.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 mkoeppe

  • Milestone changed from sage-9.4 to sage-9.5
Note: See TracTickets for help on using tickets.