Skip to content

Commit

Permalink
Service folder update
Browse files Browse the repository at this point in the history
  • Loading branch information
lmazuel committed May 10, 2019
1 parent 027fee8 commit 3054db0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions azure-sdk-tools/packaging_tools/drop_tools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""This file is specific to Azure SDK for Python and should be split somewhere else."""
import logging
from pathlib import Path
import re
import subprocess
import tempfile

Expand All @@ -12,7 +13,7 @@
)

_LOGGER = logging.getLogger(__name__)

_SDK_FOLDER_RE = re.compile(r"^(sdk/[\w-]+)/(azure[\w-]+)/", re.ASCII)

_STORAGE_ACCOUNT = "http://azuresdkinfrajobstore1.blob.core.windows.net/azure/azure-sdk-for-python/pullrequests/{prnumber}/dist/{file}"

Expand Down Expand Up @@ -53,7 +54,8 @@ def build_package_from_pr_number(gh_token, sdk_id, pr_number, output_folder, *,
# "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")}
# 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")})
matches = {_SDK_FOLDER_RE.search(f.filename) for f in sdk_pr.get_files()}
package_names.update({match.groups() for match in matches if match is not None})

absolute_output_folder = Path(output_folder).resolve()

Expand Down
5 changes: 4 additions & 1 deletion azure-sdk-tools/packaging_tools/update_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import os
from pathlib import Path
import re
import tempfile

from azure_devtools.ci_tools.git_tools import (
Expand All @@ -19,6 +20,7 @@


_LOGGER = logging.getLogger(__name__)
_SDK_FOLDER_RE = re.compile(r"^(sdk/[\w-]+)/(azure[\w-]+)/", re.ASCII)


def update_pr(gh_token, repo_id, pr_number):
Expand All @@ -29,7 +31,8 @@ def update_pr(gh_token, repo_id, 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")}
# 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")})
matches = {_SDK_FOLDER_RE.search(f.filename) for f in sdk_pr.get_files()}
package_names.update({match.groups() for match in matches if match is not None})

# Get PR branch to push
head_repo = sdk_pr.head.repo.full_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 3054db0

Please sign in to comment.