Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Ticket #17682: add generic extension in cython caching
Browse files Browse the repository at this point in the history
  • Loading branch information
sgouezel committed Apr 22, 2015
1 parent e27535b commit 4286d97
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/sage/misc/cython.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,13 @@ def cython(filename, verbose=False, compile_message=False,
# There is already a module here. Maybe we do not have to rebuild?
# Find the name.
if use_cache:
prev_so = [F for F in os.listdir(build_dir) if F[-3:] == '.so']
from sage.misc.sageinspect import generic_so_extension
prev_so = [F for F in os.listdir(build_dir) if F[-len(generic_so_extension):] == generic_so_extension]
if len(prev_so) > 0:
prev_so = prev_so[0] # should have length 1 because of deletes below
if os.path.getmtime(filename) <= os.path.getmtime('%s/%s'%(build_dir, prev_so)):
# We do not have to rebuild.
return prev_so[:-3], build_dir
return prev_so[:-len(generic_so_extension)], build_dir
else:
os.makedirs(build_dir)
for F in os.listdir(build_dir):
Expand Down

0 comments on commit 4286d97

Please sign in to comment.