[sagemath] 01/01: Fix some more paths

Ximin Luo infinity0 at debian.org
Sat Oct 15 11:37:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository sagemath.

commit f6b27f2d4382868afefeccda82d839e9409b9ba3
Author: Ximin Luo <infinity0 at debian.org>
Date:   Sat Oct 15 13:35:22 2016 +0200

    Fix some more paths
---
 debian/patches/debian-install-paths.patch          | 42 +++++++++++++++++++++-
 .../fixsage-allow-override-sage-local.patch        | 29 +++++++++++++++
 2 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/debian/patches/debian-install-paths.patch b/debian/patches/debian-install-paths.patch
index 077cfeb..50862f5 100644
--- a/debian/patches/debian-install-paths.patch
+++ b/debian/patches/debian-install-paths.patch
@@ -59,7 +59,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 +_add_variable_or_fallback('SITE_PACKAGES',   [d for d in sitepackages_dirs if "local" not in d])
  
 -_add_variable_or_fallback('SAGE_LIB',        SITE_PACKAGES[0])
-+_add_variable_or_fallback('SAGE_LIB',        opj('$SAGE_LOCAL', SITE_PACKAGES[0]))
++_add_variable_or_fallback('SAGE_LIB',        opj('$SAGE_LOCAL', 'lib', 'python2.7', 'dist-packages'))
  
  _add_variable_or_fallback('SAGE_CYTHONIZED', opj('$SAGE_SRC', 'build', 'cythonized'))
  
@@ -122,3 +122,43 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
          echo >&2 '************************************************************************'
          echo >&2 'It seems that you are attempting to run Sage from an unpacked source'
          echo >&2 'tarball, but you have not compiled it yet (or maybe the build has not'
+--- a/sage/src/sage_setup/find.py
++++ b/sage/src/sage_setup/find.py
+@@ -150,19 +150,18 @@ def installed_files_by_module(site_packages, modules=('sage',)):
+ 
+     EXAMPLES::
+ 
+-        sage: from site import getsitepackages
+-        sage: site_packages = getsitepackages()[0]
+-        sage: files_by_module = installed_files_by_module(site_packages)
++        sage: from sage.env import SAGE_LIB
++        sage: files_by_module = installed_files_by_module(SAGE_LIB)
+         sage: from sage.misc.sageinspect import loadable_module_extension
+         sage: 'sage/structure/sage_object' + loadable_module_extension() in \
+         ....:     files_by_module['sage.structure.sage_object']
+         True
+         sage: sorted(files_by_module['sage.structure'])
+-        ['sage/structure/__init__.py', 'sage/structure/__init__.pyc']
++        ['sage/structure/__init__.py', 'sage/structure/__init__.pyc'...]
+ 
+     This takes about 30ms with warm cache:
+ 
+-        sage: timeit('installed_files_by_module(site_packages)',       # random output
++        sage: timeit('installed_files_by_module(SAGE_LIB)',       # random output
+         ....:        number=1, repeat=1)
+         1 loops, best of 1: 29.6 ms per loop
+     """
+--- a/sage/src/sage/interacts/debugger.py
++++ b/sage/src/sage/interacts/debugger.py
+@@ -194,9 +194,9 @@
+         code = code.replace(TRACEBACK, TRACEBACK[:-1])
+ 
+         # Create a hyperlink to the file, if possible.
+-        i = filename.rfind('site-packages/sage')
++        i = filename.rfind('dist-packages/sage')
+         if i != -1:
+-            fname = filename[i+len('site-packages/sage')+1:].rstrip('/')
++            fname = filename[i+len('dist-packages/sage')+1:].rstrip('/')
+             file = '<a href="/src/%s" target="_new">src/sage/%s</a>'%(fname,fname)
+         else:
+             file = filename
diff --git a/debian/patches/fixsage-allow-override-sage-local.patch b/debian/patches/fixsage-allow-override-sage-local.patch
index dc22f24..889c402 100644
--- a/debian/patches/fixsage-allow-override-sage-local.patch
+++ b/debian/patches/fixsage-allow-override-sage-local.patch
@@ -24,6 +24,15 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  export SAGE_DOC_SRC="$SAGE_SRC/doc"
 --- a/sage/src/sage/env.py
 +++ b/sage/src/sage/env.py
+@@ -77,7 +77,7 @@ def _add_variable_or_fallback(key, fallback, force=False):
+     if force:
+         value = fallback
+     if isinstance(value, six.string_types):
+-        for k,v in SAGE_ENV.items():
++        for k,v in sorted(SAGE_ENV.items(), reverse=True):
+             if isinstance(v, six.string_types):
+                 value = value.replace('$'+k, v)
+     SAGE_ENV[key] = value
 @@ -110,7 +110,7 @@
  
  _add_variable_or_fallback('SAGE_EXTCODE',    opj('$SAGE_SHARE', 'sage', 'ext'))
@@ -84,3 +93,23 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
          SAGE_INST=${ac_abs_top_builddir}/local/var/lib/sage/installed
          for d in "$SAGE_LOGS" "$SAGE_LOCAL" \
              "$SAGE_LOCAL/bin" "$SAGE_LOCAL/etc" \
+--- a/sage/src/sage/doctest/sources.py
++++ b/sage/src/sage/doctest/sources.py
+@@ -32,7 +32,7 @@
+ from .parsing import SageDocTestParser
+ from .util import NestedName
+ from sage.structure.dynamic_class import dynamic_class
+-from sage.env import SAGE_SRC, SAGE_LOCAL
++from sage.env import SAGE_SRC, SAGE_LOCAL, SAGE_LIB
+ 
+ # Python file parsing
+ triple_quotes = re.compile("\s*[rRuU]*((''')|(\"\"\"))")
+@@ -85,7 +85,7 @@
+     # If the file is in the sage library, we can use our knowledge of
+     # the directory structure
+     dev = SAGE_SRC
+-    sp = os.path.join(SAGE_LOCAL, 'lib', 'python', 'site-packages')
++    sp = SAGE_LIB
+     if path.startswith(dev):
+         # there will be a branch name
+         i = path.find(os.path.sep, len(dev))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagemath.git



More information about the debian-science-commits mailing list