Differences between revisions 7 and 8
Revision 7 as of 2007-08-07 20:00:29
Size: 1839
Editor: PhilipJenvey
Comment: updated progress
Revision 8 as of 2007-09-01 00:49:38
Size: 1626
Editor: PhilipJenvey
Comment: latest updates
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
 * PEP 302: added in Jython 2.2  * PEP 302 style zipimport module '''''Added in r3463'''''
 
 * number of misc. Jython bug fixes '''''most already committed'''''
Line 7: Line 9:
 * 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
 * tarfile module. This requires a small patch to PyString to work

 * 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 10: Line 15:
  - The Jython zipimport machinery is different: ZipFileImporter only imports zips if they're SyspathArchives: currently .zips and .jars. How does CPython zipimport identify .eggs in sys.path as .zips? (needed for the ez_setup bootstrap process)
  
  '''''I've got a mostly working implementation of a CPython like zipimport (it would replace ZipFileImporter and possibly SyspathArchive'''''
  
 * distutils
  - requires this small patch: http://pylonshq.com/pasties/390 (jython's sys.executable is None)
  
  - also requires a number of mappings for os.name == 'java' for file installation locations
  
  - also requires a jython spawn-like function: "error: don't know how to spawn programs on platform 'java'". Not sure what to use for that at this point
  - 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
Line 22: Line 22:
  - I've begun taking a look at implementing mkstemp/NamedTemporaryFile with Java's secure File.createTempFile   - I have patch #1783692 implementing mkstemp/NamedTemporaryFile with Java's secure File.createTempFile
    
 * imp.acquire/release_lock
  This is just a simple lock, but may have to be called by internal imp operations. I'm not sure

 * A few small upstream patches to setuptools, this includes:
 
  - 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
Line 24: Line 31:
  '''''I have a mostly working implementation of this'''''   - wrap uses of os.chmod in hasattr(os, 'chmod')
Line 26: Line 33:
 * os.open is used for a small hack having to do with usage of tempfile.mkstemp
  - This is somewhat problematic because even the best Jython mkstemp implementation won't return a file descriptor (No raw file descriptors in java), but setuptools can possibly be patched to use NamedTemporaryFile instead
  - sandbox may assume os.open (and maybe others) exist
Line 29: Line 35:
  '''''Patched this for now. I think a reasonable patch can be integrated to setuptools to avoid using mkstemp'''''
  
 * imp.acquire/release_lock
  '''''Made this no-op for now -- is just a simple lock'''''
  - 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)

Setuptools requirements:

  • PEP 302 style zipimport module Added in r3463

  • number of misc. Jython bug fixes most already committed

We don't have:

  • tarfile module. This requires a small patch to PyString to work

  • 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/NamedTemporaryFile with Java's secure File.createTempFile
  • imp.acquire/release_lock
    • This is just a simple lock, but may have to be called by internal imp operations. I'm not sure
  • A few small upstream patches to setuptools, this includes:
    • - 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 - wrap uses of os.chmod in hasattr(os, 'chmod') - sandbox may assume os.open (and maybe others) exist - 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)

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