Skip to content

build on py3 #64

Open
Open

Description

@nbecker

I just checked out fresh copy of master. I had to fix one config test 1st:

diff --git a/python.py b/python.py
index 21a918e..e99445e 100644
--- a/python.py
+++ b/python.py
@@ -97,8 +97,12 @@ def CheckNumPy(context):
 #undef _DEBUG
 #include "Python.h"
 #include "numpy/arrayobject.h"
+#if PY_MAJOR_VERSION == 2
 void doImport() {
-  import_array();
+#else
+void * doImport() {
+#endif
+    import_array();
 }
 int main()
 {

But now build stops, hard to track this down:

/usr/bin/python3 /home/nbecker/scons/bootstrap/src/script/scons.py --config=force --debug=stacktrace --with-boost-include=/home/nbecker/ndarray.new/../include --with-boost-lib=/home/nbecker/ndarray.new/../lib --with-eigen-include=/usr/include/eigen3 --prefix=/home/nbecker/ndarray.new/../.local install CCFLAGS=-g -O3 -march=native --boost-python-lib=boost_python3
scons: Reading SConscript files ...
Check building with Eigen... yes
Check building against fftw... yes

*** No errors detected
Check building against Boost.Test... yes
Check building against Python... yes
Check building against NumPy... yes
Checking for SWIG...no
Check building against Boost.Preprocessor... yes
Check building against Boost.Python... yes
  File "<string>", line 20

    bin = env.Program(target="%s.test" % source, source=source)

                                                              ^

TabError: inconsistent use of tabs and spaces in indentation

Activity

  1. nbecker commented on Jun 27, 2016

    @nbecker
    ContributorAuthor

    Found the problem:

    diff --git a/tests/SConscript b/tests/SConscript
    index 7955aa9..25a0645 100644
    --- a/tests/SConscript
    +++ b/tests/SConscript
    @@ -17,7 +17,7 @@ def RunBinaryUnitTest(target, source, env):
    
     def BinaryUnitTest(env, source, dependencies=None):
         if os.name != 'nt':
    -       bin = env.Program(target="%s.test" % source, source=source)
    +        bin = env.Program(target="%s.test" % source, source=source)
         else:
             bin = env.Program(source)
         run = env.Command(".%s.succeeded" % str(source), bin, RunBinaryUnitTest)
    
  2. TallJimbo commented on Jun 27, 2016

    @TallJimbo
    Member

    Thanks. Fix will be up shortly; I'm trying to reproduce this with the CI system I'm putting together right now, but if I can't get that working quickly I'll just apply your patch.

  3. TallJimbo commented on Jun 27, 2016

    @TallJimbo
    Member

    So, this wasn't as simple as I thought:

    • I don't understand how you're building on Python 3 at all using SCons; did you hack your SCons install? SCons itself claims not to support Python 3, and indeed the one I have does not work with the command you've shown above. I've pretty much switched to using CMake build myself, and that definitely works with Python 3. It looks like there are also other places where Python 2 is assumed in the SConsChecks submodule, which makes sense if it's assuming only Python 2 is possible via SCons.
    • I don't seen any indentation problems in tests/SConscript; are you sure that isn't something local?
  4. nbecker commented on Jun 27, 2016

    @nbecker
    ContributorAuthor

    Yes I hacked scons - although there should be a usable upstream version at
    this point

    I don't know how tests/SConscript got a problem since I am working from a
    clean pull and didn't touch it AFAIK, but anyway untabify fixed it for me.

    On Mon, Jun 27, 2016 at 10:12 AM, Jim Bosch notifications@github.com
    wrote:

    So, this wasn't as simple as I thought:

    • I don't understand how you're building on Python 3 at all using
      SCons; did you hack your SCons install? SCons itself claims not to support
      Python 3, and indeed the one I have does not work with the command you've
      shown above. I've pretty much switched to using CMake build myself, and
      that definitely works with Python 3. It looks like there are also other
      places where Python 2 is assumed in the SConsChecks submodule, which makes
      sense if it's assuming only Python 2 is possible via SCons.
    • I don't seen any indentation problems in tests/SConscript; are you
      sure that isn't something local?

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub
    #64 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe/AAHK0JLOgaFPl4SU7LwD-kJICMuDT5Keks5qP9owgaJpZM4I_FnX
    .

    Those who don't understand recursion are doomed to repeat it

  5. TallJimbo commented on Jun 27, 2016

    @TallJimbo
    Member

    I've submitted a PR for the first issue at classner/SConsChecks#1. I'll keep this open until that's done and the submodule is updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions