Skip to content

Commit d9a17f9

Browse files
authored
[pipeline] optimization for packaging logic (#36169)
* optimization * fix
1 parent b793116 commit d9a17f9

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

tools/azure-sdk-tools/packaging_tools/package_utils.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
import glob
2-
import os
1+
from pathlib import Path
32

43
from subprocess import check_call
54

65
from .change_log import main as change_log_main
76

87
DEFAULT_DEST_FOLDER = "./dist"
98

10-
11-
def create_package(name, dest_folder=DEFAULT_DEST_FOLDER):
12-
# a package will exist in either one, or the other folder. this is why we can resolve both at the same time.
13-
absdirs = [
14-
os.path.dirname(package)
15-
for package in (glob.glob("{}/setup.py".format(name)) + glob.glob("sdk/*/{}/setup.py".format(name)))
16-
]
17-
18-
absdirpath = os.path.abspath(absdirs[0])
9+
# prefolder: "sdk/compute"; name: "azure-mgmt-compute"
10+
def create_package(prefolder, name, dest_folder=DEFAULT_DEST_FOLDER):
11+
absdirpath = Path(prefolder, name).absolute()
1912
check_call(["python", "setup.py", "bdist_wheel", "-d", dest_folder], cwd=absdirpath)
2013
check_call(
2114
["python", "setup.py", "sdist", "--format", "zip", "-d", dest_folder],

tools/azure-sdk-tools/packaging_tools/sdk_package.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def main(generate_input, generate_output):
1919
result = {"packages": []}
2020
for package in data.values():
2121
package_name = package["packageName"]
22+
prefolder = package["path"][0]
2223
# Changelog
2324
last_version = ["first release"]
2425
if "azure-mgmt-" in package_name:
@@ -37,7 +38,7 @@ def main(generate_input, generate_output):
3738

3839
_LOGGER.info(f"[PACKAGE]({package_name})[CHANGELOG]:{md_output}")
3940
# Built package
40-
create_package(package_name)
41+
create_package(prefolder, package_name)
4142
folder_name = package["path"][0]
4243
dist_path = Path(sdk_folder, folder_name, package_name, "dist")
4344
package["artifacts"] = [str(dist_path / package_file) for package_file in os.listdir(dist_path)]

0 commit comments

Comments
 (0)