On Thu, 30 Mar 2017, Petrus Hyvönen wrote:

Hi,

My current diff to the svn is below (as in the chain of mails). Now i get
it to wrap my library in both 2.7, 3.5 and 3.6.

I believe, I've now applied all these diffs (or equivalents).
Thank you Petrus for testing on Windows, I'm going to release rc2 artifacts and call for a new vote.

Andi..


/Regards


Index: jcc2/__init__.py
===================================================================
--- jcc2/__init__.py (revision 1789413)
+++ jcc2/__init__.py (working copy)
@@ -20,7 +20,7 @@
        from windows import add_jvm_dll_directory_to_path
        add_jvm_dll_directory_to_path()

-    from jcc2.config import SHARED
+    from jcc.config import SHARED
    if SHARED:
        path = os.environ['Path'].split(os.pathsep)
        eggpath =
os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
Index: jcc3/sources/functions.cpp
===================================================================
--- jcc3/sources/functions.cpp (revision 1789413)
+++ jcc3/sources/functions.cpp (working copy)
@@ -300,7 +300,7 @@
#if defined(_MSC_VER) || defined(__SUNPRO_CC)
int __parseArgs(PyObject *args, char *types, ...)
{
-    int count = PY_SIZE((PyTupleObject *) args);
+    int count = Py_SIZE((PyTupleObject *) args); //WAS PY_SIZE
    va_list list, check;

    va_start(list, types);
Index: jcc3/sources/jcc.cpp
===================================================================
--- jcc3/sources/jcc.cpp (revision 1789413)
+++ jcc3/sources/jcc.cpp (working copy)
@@ -195,11 +195,11 @@

static PyObject *t_jccenv_strhash(PyObject *self, PyObject *arg)
{
-    static const size_t hexdig = sizeof(uintmax_t) * 2;
-    uintmax_t hash = (uintmax_t) PyObject_Hash(arg);
+    unsigned long long hash = (unsigned long long) PyObject_Hash(arg);
+    static const size_t hexdig = sizeof(hash) * 2;
    char buffer[hexdig + 1];

-    sprintf(buffer, "%0*"PRIxMAX, (int) hexdig, hash);
+    sprintf(buffer, "%0*llx", (int) hexdig, hash);
    return PyUnicode_FromStringAndSize(buffer, hexdig);
}

Index: setup.py
===================================================================
--- setup.py (revision 1789413)
+++ setup.py (working copy)
@@ -158,7 +158,7 @@
    'sunos5': ['-L%(sunos5)s/jre/lib/i386' %(JDK), '-ljava',
               '-L%(sunos5)s/jre/lib/i386/client' %(JDK), '-ljvm',
               '-R%(sunos5)s/jre/lib/i386:%(sunos5)s/jre/lib/i386/client'
%(JDK)],
-    'win32': ['/LIBPATH:%(win32)s/lib' %(JDK), 'Ws2_32.lib', 'jvm.lib'],
+    'win32': ['/LIBPATH:%(win32)s/lib' %(JDK), 'Ws2_32.lib',
'jvm.lib','/DLL'],
    'mingw32': ['-L%(mingw32)s/lib' %(JDK), '-ljvm'],
    'freebsd7': ['-L%(freebsd7)s/jre/lib/i386' %(JDK), '-ljava',
'-lverify',
                 '-L%(freebsd7)s/jre/lib/i386/client' %(JDK), '-ljvm',



On Thu, Mar 30, 2017 at 5:36 PM, Petrus Hyvönen <petrus.hyvo...@gmail.com>
wrote:

Hi,

I was trying the python 2.7 build and I think the line 23 in
jcc2/__init__.py should be:

    from jcc.config import SHARED

(instead of from jcc2.config import..)

Regards
/Petrus


On Thu, Mar 30, 2017 at 9:10 AM, Petrus Hyvönen <petrus.hyvo...@gmail.com>
wrote:

Hi,

With this version of of t_jccenv_strhash I can build both JCC and wrap
the library I'm using!

Regards
/Petrus





static PyObject *t_jccenv_strhash(PyObject *self, PyObject *arg)
{
   unsigned long long hash = (unsigned long long) PyObject_Hash(arg);
   static const size_t hexdig = sizeof(hash) * 2;
   char buffer[hexdig + 1];

   sprintf(buffer, "%0*llx", (int) hexdig, hash);
   return PyUnicode_FromStringAndSize(buffer, hexdig);
}

BTW this function should be also copied to the py2 directory where we
still use int allthough PyObject_Hash returns already long on python

2.x.


cu,
Rudi





--
_____________________________________________
Petrus Hyvönen, Uppsala, Sweden
Mobile Phone/SMS:+46 73 803 19 00 <073-803%2019%2000>




--
_____________________________________________
Petrus Hyvönen, Uppsala, Sweden
Mobile Phone/SMS:+46 73 803 19 00 <073-803%2019%2000>




--
_____________________________________________
Petrus Hyvönen, Uppsala, Sweden
Mobile Phone/SMS:+46 73 803 19 00

Reply via email to