1. ariovistus
  2. pyd

Commits

ariovistus  committed 239df79

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

  • Participants
  • Parent commits 145dc4f
  • Branches default

Comments (0)

Files changed (4)

File examples/deimos_unittests/link.d

View file
  • Ignore whitespace
 // 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);

File examples/pyd_unittests/make_object.d

View file
  • Ignore whitespace
     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]));
 
 }

File runtests.py

View file
  • Ignore whitespace
 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():

File support.py

View file
  • Ignore whitespace
         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: