[Python-Dev] setup.py and build subdirectories

Jeremy Hylton jeremy@alum.mit.edu
2001年1月18日 22:31:02 -0500 (EST)


I have a bunch of build directories under the source tree, e.g.
src/python/dist/src/build
src/python/dist/src/build-pg
src/python/dist/src/build-O3
...
The new setup.py did not successfully build in these directories. I
hacked distutils a tiny bit and had some success. Patch below. I'm
not sure if the approach is kosher, but it allows me to build
successfully.
I also have a problem running 'make test' from these build
directories. The reference to the distutils build directory has '..'
prepended to it that shouldn't exist.
Jeremy
Index: setup.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/setup.py,v
retrieving revision 1.8
diff -c -r1.8 setup.py
*** setup.py	2001年01月18日 20:39:34	1.8
--- setup.py	2001年01月19日 03:26:55
***************
*** 536,540 ****
 
 # --install-platlib
 if __name__ == '__main__':
! sysconfig.set_python_build()
 main()
--- 536,541 ----
 
 # --install-platlib
 if __name__ == '__main__':
! path, file = os.path.split(sys.argv[0])
! sysconfig.set_python_build(path)
 main()
Index: Lib/distutils/sysconfig.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v
retrieving revision 1.31
diff -c -r1.31 sysconfig.py
*** Lib/distutils/sysconfig.py	2001年01月17日 15:16:52	1.31
--- Lib/distutils/sysconfig.py	2001年01月19日 03:27:01
***************
*** 24,37 ****
 
 python_build = 0
 
! def set_python_build():
 """Set the python_build flag to true; this means that we're
 building Python itself. Only called from the setup.py script
 shipped with Python.
 """
 
 global python_build
! python_build = 1
 
 def get_python_inc(plat_specific=0, prefix=None):
 """Return the directory containing installed Python header files.
--- 24,37 ----
 
 python_build = 0
 
! def set_python_build(loc):
 """Set the python_build flag to true; this means that we're
 building Python itself. Only called from the setup.py script
 shipped with Python.
 """
 
 global python_build
! python_build = loc + "/"
 
 def get_python_inc(plat_specific=0, prefix=None):
 """Return the directory containing installed Python header files.
***************
*** 48,54 ****
 prefix = (plat_specific and EXEC_PREFIX or PREFIX)
 if os.name == "posix":
 if python_build:
! return "Include/"
 return os.path.join(prefix, "include", "python" + sys.version[:3])
 elif os.name == "nt":
 return os.path.join(prefix, "Include") # include or Include?
--- 48,54 ----
 prefix = (plat_specific and EXEC_PREFIX or PREFIX)
 if os.name == "posix":
 if python_build:
! return python_build + "Include/"
 return os.path.join(prefix, "include", "python" + sys.version[:3])
 elif os.name == "nt":
 return os.path.join(prefix, "Include") # include or Include?

AltStyle によって変換されたページ (->オリジナル) /