|
15 | 15 |
|
16 | 16 | root_folder = os.path.abspath(os.path.dirname(__file__))
|
17 | 17 |
|
18 |
| -packages = [os.path.dirname(p) for p in (glob.glob('azure*/setup.py') + glob.glob('sdk/*/azure*/setup.py'))] |
19 |
| - |
20 |
| -# "install" is used by ReadTheDocs, do not install "nspkg" |
| 18 | +# pull in any packages that exist in the root directory |
| 19 | +packages = {('.', os.path.dirname(p)) for p in glob.glob('azure*/setup.py')} |
| 20 | +# Handle the SDK folder as well |
| 21 | +packages.update({tuple(os.path.dirname(f).rsplit(os.sep, 1)) for f in glob.glob('sdk/*/azure*/setup.py')}) |
| 22 | +# [(base_folder, package_name), ...] to {package_name: base_folder, ...} |
| 23 | +packages = {package_name: base_folder for (base_folder, package_name) in packages} |
21 | 24 |
|
22 | 25 | # Extract nspkg and sort nspkg by number of "-"
|
23 |
| -nspkg_packages = [p for p in packages if "nspkg" in p] |
| 26 | +nspkg_packages = [p for p in packages.keys() if "nspkg" in p] |
24 | 27 | nspkg_packages.sort(key = lambda x: len([c for c in x if c == '-']))
|
25 | 28 |
|
26 | 29 | # Manually push meta-packages at the end, in reverse dependency order
|
27 | 30 | meta_package = ['azure-mgmt', 'azure']
|
28 | 31 |
|
29 |
| -# So content packages are: |
30 |
| -content_package = [p for p in packages if p not in meta_package+nspkg_packages] |
31 |
| -# Move azure-common at the beginning |
| 32 | +# content packages are packages that are not meta nor nspkg |
| 33 | +content_package = sorted([p for p in packages.keys() if p not in meta_package+nspkg_packages]) |
| 34 | + |
| 35 | +# Move azure-common at the beginning, it's important this goes first |
32 | 36 | content_package.remove("azure-common")
|
33 | 37 | content_package.insert(0, "azure-common")
|
34 | 38 |
|
35 | 39 | # Package final:
|
36 | 40 | if "install" in sys.argv:
|
37 |
| - packages = content_package |
| 41 | + packages_for_installation = content_package |
38 | 42 | else:
|
39 |
| - packages = nspkg_packages + content_package + meta_package |
| 43 | + packages_for_installation = nspkg_packages + content_package + meta_package |
40 | 44 |
|
41 |
| -for pkg_name in packages: |
42 |
| - pkg_setup_folder = os.path.join(root_folder, pkg_name) |
| 45 | +for pkg_name in packages_for_installation: |
| 46 | + pkg_setup_folder = os.path.join(root_folder, packages[pkg_name], pkg_name) |
43 | 47 | pkg_setup_path = os.path.join(pkg_setup_folder, 'setup.py')
|
44 | 48 |
|
45 | 49 | try:
|
|
0 commit comments