| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 """ | |
| 3 Script that will create a subdirectory one level up with two subdirs | |
| 4 with --single-version-externally-managed namespace packages. | |
| 5 | |
| 6 Use this script with new versions of distribute and setuptools to ensure | |
| 7 that changes in the handling of this option don't break us. | |
| 8 """ | |
| 9 import pkg_resources | |
| 10 import subprocess | |
| 11 import os | |
| 12 import sys | |
| 13 import shutil | |
| 14 | |
| 15 def main(): | |
| 16 r = pkg_resources.require('setuptools')[0] | |
| 17 install_dir = os.path.join( | |
| 18 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | |
| 19 "%s-%s"%(r.project_name, r.version)) | |
| 20 if os.path.exists(install_dir): | |
| 21 print("Skip %s %s: already installed"%(r.project_name, r.version)) | |
| 22 | |
| 23 else: | |
| 24 os.mkdir(install_dir) | |
| 25 os.mkdir(os.path.join(install_dir, "parent")) | |
| 26 os.mkdir(os.path.join(install_dir, "child")) | |
| 27 | |
| 28 if os.path.exists('parent/build'): | |
| 29 shutil.rmtree('parent/build') | |
| 30 if os.path.exists('child/build'): | |
| 31 shutil.rmtree('child/build') | |
| 32 | |
| 33 for subdir in ('parent', 'child'): | |
| 34 p = subprocess.Popen([ | |
| 35 sys.executable, | |
| 36 "setup.py", | |
| 37 "install", | |
| 38 "--install-lib=%s/%s"%(install_dir, subdir), | |
| 39 "--single-version-externally-managed", | |
| 40 "--record", "files.txt" | |
| 41 ], | |
| 42 cwd=subdir) | |
| 43 xit = p.wait() | |
| 44 if xit != 0: | |
| 45 print("ERROR: install failed") | |
| 46 sys.exit(1) | |
| 47 | |
| 48 | |
| 49 if os.path.exists('%s/files.txt'%(subdir,)): | |
| 50 os.unlink('%s/files.txt'%(subdir,)) | |
| 51 | |
| 52 | |
| 53 if __name__ == "__main__": | |
| 54 main() | |
| OLD | NEW |