diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-02-11 22:55:49 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-02-11 22:55:49 -0500 |
commit | 9f1f9b144a408770a833cfbee786055dc34dd383 (patch) | |
tree | 1988b2923a8fc5d0464a6e203ffcc5238525a04a /setuptools/command/bdist_egg.py | |
parent | 4104aa38286858dd73eca1da6da25f2c8a170f1a (diff) | |
parent | 911fe5e498a58f1a05b2a7b3a34dfcaa7b9dd89d (diff) | |
download | python-setuptools-git-9f1f9b144a408770a833cfbee786055dc34dd383.tar.gz |
Merge backout of namespace package __init__ module generation; ref #148.3.0b1
Diffstat (limited to 'setuptools/command/bdist_egg.py')
-rw-r--r-- | setuptools/command/bdist_egg.py | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index c5776158..8f4d44c3 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -46,8 +46,8 @@ def write_stub(resource, pyfile): ])) f.close() -# stub __init__.py for packages distributed without one -NS_PKG_STUB = '__import__("pkg_resources").declare_namespace(__name__)' + + class bdist_egg(Command): @@ -198,7 +198,6 @@ class bdist_egg(Command): to_compile.append(pyfile) ext_outputs[p] = ext_name.replace(os.sep,'/') - to_compile.extend(self.make_init_files()) if to_compile: cmd.byte_compile(to_compile) if self.distribution.data_files: @@ -270,30 +269,7 @@ class bdist_egg(Command): log.warn("zip_safe flag not set; analyzing archive contents...") return analyze_egg(self.bdist_dir, self.stubs) - def make_init_files(self): - """Create missing package __init__ files""" - init_files = [] - for base,dirs,files in walk_egg(self.bdist_dir): - if base==self.bdist_dir: - # don't put an __init__ in the root - continue - for name in files: - if name.endswith('.py'): - if '__init__.py' not in files: - pkg = base[len(self.bdist_dir)+1:].replace(os.sep,'.') - if self.distribution.has_contents_for(pkg): - log.warn("Creating missing __init__.py for %s",pkg) - filename = os.path.join(base,'__init__.py') - if not self.dry_run: - f = open(filename,'w'); f.write(NS_PKG_STUB) - f.close() - init_files.append(filename) - break - else: - # not a package, don't traverse to subdirectories - dirs[:] = [] - - return init_files + def gen_header(self): epm = EntryPoint.parse_map(self.distribution.entry_points or '') |