1. fanstatic
  2. fanstatic
  3. fanstatic
  4. Issues
Issue #85 new

fanstatic.sdist_compile doesn't work if setuptools package_dir is not set

created an issue

(Note: this applies to 1.0a4.)

Normally, if the package sources are placed under the top-level directory, one does not specify a package_dir to setuptools. Currently fanstatic.sdist_compile chokes in that case.

I believe this patch fixes the problem. (Sorry my hg-foo is weak, and I didn't figure it was worth digging through the hg docs just to figure out how to submit this as a pull request.)

diff --git a/fanstatic/compiler.py b/fanstatic/compiler.py
index 69f372c..288fd03 100644
--- a/fanstatic/compiler.py
+++ b/fanstatic/compiler.py
@@ -136,7 +136,10 @@ class sdist_compile(setuptools.command.sdist.sdist):
         # commands are run only once), there's no harm in doing it even
         # earlier here.
-        for directory in self.distribution.package_dir.values():
+        package_directories = ['.']
+        if self.distribution.package_dir:
+            package_directories = self.distribution.package_dir.values()
+        for directory in package_directories:
             for dist in pkg_resources.find_distributions(directory):

Other notes:

Specifying package_dir={'': '.'} makes sdist_compile happy, but it breaks bdist_egg (which then no longer seems to find any package data files.)

Setting package_dir={'': 'mypackage/..'}, (where mypackage is the name of my top level package) while ugly, does seem to keep everyone happy.

Comments (1)

  1. Log in to comment