Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

Provide backward compatibility with Python 2.7 #34

Closed
bcdev opened this issue May 22, 2014 · 5 comments
Closed

Provide backward compatibility with Python 2.7 #34

bcdev opened this issue May 22, 2014 · 5 comments
Assignees
Milestone

Comments

@bcdev
Copy link
Collaborator

bcdev commented May 22, 2014

Many users have a lot of legacy code depending on Python 2.7 and thus hesitate to move to Python 3:

@bcdev
Copy link
Collaborator Author

bcdev commented May 22, 2014

Python 2 --> 3: https://docs.python.org/2/howto/cporting.html

Python 2.7 'distutils' requires Visual Studio on Windows (for Python 3.3, jpy uses the Windows SDK 7.1):

  • Visual Studio 2011: SET VS90COMNTOOLS=%VS100COMNTOOLS%
  • Visual Studio 2012: SET VS90COMNTOOLS=%VS110COMNTOOLS%

--> As we use MS Visual Studio Express we can only compile for 32-bit target platforms

@bcdev
Copy link
Collaborator Author

bcdev commented May 22, 2014

Here are the used functions that are either missing or incompatible in Python 2.7

  • PyModule_Create() named Py_InitModule() with different parameters, easily fixed
  • PyUnicode_AsUTF8(), PyUnicode_FromKindAndData(), PyUnicode_AsWideCharString() missing, must code a replacement which is not straight forward due to uncicode conversion
  • Buffer.releasebufferproc() has different parameters, not checked effort yet

@forman forman added this to the 0.8 milestone May 23, 2014
@forman
Copy link
Member

forman commented Jun 2, 2014

Done for 0.7.2

@forman forman closed this as completed Jun 2, 2014
@forman forman modified the milestones: 0.7.2, 0.8 Jun 3, 2014
@bulli92
Copy link

bulli92 commented Jun 9, 2014

Hi Norman,

thanks a lot for the fast implementation. The installation is however not working properly for me jet. I installed all required dependencies.

If I then say

python setup.py install

I get:
(ipythondev)m300028@alexnotebook:jpy$ python setup.py install
Building a 64-bit library for a Linux system
Traceback (most recent call last):
File "setup.py", line 84, in
libraries = ['jvm', 'python' + sysconfig.get_config_var('VERSION') + sys.abiflags]
AttributeError: 'module' object has no attribute 'abiflags'

My understanding is that the 'abiflags' attribute is specific to python3.

However, if I do

sudo python setup.py install

I get ...
(ipythondev)m300028@alexnotebook:jpy$ sudo python setup.py install
[sudo] password for m300028:
Error: Environment variable "JDK_HOME" must be set to a JDK (>= v1.6) installation directory
(ipythondev)m300028@alexnotebook:jpy$ sudo python setup.py install
Error: Environment variable "JDK_HOME" must be set to a JDK (>= v1.6) installation directory

which is weird, as I have installed the most recent JDK and JDK_HOME is pointing to it ...

(ipythondev)m300028@alexnotebook:jpy$ echo $JDK_HOME
/usr/local/bin/jdk1.8.0_05

Any ideas?

Best,
Alex

@forman
Copy link
Member

forman commented Jun 10, 2014

Yes, the attribute sys.abiflags is a Python 3 feature. Fixed.

However, if you sudo, you loose your environment settings and this is why you don't have "JDK_HOME" anymore.

@forman forman reopened this Jun 10, 2014
@forman forman closed this as completed Jun 10, 2014
@forman forman modified the milestone: 0.7.2 Jun 10, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants