From 0eb3d8c3ea3e85aec5b096f83d2533fdf6f1bdc2 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sun, 4 Sep 2011 17:08:20 -0400 Subject: [PATCH] Monkeypatch egg_info not to do stupid things. Signed-off-by: Edward Z. Yang --- setup.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/setup.py b/setup.py index 072c9b3..da739b3 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,46 @@ import setuptools +# MONKEYPATCH: Stop egg_info from stupidly traversing the entire +# development directory. +import setuptools.command.egg_info +import os +class FileList(setuptools.command.egg_info.FileList): + def findall(self, dir=os.curdir): + """Find all files under 'dir' and return the list of full filenames + (relative to 'dir'). + """ + from stat import ST_MODE, S_ISREG, S_ISDIR, S_ISLNK + + list = [] + stack = [dir] + pop = stack.pop + push = stack.append + + while stack: + dir = pop() + # BEGIN MODIFICATION + if dir in ("tests", "srv", ".git"): + continue + # END MODIFICATION + names = os.listdir(dir) + + for name in names: + if dir != os.curdir: # avoid the dreaded "./" syndrome + fullname = os.path.join(dir, name) + else: + fullname = name + + # Avoid excess stat calls -- just one will do, thank you! + stat = os.stat(fullname) + mode = stat[ST_MODE] + if S_ISREG(mode): + list.append(fullname) + elif S_ISDIR(mode) and not S_ISLNK(mode): + push(fullname) + self.allfiles = list +setuptools.command.egg_info.FileList = FileList +# END MONKEYPATCH + setuptools.setup( name = 'wizard', version = '0.1.dev', -- 2.45.2