|
47 | 47 | "Intended Audience :: Developers", |
48 | 48 | "Intended Audience :: Education", |
49 | 49 | "Intended Audience :: End Users/Desktop", |
50 | | - "License :: OSI Approved :: MIT License", |
51 | 50 | "Operating System :: MacOS :: MacOS X", |
52 | 51 | "Programming Language :: Python :: 3", |
53 | 52 | "Programming Language :: Python :: 3.6", |
@@ -182,33 +181,63 @@ def stale(dst, src): |
182 | 181 | ## Build Commands ## |
183 | 182 |
|
184 | 183 | class CleanCommand(Command): |
185 | | - description = "wipe out the ./build & ./dist dirs and other setup-generated files" |
186 | | - user_options = [] |
| 184 | + description = "wipe out generated files and build artifacts" |
| 185 | + user_options = [ |
| 186 | + ('dist', None, 'also remove Python.framework and local dependencies'), |
| 187 | + ] |
| 188 | + |
187 | 189 | def initialize_options(self): |
188 | | - pass |
| 190 | + self.dist = None |
| 191 | + |
189 | 192 | def finalize_options(self): |
190 | 193 | pass |
| 194 | + |
191 | 195 | def run(self): |
192 | | - os.system('rm -rf ./build ./dist') |
193 | | - os.system('rm -rf plotdevice.egg-info MANIFEST.in PKG') |
194 | | - os.system('rm -rf ./tests/_out ./tests/_diff ./details.html') |
195 | | - os.system('rm -f ./_plotdevice.*.so') |
196 | | - os.system('cd deps/extensions/svg && make clean') |
197 | | - os.system('find plotdevice -name .DS_Store -exec rm {} \;') |
198 | | - os.system('find plotdevice -name \*.pyc -exec rm {} \;') |
199 | | - os.system('find plotdevice -name __pycache__ -type d -prune -exec rmdir {} \;') |
200 | | - |
201 | | -class DistCleanCommand(Command): |
| 196 | + paths = [ |
| 197 | + 'build', |
| 198 | + 'dist', |
| 199 | + '*.egg', |
| 200 | + '*.egg-info', |
| 201 | + '.eggs', |
| 202 | + 'MANIFEST.in', |
| 203 | + 'PKG', |
| 204 | + 'tests/_out', |
| 205 | + 'tests/_diff', |
| 206 | + 'details.html', |
| 207 | + '_plotdevice.*.so', |
| 208 | + '**/*.pyc', |
| 209 | + '**/__pycache__', |
| 210 | + '**/.DS_Store', |
| 211 | + ] |
| 212 | + |
| 213 | + # Add framework paths if --dist flag is used |
| 214 | + if self.dist: |
| 215 | + paths.extend([ |
| 216 | + 'deps/local', |
| 217 | + 'deps/frameworks/Python.framework', |
| 218 | + 'deps/frameworks/relocatable-python', |
| 219 | + ]) |
| 220 | + |
| 221 | + for path_pattern in paths: |
| 222 | + for path in glob(path_pattern, recursive=True): |
| 223 | + if exists(path): |
| 224 | + print('removing %s'%path) |
| 225 | + if os.path.isdir(path): |
| 226 | + rmtree(path) |
| 227 | + else: |
| 228 | + os.unlink(path) |
| 229 | + |
| 230 | + # Run make clean in svg extensions dir |
| 231 | + if exists('deps/extensions/svg'): |
| 232 | + os.system('cd deps/extensions/svg && make clean') |
| 233 | + |
| 234 | +class DistCleanCommand(CleanCommand): |
| 235 | + """Alias for `clean --dist` for backward compatibility""" |
202 | 236 | description = "delete Python.framework, local pypi dependencies, and all generated files" |
203 | | - user_options = [] |
| 237 | + |
204 | 238 | def initialize_options(self): |
205 | | - pass |
206 | | - def finalize_options(self): |
207 | | - pass |
208 | | - def run(self): |
209 | | - self.run_command('clean') |
210 | | - os.system('rm -rf ./deps/local') |
211 | | - os.system('rm -rf ./deps/frameworks/*.framework') |
| 239 | + super().initialize_options() |
| 240 | + self.dist = True # always do a deep clean |
212 | 241 |
|
213 | 242 | class LocalDevCommand(Command): |
214 | 243 | description = "set up environment to allow for running `python -m plotdevice` within the repo" |
@@ -308,14 +337,20 @@ def run(self): |
308 | 337 |
|
309 | 338 | class BuildAppCommand(Command): |
310 | 339 | description = "Build PlotDevice.app with xcode" |
311 | | - user_options = [] |
| 340 | + user_options = [ |
| 341 | + ('no-cache', None, 'do not use pip cache when installing dependencies'), |
| 342 | + ] |
| 343 | + |
312 | 344 | def initialize_options(self): |
313 | | - pass |
| 345 | + self.no_cache = None |
314 | 346 |
|
315 | 347 | def finalize_options(self): |
316 | 348 | # make sure the embedded framework exists (and has updated app/python.xcconfig) |
317 | 349 | print("Set up Python.framework for app build") |
318 | | - call('cd deps/frameworks && make', shell=True) |
| 350 | + env = os.environ.copy() |
| 351 | + if self.no_cache: |
| 352 | + env['PIP_NO_CACHE_DIR'] = '1' |
| 353 | + call('cd deps/frameworks && make', shell=True, env=env) |
319 | 354 |
|
320 | 355 | def run(self): |
321 | 356 | self.spawn(['xcodebuild', '-configuration', 'Release']) |
@@ -470,8 +505,7 @@ def codesign(root, name=None, exec=False, entitlement=False): |
470 | 505 | )], |
471 | 506 | install_requires = [ |
472 | 507 | 'requests', |
473 | | - 'cachecontrol', |
474 | | - 'lockfile', |
| 508 | + 'cachecontrol[filecache]', |
475 | 509 | 'pyobjc-core==8.5', |
476 | 510 | 'pyobjc-framework-Quartz==8.5', |
477 | 511 | 'pyobjc-framework-LaunchServices==8.5', |
|
0 commit comments