Skip to content

Commit

Permalink
Script update for SDK folder
Browse files Browse the repository at this point in the history
  • Loading branch information
lmazuel committed May 10, 2019
1 parent 5530613 commit fd1bc67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions azure-sdk-tools/packaging_tools/drop_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,20 @@ def build_package_from_pr_number(gh_token, sdk_id, pr_number, output_folder, *,
repo = con.get_repo(sdk_id)
sdk_pr = repo.get_pull(pr_number)
# "get_files" of Github only download the first 300 files. Might not be enough.
package_names = {f.filename.split('/')[0] for f in sdk_pr.get_files() if f.filename.startswith("azure")}
package_names = {('.', f.filename.split('/')[0]) for f in sdk_pr.get_files() if f.filename.startswith("azure")}
# Handle the SDK folder as well
package_names.update({('./sdk/', f.filename.split('/')[1]) for f in sdk_pr.get_files() if f.filename.startswith("sdk/azure")})

absolute_output_folder = Path(output_folder).resolve()

with tempfile.TemporaryDirectory() as temp_dir, \
manage_git_folder(gh_token, Path(temp_dir) / Path("sdk"), sdk_id, pr_number=pr_number) as sdk_folder:
manage_git_folder(gh_token, Path(temp_dir) / Path("sdk"), sdk_id, pr_number=pr_number) as sdk_repo_root:

for package_name in package_names:
for _, package_name in package_names:
_LOGGER.debug("Build {}".format(package_name))
execute_simple_command(
["python", "./build_package.py", "--dest", str(absolute_output_folder), package_name],
cwd=sdk_folder
cwd=sdk_repo_root
)
_LOGGER.debug("Build finished: {}".format(package_name))

Expand Down
2 changes: 1 addition & 1 deletion build_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

def create_package(name, dest_folder=DEFAULT_DEST_FOLDER):
# a package will exist in either one, or the other folder. this is why we can resolve both at the same time.
absdirs = [os.path.dirname(package) for package in (glob.glob('{}/setup.py'.format(name)) + glob.glob('sdk/*/{}/setup.py'.format(name)))]
absdirs = [os.path.dirname(package) for package in (glob.glob('{}/setup.py'.format(name)) + glob.glob('sdk/{}/setup.py'.format(name)))]

absdirpath = os.path.abspath(absdirs[0])
check_call(['python', 'setup.py', 'bdist_wheel', '-d', dest_folder], cwd=absdirpath)
Expand Down

0 comments on commit fd1bc67

Please sign in to comment.