From 10a53150a2f670a59f3cf3ae535867b6e0d785a9 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Tue, 26 Mar 2013 17:55:57 -0400 Subject: [PATCH] Include folders with subfolders when creating api tarball (imported from commit b9d564a6cc4ee6e2afa0108b6d9f18af039fc8cf) --- setup.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index db6f5bb..813a636 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,12 @@ import glob import os from distutils.core import setup +def recur_expand(target_root, dir): + for root, _, files in os.walk(dir): + paths = [os.path.join(root, f) for f in files] + if len(paths): + yield os.path.join(target_root, root), paths + setup(name='humbug', version=humbug.__version__, description='Bindings for the Humbug message API', @@ -22,9 +28,7 @@ setup(name='humbug', url='https://humbughq.com/dist/api/', packages=['humbug'], data_files=[('share/humbug/examples', ["examples/humbugrc", "examples/send-message"])] + \ - [(os.path.join('share/humbug/', relpath), - glob.glob(os.path.join(relpath, '*'))) for relpath in - glob.glob("integrations/*")] + \ + list(recur_expand('share/humbug', 'integrations/')) + \ [('share/humbug/demos', [os.path.join("demos", relpath) for relpath in os.listdir("demos")])],