Skip to content

Commit 89e957e

Browse files
Move all script to etc/scripts
Signed-off-by: Abhishek Kumar <abhishek.kasyap09@gmail.com>
1 parent f08eacf commit 89e957e

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import sys
3434

3535

36-
def generate_OS_archive(input_dir, output):
36+
def generate_os_archive(input_dir, output):
3737
"""
3838
Generate an archive for dependencies for specific OS and
3939
given version of python by taking directory as an input.
@@ -60,14 +60,14 @@ def main_with_args(args: str) -> None:
6060

6161
parser.add_argument(
6262
"--input",
63-
help="Required: Thirdparty Dependencies directory to be archived. ",
63+
help="Required: Thirdparty Dependencies directory to be archived.",
6464
type=str,
6565
required=True,
6666
)
6767

6868
parser.add_argument(
6969
"--output",
70-
help="Required: The Generated archive file name without extension. ",
70+
help="Required: The Generated archive file name without extension.",
7171
type=str,
7272
required=True,
7373
)
@@ -76,7 +76,7 @@ def main_with_args(args: str) -> None:
7676

7777
input_dir = args.input
7878
output = args.output
79-
generate_OS_archive(input_dir, output)
79+
generate_os_archive(input_dir, output)
8080

8181

8282
def main() -> None:
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,29 @@
3333
import subprocess
3434
import sys
3535

36+
python_version = str(sys.version_info[0]) + str(sys.version_info[1])
37+
py_abi = "{0}cp{1}{0}".format("*", python_version)
3638

37-
def release_asset(token, tag, repo, body, user, limit, file):
39+
40+
def release_asset(token, tag, repo, body, user, limit, asset_dir):
3841
"""
3942
Release .whl,.ABOUT,.NOTICE,.LICENSE to github repository from
4043
given directory.
4144
"""
4245

43-
cwd = os.getcwd()
4446
os.environ["GITHUB_TOKEN"] = token
45-
thirdparty = list(resource_iter(file, with_dirs=False))
46-
# FIXME this code is for py 3.6 and later we will update for all version
47+
thirdparty = list(resource_iter(asset_dir, with_dirs=False))
4748
dependencies = [
4849
files
4950
for files in thirdparty
5051
if fnmatch.fnmatchcase(files, "*py3*")
51-
or fnmatch.fnmatchcase(files, "*cp36*")
52+
or fnmatch.fnmatchcase(files, py_abi)
5253
or (
5354
fnmatch.fnmatchcase(files, "*tar.gz*")
5455
and not fnmatch.fnmatchcase(files, "*py2-ipaddress-3.4.1.tar.gz*")
5556
)
5657
]
5758
for deps in dependencies:
58-
print(deps)
5959
subprocess.run(
6060
[
6161
"python3",
@@ -93,28 +93,28 @@ def main_with_args(args: str) -> None:
9393

9494
parser.add_argument(
9595
"--user",
96-
help="Required: The GitHub username or organization name in which the repo resides. ",
96+
help="Required: The GitHub username or organization name in which the repo resides.",
9797
type=str,
9898
required=True,
9999
)
100100

101101
parser.add_argument(
102102
"--token",
103-
help="Required: The Github token is required to acess the repository where you want to upload . ",
103+
help="Required: The Github token is required to acess the repository where you want to upload.",
104104
type=str,
105105
required=True,
106106
)
107107

108108
parser.add_argument(
109109
"--repo",
110-
help="Required: The GitHub repo name in which to make the release. ",
110+
help="Required: The GitHub repo name in which to make the release.",
111111
type=str,
112112
required=True,
113113
)
114114

115115
parser.add_argument(
116116
"--tag_name",
117-
help="Required: The name of the tag to create or use. ",
117+
help="Required: The name of the tag to create or use.",
118118
type=str,
119119
required=True,
120120
)
@@ -127,7 +127,7 @@ def main_with_args(args: str) -> None:
127127

128128
parser.add_argument(
129129
"--retry_limit",
130-
help="The number of times to retry creating/getting the release and/or uploading each file. ",
130+
help="The number of times to retry creating/getting the release and/or uploading each file.",
131131
type=str,
132132
default="10",
133133
)
@@ -144,9 +144,9 @@ def main_with_args(args: str) -> None:
144144
body = args.body_string
145145
user = args.user
146146
limit = args.retry_limit
147-
file = args.files
147+
deps_dir = args.files
148148

149-
release_asset(token, tag, repo, body, user, limit, file)
149+
release_asset(token, tag, repo, body, user, limit, deps_dir)
150150

151151

152152
def main() -> None:

0 commit comments

Comments
 (0)