3333import subprocess
3434import 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
152152def main () -> None :
0 commit comments