ariovistus avatar ariovistus committed 239df79

fix pydexe link for python3
runtests.py works for python3 now!
fix link unittest for python3

Comments (0)

Files changed (4)

examples/deimos_unittests/link.d

 // So test that the dratted thing is working!
 
 unittest {
-    PyObject* p = cast(PyObject*) &PyString_Type;
+    PyObject* p = cast(PyObject*) &PyType_Type;
     assert(p !is null);
     assert(p.ob_type !is null);
     assert(p.ob_type.tp_name !is null);

examples/pyd_unittests/make_object.d

     auto t = Foo1(z);
     auto ix = t[0];
     z = t[1];
-    assert(ix == [0, 1]);
+    import std.conv;
+    assert(ix == [0, 1], to!string(ix));
     assert(equal(z, [2,3,4,5,6,7,8,9]));
 
 }
 exe_ext = get_config_var("EXE")
 verz_maj = platform.python_version_tuple()[0]
 print ("%r" % (verz_maj,), verz_maj == 2)
-if verz_maj == "3":
-    pass
-elif verz_maj == "2":
+if verz_maj == "3" or verz_maj == "2":
     import optparse
     oparser = optparse.OptionParser()
     oparser.add_option("-b", action="store_true", dest="use_build")
     if os.path.exists(cmd + exe_ext):
         os.remove(cmd+exe_ext)
 def pydexe():
-    cmds = [sys.executable, "setup.py", "pydexe"]
-    if opts.compiler:
-        cmds.append("--compiler="+opts.compiler)
-    subprocess.check_call(cmds)
+    try:
+        cmds = [sys.executable, "setup.py", "pydexe"]
+        if opts.compiler:
+            cmds.append("--compiler="+opts.compiler)
+        subprocess.check_call(cmds)
+    except:
+        import os
+        print (os.getcwd())
+        raise
 def check_py(scrpt):
     subprocess.check_call([sys.executable, scrpt])
 def pybuild():
         else:
             from distutils import sysconfig
             if sysconfig.get_config_var('Py_ENABLE_SHARED'):
-                template = "python%d.%d"
-                pythonlib = (template %
-                             (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
-                if sys.pydebug:
+                pythonlib = "python{}.{}{}".format(
+                        sys.hexversion >> 24, 
+                        (sys.hexversion >> 16) & 0xff,
+                        '' if not hasattr(sys, 'abiflags') else sys.abiflags)
+                if hasattr(sys,'pydebug') and sys.pydebug:
                     pythonlib += '_d'
                 return ext.libraries + [pythonlib]
             else:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.