Dear Sage developers,
I recently noticed some preliminary work in src/setup.py toward
compiling the Sage library in place, instead of putting the produced
.so and copies of the .py files in src/build.
Compiling in place means saving 15s of `sage -b` each time I just
modify Python code, and I do that all the time; so we are speaking of
dozen of minutes per day. So I have been dreaming of it for
years. Besides, it would also remove one of the regular source of
confusions for our new contributors.
So I explored this further, and with very minimal further changes
(diff attached; I'll push a branch to trac once I have a good enough
internet connection), this apparently seems to work smoothly: I
haven't yet run all tests, but Sage starts, the documentation
compiles, etc.
I can't wait until I can use this for real Sage development. But for
this, I basically need to get this feature into Sage. It would be
adventurous to enable this feature by default for all users at this
point. On the other hand, we should allow the adventurous of us to use
this extensively to chase out the bugs.
What would be the right approach to make this feature configurable
when one compiles Sage for the first time? Using just an environment
variable set by the user is not good, since a given user might have
Sage installations configured differently. Some piece of information
must be stored somewhere at configuration time.
Btw: do we have an open ticket for this?
Thanks!
Cheers,
Nicolas
--
Nicolas M. ThiƩry "Isil" <[email protected]>
http://Nicolas.Thiery.name/
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.
diff --git a/.gitignore b/.gitignore
index a9b6be0..4dadda5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
*.pyc
+*.so
/.BUILDSTART
/dist
/local
diff --git a/src/bin/sage-env b/src/bin/sage-env
index 883be11..f5f41c8 100644
--- a/src/bin/sage-env
+++ b/src/bin/sage-env
@@ -368,6 +368,7 @@ if [ -d "$SAGE_ROOT/local/lib/python" ]; then
if [ -n "$SAGE_PATH" ]; then
PYTHONPATH="$SAGE_PATH:$PYTHONPATH"
fi
+ PYTHONPATH="$SAGE_ROOT/src/:$PYTHONPATH"
PYTHONHOME="$SAGE_ROOT/local"
export PYTHONPATH
export PYTHONHOME
diff --git a/src/setup.py b/src/setup.py
index e334ca8..963d2c1 100644
--- a/src/setup.py
+++ b/src/setup.py
@@ -379,10 +379,12 @@ class sage_build_ext(build_ext):
sources = list(sources)
fullname = self.get_ext_fullname(ext.name)
+ self.inplace = True
if self.inplace:
# ignore build-lib -- put the compiled extension into
# the source tree along with pure Python modules
+ import string
modpath = string.split(fullname, '.')
package = string.join(modpath[0:-1], '.')
base = modpath[-1]
@@ -409,6 +411,8 @@ class sage_build_ext(build_ext):
prefixes = ['', self.build_lib, self.build_temp]
for prefix in prefixes:
path = os.path.join(prefix, relative_ext_dir)
+ if not path:
+ continue
try:
os.makedirs(path)
except OSError as e: