Skip to content

Commit d7c0215

Browse files
authored
update for auto private package (#42150)
1 parent 2d2bf15 commit d7c0215

File tree

2 files changed

+20
-27
lines changed

2 files changed

+20
-27
lines changed

scripts/auto_release/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ generate SDK, run live test and create pull request.
1010
the script could help to generate private package quickly.
1111

1212
### Usage
13-
1. copy `auto_private_package` to the place under the same folder with `azure-sdk-for-python`
14-
2. execute it and follow the hint to input parameter:
1513
```
16-
python auto_private_package.py
14+
python scripts/auto_release/auto_private_package.py
1715
```

scripts/auto_release/auto_private_package.py

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,10 @@ def print_exec(cmd: str):
1212
call(cmd, shell=True)
1313

1414

15-
def step_into_sdk_repo() -> str:
16-
return os.chdir(Path(os.getcwd()) / 'azure-sdk-for-python')
17-
18-
1915
def git_clean():
20-
print_check('git checkout .')
21-
print_check('git clean -fd')
22-
print_check('git reset --hard HEAD')
16+
print_check("git checkout .")
17+
print_check("git clean -fd")
18+
print_check("git reset --hard HEAD")
2319

2420

2521
class AutoPrivatePackage:
@@ -28,38 +24,37 @@ class AutoPrivatePackage:
2824
"""
2925

3026
def __init__(self):
31-
self.usr = ''
32-
self.target_branch = ''
33-
self.package_name = ''
27+
self.usr = ""
28+
self.target_branch = ""
29+
self.package_name = ""
3430

3531
def get_input(self):
36-
print('Please commit your code before execute this script!!!')
37-
branch = input('Please input your target branch(e.g. azclibot:t2-compute-2022-01-21-22956):')
38-
info = branch.split(':')
32+
print("Please commit your code before execute this script!!!")
33+
branch = input("Please input your target branch(e.g. azclibot:t2-compute-2022-01-21-22956):")
34+
info = branch.split(":")
3935
self.usr = info[0]
4036
self.target_branch = info[1]
41-
self.package_name = info[1].split('-')[1]
37+
self.package_name = info[1].split("-")[1]
4238

4339
def checkout_target_branch(self):
44-
step_into_sdk_repo()
4540
git_clean()
46-
print_exec(f'git remote add {self.usr} https://github.com/{self.usr}/azure-sdk-for-python.git')
47-
print_check(f'git fetch {self.usr} {self.target_branch}')
48-
print_check(f'git checkout {self.usr}/{self.target_branch}')
41+
print_exec(f"git remote add {self.usr} https://github.com/{self.usr}/azure-sdk-for-python.git")
42+
print_check(f"git fetch {self.usr} {self.target_branch}")
43+
print_check(f"git checkout {self.usr}/{self.target_branch}")
4944

5045
def step_into_package_folder(self):
5146
root_path = os.getcwd()
52-
result = glob(f'{root_path}/sdk/*/azure-mgmt-{self.package_name}')
47+
result = glob(f"{root_path}/sdk/*/azure-mgmt-{self.package_name}")
5348
if len(result) == 0:
54-
raise Exception(f'do not find azure-mgmt-{self.package_name}')
49+
raise Exception(f"do not find azure-mgmt-{self.package_name}")
5550
elif len(result) > 1:
56-
raise Exception(f'find multi target package: {str(result)}')
51+
raise Exception(f"find multi target package: {str(result)}")
5752
os.chdir(str(Path(result[0])))
5853

5954
def generate_private_package(self):
6055
self.step_into_package_folder()
61-
check_call('python setup.py bdist_wheel')
62-
check_call('python setup.py sdist --format zip')
56+
check_call("python setup.py bdist_wheel")
57+
check_call("python setup.py sdist --format zip")
6358
print(f'\n package in : {str(Path(os.getcwd()) / "dist")}')
6459
os.system("pause")
6560

@@ -69,6 +64,6 @@ def run(self):
6964
self.generate_private_package()
7065

7166

72-
if __name__ == '__main__':
67+
if __name__ == "__main__":
7368
instance = AutoPrivatePackage()
7469
instance.run()

0 commit comments

Comments
 (0)