Differences between revisions 1 and 18 (spanning 17 versions)
Revision 1 as of 2007-08-04 18:10:52
Size: 577
Editor: PhilipJenvey
Comment: setuptools on jython status
Revision 18 as of 2007-12-24 00:57:29
Size: 2211
Editor: PhilipJenvey
Comment: we have tarfile now
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'''''

 * file descriptor support for tempfile.mkstemp, os.open and tarfile '''''Added in r3711'''''
Line 7: Line 9:
  - 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)
 * tempfile.mkstemp '''''Added in r3712'''''

 * os.chdir (also needed for distutils) '''''Added in r3844'''''
 
 * tarfile module '''''Added in r3850'''''

We don't have:
 
 * working marshal? setuptools uses marshal.load in a couple places, which either needs to be avoided or possibly some work done to Jython's marshal module

 * 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 [http://hg.underboss.org/jython-pjenvey/rev/1026fe32c01c 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
    
 * imp.acquire/release_lock
  This is just a simple lock, but probably needs 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)

 * os.chmod. This can be implemented with JNA. We can still support setuptools on deployments lacking JNA if we submit a patch back to setuptools to only use chmod if it exists
  
 * os.lstat. setuptools cut and pasted shutil's rmtree from CPython 2.3, which uses lstat to check for directories. We can support an os.stat that fills in st_mode's directory bit, but can we do lstat (we could with JNA)? We may want to submit a patch to setuptools to avoid lstat (it could avoid it if it used os.path.isdir)

Setuptools requirements:

  • PEP 302 style zipimport module Added in r3463

  • number of misc. Jython bug fixes most already committed

  • file descriptor support for tempfile.mkstemp, os.open and tarfile Added in r3711

  • tempfile.mkstemp Added in r3712

  • os.chdir (also needed for distutils) Added in r3844

  • tarfile module Added in r3850

We don't have:

  • working marshal? setuptools uses marshal.load in a couple places, which either needs to be avoided or possibly some work done to Jython's marshal module
  • 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 [http://hg.underboss.org/jython-pjenvey/rev/1026fe32c01c 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
  • imp.acquire/release_lock
    • This is just a simple lock, but probably needs 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)
  • os.chmod. This can be implemented with JNA. We can still support setuptools on deployments lacking JNA if we submit a patch back to setuptools to only use chmod if it exists
  • os.lstat. setuptools cut and pasted shutil's rmtree from CPython 2.3, which uses lstat to check for directories. We can support an os.stat that fills in st_mode's directory bit, but can we do lstat (we could with JNA)? We may want to submit a patch to setuptools to avoid lstat (it could avoid it if it used os.path.isdir)

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