[Zope-CVS] SVN: zpkgtools/trunk/ make zpkg install headers in
package-specific locations, like is should do
Fred L. Drake, Jr.
fdrake at gmail.com
Thu Aug 11 14:11:05 EDT 2005
Log message for revision 37872:
make zpkg install headers in package-specific locations, like is should do
Changed:
U zpkgtools/trunk/doc/TODO.txt
U zpkgtools/trunk/zpkgsetup/dist.py
A zpkgtools/trunk/zpkgsetup/install_headers.py
-=-
Modified: zpkgtools/trunk/doc/TODO.txt
===================================================================
--- zpkgtools/trunk/doc/TODO.txt 2005-08-11 17:55:28 UTC (rev 37871)
+++ zpkgtools/trunk/doc/TODO.txt 2005-08-11 18:11:05 UTC (rev 37872)
@@ -9,43 +9,6 @@
- Need name + acronym to describe what gets built, not normal words
(Jim sez). Zope3-Dev seems to want to call them "packages".
-- The Python world needs a more reasonable way of associating C/C++
- header files with a package; what's being used now is close to
- unworkable for complex installations.
-
- The current Python recommendation is to install headers in
- $exec_prefix/include/pythonX.Y/pkgname/. What pkgname means is not
- clearly defined, but for distutils, it means the first argument to
- setup(); examples on an Ubuntu Linux installation include numarray,
- Numeric, pyogg, and Scientific.
-
- This does not deal with different versions of a package installed at
- different points along sys.path; while ideally such versions should
- be API and ABI compatible, that's a policy decision that each
- individual package has to make, as we want to avoid assumptions
- about such policies in a general tool.
-
- We also need a way to construct provide access to headers provided
- by one component in a collection distribution from another component
- in the same distribution. One approach to this would be to
- construct a temporary directory to contain headers that would be
- installed if we install the package, similar to build/scripts-X.Y/.
- This would need to be added to the set of include paths provided to
- the C/C++ compilers before the path to the already-installed
- headers. This would follow the general disutils principal to
- construct a temporary copy of what you would install as a build is
- performed. If could be implemented as a stock distutils feature,
- though that isn't strictly necessary. It would probably be best
- implemented as a new command, build_headers, that would be run
- before build_ext. An alternate install_headers implementation is
- required.
-
- Such an approach should allow removal of the Dependencies/Includes/
- directory from distributions that provide headers.
-
- **Status:** This is done, except for the alternate install_headers
- command. Additional tests need to be written.
-
- Package assembler script and distribution runtime
- It should be possible to simply embed a resoure map within a
Modified: zpkgtools/trunk/zpkgsetup/dist.py
===================================================================
--- zpkgtools/trunk/zpkgsetup/dist.py 2005-08-11 17:55:28 UTC (rev 37871)
+++ zpkgtools/trunk/zpkgsetup/dist.py 2005-08-11 18:11:05 UTC (rev 37872)
@@ -22,6 +22,7 @@
import zpkgsetup.build
import zpkgsetup.build_ext
import zpkgsetup.build_headers
+import zpkgsetup.install_headers
class ZPkgExtension(distutils.extension.Extension):
@@ -46,3 +47,5 @@
zpkgsetup.build_ext.build_ext)
self.cmdclass.setdefault('build_headers',
zpkgsetup.build_headers.build_headers)
+ self.cmdclass.setdefault('install_headers',
+ zpkgsetup.install_headers.install_headers)
Added: zpkgtools/trunk/zpkgsetup/install_headers.py
===================================================================
--- zpkgtools/trunk/zpkgsetup/install_headers.py 2005-08-11 17:55:28 UTC (rev 37871)
+++ zpkgtools/trunk/zpkgsetup/install_headers.py 2005-08-11 18:11:05 UTC (rev 37872)
@@ -0,0 +1,46 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""\
+install_headers command that installs each header into a
+Python-package specific location.
+
+This allows zpkg-based distributions to install the headers
+consistently based on the package that provides them, rather than
+installing them according to the collection package that contains the
+individual packages.
+
+"""
+
+import os
+import distutils.command.install_headers
+
+
+class install_headers(distutils.command.install_headers.install_headers):
+
+ def run(self):
+ headers = self.distribution.package_headers
+ if not headers:
+ return
+
+ # Since the top-level collection package name gets added,
+ # remove that, and replace it with the right package name for
+ # each header:
+ install_base = os.path.dirname(self.install_dir)
+ self.mkpath(install_base)
+
+ for header in headers:
+ install_dir = os.path.join(install_base, header.package)
+ self.mkpath(install_dir)
+ (out, _) = self.copy_file(header.path, install_dir)
+ self.outfiles.append(out)
Property changes on: zpkgtools/trunk/zpkgsetup/install_headers.py
___________________________________________________________________
Name: svn:mime-type
+ text/x-python
Name: svn:eol-style
+ native
More information about the Zope-CVS
mailing list