1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616
17+ from __future__ import annotations
1718import io
1819import sys
1920import configparser
@@ -43,13 +44,13 @@ def __init__(self, repo: T.Optional[str], token: T.Optional[str], tag: str):
4344 self .create_source_fallback ()
4445 self .create_wrap_file ()
4546
46- def read_wrap (self ):
47+ def read_wrap (self ) -> None :
4748 filename = Path ('subprojects' , f'{ self .name } .wrap' )
4849 self .wrap = configparser .ConfigParser (interpolation = None )
4950 self .wrap .read (filename )
5051 self .wrap_section = self .wrap [self .wrap .sections ()[0 ]]
5152
52- def create_patch_zip (self ):
53+ def create_patch_zip (self ) -> None :
5354 patch_directory = self .wrap_section .get ('patch_directory' )
5455 if patch_directory is None :
5556 return
@@ -99,7 +100,7 @@ def create_patch_zip(self):
99100 self .wrap_section ['patch_url' ] = f'https://wrapdb.mesonbuild.com/v2/{ self .tag } /get_patch'
100101 self .wrap_section ['patch_hash' ] = patch_hash
101102
102- def create_wrap_file (self ):
103+ def create_wrap_file (self ) -> None :
103104 self .wrap_section ['wrapdb_version' ] = self .version
104105
105106 filename = Path (self .tempdir , f'{ self .name } .wrap' )
@@ -117,7 +118,7 @@ def create_wrap_file(self):
117118 print (filename .read_text ())
118119 self .upload (filename , 'text/plain' )
119120
120- def find_upload_url (self ):
121+ def find_upload_url (self ) -> None :
121122 if not self .repo or not self .token :
122123 return
123124 api = f'https://api.github.com/repos/{ self .repo } /releases'
@@ -139,7 +140,7 @@ def find_upload_url(self):
139140 self .upload_url = response .json ()['upload_url' ].replace ('{?name,label}' ,'' )
140141 print ('Created release:' , self .upload_url )
141142
142- def upload (self , path : Path , mimetype : str ):
143+ def upload (self , path : Path , mimetype : str ) -> None :
143144 if not self .repo or not self .token :
144145 # Write files locally when not run on CI
145146 with Path ('subprojects' , 'packagecache' , path .name ).open ('wb' ) as f :
@@ -153,7 +154,7 @@ def upload(self, path: Path, mimetype: str):
153154 response = requests .post (self .upload_url , headers = headers , params = params , data = path .read_bytes ())
154155 response .raise_for_status ()
155156
156- def create_source_fallback (self ):
157+ def create_source_fallback (self ) -> None :
157158 response = requests .get (
158159 self .wrap_section ['source_url' ],
159160 headers = {'User-Agent' : 'wrapdb/0' },
@@ -164,7 +165,7 @@ def create_source_fallback(self):
164165 self .upload (filename , 'application/zip' )
165166 self .wrap_section ['source_fallback_url' ] = f'https://github.com/mesonbuild/wrapdb/releases/download/{ self .tag } /{ filename .name } '
166167
167- def run (repo : T .Optional [str ], token : T .Optional [str ]):
168+ def run (repo : T .Optional [str ], token : T .Optional [str ]) -> None :
168169 with open ('releases.json' , 'r' ) as f :
169170 releases = json .load (f )
170171 stdout = subprocess .check_output (['git' , 'tag' ])
0 commit comments