summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2014-12-18 23:22:57 +0100
committerJan Pokorný <jpokorny@redhat.com>2015-01-09 10:19:43 +0100
commita9142546ea0134ac2b03457b1dc9333179fc9631 (patch)
tree37b3cd080be4a0e829ce038ef96e75cf57be89c1
parentfe9651fc9daa51f3266b74214418dee015652096 (diff)
downloadclufter-a9142546ea0134ac2b03457b1dc9333179fc9631.tar.gz
clufter-a9142546ea0134ac2b03457b1dc9333179fc9631.tar.xz
clufter-a9142546ea0134ac2b03457b1dc9333179fc9631.zip
setup: find_packages/setuptools 3.5(#195) + symlink schema -> infloop
...hence implement custom version, compatible only to some extent (similar to cross-version compatibility of setuptools' releases!) Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--__root__/setup.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/__root__/setup.py b/__root__/setup.py
index 60780ab..43c9b71 100644
--- a/__root__/setup.py
+++ b/__root__/setup.py
@@ -6,19 +6,19 @@
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"
try:
- from setuptools import setup, find_packages, Extension
+ from setuptools import setup, Extension
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
- from setuptools import setup, find_packages, Extension
+ from setuptools import setup, Extension
from collections import Callable
from glob import glob
-from os import getenv, sep
+from os import getcwd, getenv, sep, walk
from os.path import (join as path_join, basename as path_basename,
dirname as path_dirname, normpath as path_norm,
isabs as path_isabs, isdir as path_isdir,
- splitext as path_splitext)
+ isfile as path_isfile, splitext as path_splitext)
from shutil import copy, copymode
from sys import prefix as sys_prefix
@@ -56,6 +56,27 @@ bifilter = \
reduce(lambda acc, x: acc[int(not fnc(x))].append(x) or acc,
seq, ([], []))
+# this is needed to workaround naive approach in recent setuptools
+# (https://bitbucket.org/pypa/setuptools/issue/195/no-longer-follows-symbolic)
+# which follows symlinks but cannot prune the excluded dirs (perhaps
+# declared so as to prevent infinite symlink recursion at the first place!)
+# directly at the point of unfolding the directory tree traversal further
+def find_packages(where=None, exclude=()):
+ ret = []
+ if not where:
+ where = getcwd()
+ excl_set = set(e.strip('*.') for e in exclude) # rough overapproximation!
+ for root, dirs, files in walk(where, followlinks=True):
+ assert '.' not in root
+ pkg_root = root[len(where):].lstrip(sep).replace(sep, '.')
+ dirs[:] = [d for d in dirs
+ if d not in excl_set
+ and '.' not in d
+ and path_isfile(path_join(root, d, '__init__.py'))]
+ ret.extend('.'.join((pkg_root, d)).lstrip('.') for d in dirs)
+ return ret
+
+
# http://code.activestate.com/recipes/502261-python-distutils-pkg-config/#c1
def pkgconfig(*packages, **kw):
try: