29
29
REQUIREMENTS_TEST = ['pytest==6.1.1' , 'pytest-cov==2.10.1' ]
30
30
REQUIREMENTS_BUILD = ['setuptools>=20.2' ]
31
31
32
+ OSX_BUNDLE_IDENTIFIER = 'com.backblaze.b2'
33
+
32
34
nox .options .reuse_existing_virtualenvs = True
33
35
nox .options .sessions = [
34
36
'lint' ,
@@ -169,6 +171,12 @@ def bundle(session):
169
171
session .install ('pyinstaller' )
170
172
session .run ('rm' , '-rf' , 'build' , 'dist' , 'b2.egg-info' , external = True )
171
173
install_myself (session )
174
+
175
+ system = platform .system ().lower ()
176
+
177
+ if system == 'darwin' :
178
+ session .posargs .extend (['--osx-bundle-identifier' , OSX_BUNDLE_IDENTIFIER ])
179
+
172
180
session .run ('pyinstaller' , '--onefile' , * session .posargs , 'b2.spec' )
173
181
174
182
# Set outputs for GitHub Actions
@@ -177,11 +185,33 @@ def bundle(session):
177
185
print ('::set-output name=asset_path::' , asset_path , sep = '' )
178
186
179
187
name , ext = os .path .splitext (os .path .basename (asset_path ))
180
- system = platform .system ().lower ()
181
188
asset_name = '{}-{}{}' .format (name , system , ext )
182
189
print ('::set-output name=asset_name::' , asset_name , sep = '' )
183
190
184
191
192
+ @nox .session (python = False )
193
+ def sign (session ):
194
+ """Sign the bundled distribution (OSX only)."""
195
+ system = platform .system ().lower ()
196
+
197
+ if system != 'darwin' :
198
+ session .skip ('signing process is for OSX only' )
199
+
200
+ session .run ('security' , 'find-identity' , external = True )
201
+ session .run (
202
+ 'codesign' ,
203
+ '--force' ,
204
+ '--verbose' ,
205
+ '--timestamp' ,
206
+ '--identifier' ,
207
+ OSX_BUNDLE_IDENTIFIER ,
208
+ * session .posargs ,
209
+ 'dist/b2' ,
210
+ external = True
211
+ )
212
+ session .run ('codesign' , '--verify' , '--verbose' , 'dist/b2' , external = True )
213
+
214
+
185
215
@nox .session (python = PYTHON_DEFAULT_VERSION )
186
216
def doc (session ):
187
217
"""Build the documentation."""
0 commit comments