[Twisted-web] Re: [Nevow-commits] r5247 - Change package_data so that distutils and setuptools include the athena_private

Matt Goodall matt at pollenation.net
Fri Mar 10 09:35:23 CST 2006


Matt Goodall wrote:
> Matt Goodall wrote:
> 
>>Tristan Seligmann wrote:

[...]

>>>This change does fix setuptools behaviour, but now distutils no longer
>>>works. I gues someone who knows more about distutils and setuptools than
>>>I do needs to figure this one out; I originally added the non-existent
>>>nevow.athena_private package because that was the only way that seemed
>>>to work for distutils. Argh!
>>
>>
>>Yeah, you're right. Sorry about that, although I did try it out here and
>>it seemed ok. Obviously, I had something lurking in sys.path.
>>

[...]

> Actually, this seems to be a problem with the package_data to data_files
> stuff in setup.py to support Python 2.3.

Attached is a diff that I think should work ok with distutils (Python
2.3 and 2.4) and setuptools.

Could someone else test it out please; it was a bit rushed.

Thanks, Matt

-- 
     __
    /  \__     Matt Goodall, Pollenation Internet Ltd
    \__/  \    w: http://www.pollenation.net
  __/  \__/    e: matt at pollenation.net
 /  \__/  \    t: +44 (0)113 2252500
 \__/  \__/
 /  \          Any views expressed are my own and do not necessarily
 \__/          reflect the views of my employer.
-------------- next part --------------
Index: setup.py
===================================================================
--- setup.py	(revision 5271)
+++ setup.py	(working copy)
@@ -4,6 +4,7 @@
 import os.path
 from distutils.command import install
 from distutils.core import setup
+import glob
 import sys
 import setupcommon
 
@@ -21,10 +22,12 @@
 
 # Turn the package_data into a data_files for 2.3 compatability
 data_files = []
-for pkg, files in setupcommon.package_data.items():
+for pkg, patterns in setupcommon.package_data.items():
     pkgdir = os.path.join(*pkg.split('.'))
-    files = [os.path.join(pkgdir, file) for file in files]
-    data_files.append([site_packages+pkgdir, files])
+    for pattern in patterns:
+        globdir = os.path.dirname(pattern)
+        files = glob.glob(os.path.join(pkgdir, pattern))
+        data_files.append((os.path.join(site_packages,pkgdir,globdir),files))
 
 # We need to list the packages explicitly.
 packages = [


More information about the Twisted-web mailing list