@@ -36,34 +36,28 @@ def pack(target):
3636 if not os .path .isdir (os .path .dirname (target )):
3737 os .makedirs (os .path .dirname (target ))
3838
39- tmpdir = tempfile .mkdtemp ()
40- create_wheels (os .path .dirname (util .get_source_dir ()), tmpdir )
39+ tmp_dir = tempfile .mkdtemp ()
40+ create_wheels (os .path .dirname (util .get_source_dir ()), tmp_dir )
4141
4242 new_data = io .BytesIO ()
43- for whl in os .listdir (tmpdir ):
44- with zipfile .ZipFile (os .path .join (tmpdir , whl )) as existing_zip :
43+ for whl in os .listdir (tmp_dir ):
44+ with zipfile .ZipFile (os .path .join (tmp_dir , whl )) as existing_zip :
4545 with zipfile .ZipFile (new_data , mode = "a" ) as new_zip :
4646 for zinfo in existing_zip .infolist ():
4747 if re .search (r"\.dist-info/" , zinfo .filename ):
4848 continue
4949 new_zip .writestr (zinfo , existing_zip .read (zinfo ))
5050 zipdata = base64 .b64encode (new_data .getvalue ()).decode ("utf8" )
5151 with open (target , "w" ) as fp :
52- with open (
53- os .path .join (util .get_source_dir (), "pack" , "template.py" ), "r"
54- ) as fp_template :
55- fp .write (
56- fp_template .read ().format (
57- installed_version = "latest" , zipfile_content = zipdata ,
58- ),
59- )
52+ with open (os .path .join (util .get_source_dir (), "pack" , "template.py" )) as fptlp :
53+ fp .write (fptlp .read ().format (zipfile_content = zipdata ))
6054
6155 # Ensure the permissions on the newly created file
6256 oldmode = os .stat (target ).st_mode & 0o7777
6357 newmode = (oldmode | 0o555 ) & 0o7777
6458 os .chmod (target , newmode )
6559
6660 # Clearing up
67- shutil .rmtree (tmpdir )
61+ shutil .rmtree (tmp_dir )
6862
6963 return target
0 commit comments