From: Andrew M. Kuchling Date: Sun, 10 Dec 2006 00:35:20 +0000 (+0000) Subject: [Jython patch #1578658] Make distutils work for Jython, at least for X-Git-Tag: 2.2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a7ce71b5e9c62ad8099858832101590053afcaca;p=thirdparty%2FPython%2Fcpython.git [Jython patch #1578658] Make distutils work for Jython, at least for pure-Python distributions. Patch by Supreet Sethi, slightly modified by adding the change to sysconfig.py. --- diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py index 2f8cc3363662..363a9399d5b2 100644 --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -55,7 +55,14 @@ INSTALL_SCHEMES = { 'headers': '$base/Include/$dist_name', 'scripts': '$base/Scripts', 'data' : '$base', - } + }, + 'java': { + 'purelib': '$base/Lib', + 'platlib': '$base/Lib', + 'headers': '$base/Include/$dist_name', + 'scripts': '$base/Scripts', + 'data' : '$base', + }, } # The keys to an installation scheme; if any new types of files are to be diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py index 8a10fc5abc2b..576f6edb66fd 100644 --- a/Lib/distutils/dist.py +++ b/Lib/distutils/dist.py @@ -130,7 +130,8 @@ class Distribution: self.metadata = DistributionMetadata() for basename in self.metadata._METHOD_BASENAMES: method_name = "get_" + basename - setattr(self, method_name, getattr(self.metadata, method_name)) + if hasattr(self.metadata, method_name): + setattr(self, method_name, getattr(self.metadata, method_name)) # 'cmdclass' maps command names to class objects, so we # can 1) quickly figure out which class to instantiate when diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 7c16d51a3ea5..c72913acfffc 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -119,6 +119,11 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): return os.path.join(prefix, "Lib") else: return os.path.join(prefix, "Lib", "site-packages") + elif os.name == "java": + if standard_lib: + return os.path.join(prefix, "Lib") + else: + return os.path.join(prefix, "Lib", "site-packages") else: raise DistutilsPlatformError( "I don't know where Python installs its library "