Differences between revisions 1 and 13 (spanning 12 versions)
Revision 1 as of 2007-08-04 18:10:52
Size: 577
Editor: PhilipJenvey
Comment: setuptools on jython status
Revision 13 as of 2007-09-23 22:24:51
Size: 2707
Editor: PhilipJenvey
Comment: point out mkstemp issues
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Setuptools needs: Setuptools requirements:
Line 3: Line 3:
 * PEP 302 (added in Jython 2.2)
 * PEP 273 (the zipimport module)
  - Jython's ZipFileImporter is somewhat different that the CPython zipimport module -- it's not a module, and it does not maintain its own _zip_importer_cache (which setuptools utilizes) apart from sys.path_importer_cache
 * PEP 302 style zipimport module '''''Added in r3463'''''
 
 * number of misc. Jython bug fixes '''''most already committed'''''

We don't have:

 * the kicker, a working os.chdir. I hacked together a really quick version of this, and setuptools was able to get pretty far at installing Pylons. Pylons itself and a number of its dependencies installed fine, but the process died installing the decorator module due to marshal raising a KeyError
 
 * working marshal. setuptools uses marshal.load, and there's some bugs with our current marshaller

 * tarfile module. This requires a small patch to PyString to work for setuptools. I believe it may require some additions to the os module for test_tarfile.py to pass

 * a valid sys.executable. required by setuptools and distutils for spawning subprocesses. It's impossible to determine argv[0] from java: I'm thinking the jython executable should pass this information along to Jython (java -Dpython.executable=$0)

 * distutils: requires a number of small patches:
Line 7: Line 19:
  - The Jython zipimport machinery is somewhat different: ZipFileImporter only imports zips if they're SyspathArchives: currently .zips and .jars
 * distutils
  - requires this small patch: http://pylonshq.com/pasties/390 (jython's sys.executable is None)
  - distutils metadata for the os.name == 'java' (like path names, default bdist type, etc)
    
  - a jython spawn-like function: "error: don't know how to spawn programs on platform 'java'". os.system works as a replacement

  - a valid sys.executable
  
 * tempfile.mkstemp
  - I have patch #1783692 implementing mkstemp (without a valid file descriptor) and NamedTemporaryFile with Java's secure File.createTempFile '''* See below'''
    
 * imp.acquire/release_lock
  This is just a simple lock, but may have to be used by internal imp operations. I'm not sure
  
 * setuptools runs a test to ensure .pth files work by running "sys.executable -E -c pass". -E is ignore environment on CPython, but is different on Jython (takes an argument):
 
  -E codec : Use a different codec the reading from the console.
   
 * a site-packages dir (jython needs to include it on sys.path by default)

 * A few small maybe upstream patches to setuptools, this includes so far:
 
  - use tempfile.NamedTemporaryFile instead of tempfile.mkstemp (Java/Jython doesn't allow usage of file descriptors). This will also remove a usage of os.open '''* See below'''
  
  - wrap uses of os.chmod in hasattr(os, 'chmod') '''* See below'''
  
  - sandbox may assume os.open (and maybe others) exist '''* See below'''
  
  - setuptools cut and pasted shutil's rmtree from CPython 2.3, which uses lstat to check for directories. This may need to change to os.path.isdir (Jython might be able to do lstat, though)

  - '''*I'm looking into faking file descriptors in Jython, allowing the os.open and mkstemp APIs to work -pjenvey'''

Setuptools requirements:

  • PEP 302 style zipimport module Added in r3463

  • number of misc. Jython bug fixes most already committed

We don't have:

  • the kicker, a working os.chdir. I hacked together a really quick version of this, and setuptools was able to get pretty far at installing Pylons. Pylons itself and a number of its dependencies installed fine, but the process died installing the decorator module due to marshal raising a KeyError

  • working marshal. setuptools uses marshal.load, and there's some bugs with our current marshaller
  • tarfile module. This requires a small patch to PyString to work for setuptools. I believe it may require some additions to the os module for test_tarfile.py to pass

  • a valid sys.executable. required by setuptools and distutils for spawning subprocesses. It's impossible to determine argv[0] from java: I'm thinking the jython executable should pass this information along to Jython (java -Dpython.executable=$0)
  • distutils: requires a number of small patches:
    • - distutils metadata for the os.name == 'java' (like path names, default bdist type, etc) - a jython spawn-like function: "error: don't know how to spawn programs on platform 'java'". os.system works as a replacement - a valid sys.executable
  • tempfile.mkstemp
    • - I have patch #1783692 implementing mkstemp (without a valid file descriptor) and NamedTemporaryFile with Java's secure File.createTempFile * See below

  • imp.acquire/release_lock
    • This is just a simple lock, but may have to be used by internal imp operations. I'm not sure
  • setuptools runs a test to ensure .pth files work by running "sys.executable -E -c pass". -E is ignore environment on CPython, but is different on Jython (takes an argument):
    • -E codec : Use a different codec the reading from the console.
  • a site-packages dir (jython needs to include it on sys.path by default)
  • A few small maybe upstream patches to setuptools, this includes so far:
    • - use tempfile.NamedTemporaryFile instead of tempfile.mkstemp (Java/Jython doesn't allow usage of file descriptors). This will also remove a usage of os.open * See below

      - wrap uses of os.chmod in hasattr(os, 'chmod') * See below

      - sandbox may assume os.open (and maybe others) exist * See below - setuptools cut and pasted shutil's rmtree from CPython 2.3, which uses lstat to check for directories. This may need to change to os.path.isdir (Jython might be able to do lstat, though)

      - *I'm looking into faking file descriptors in Jython, allowing the os.open and mkstemp APIs to work -pjenvey

SetuptoolsOnJython (last edited 2010-01-02 16:58:16 by AndrewKuchling)