@@ -377,9 +377,17 @@ def sub_callable(match):
377
377
378
378
source = re .sub (
379
379
"from setuptools import setup" ,
380
- "import codecs\n from setuptools import setup" ,
380
+ (
381
+ '"""\n '
382
+ "Colour - Checker Detection - Setup\n "
383
+ "==================================\n "
384
+ '"""\n \n '
385
+ "import codecs\n "
386
+ "from setuptools import setup"
387
+ ),
381
388
source ,
382
389
)
390
+ source = re .sub ('{.*extra == "read-the-docs".*' , "{" , source )
383
391
source = re .sub (
384
392
"setup_kwargs = {(.*)}.*setup\\ (\\ *\\ *setup_kwargs\\ )" ,
385
393
sub_callable ,
@@ -401,6 +409,8 @@ def sub_callable(match):
401
409
with open ("setup.py" , "w" ) as setup_file :
402
410
setup_file .write (source )
403
411
412
+ ctx .run ("poetry run pre-commit run --files setup.py || true" )
413
+
404
414
ctx .run ("twine check dist/*" )
405
415
406
416
@@ -421,15 +431,21 @@ def virtualise(ctx: Context, tests: Boolean = True):
421
431
ctx .run (f"tar -xvf { PYPI_PACKAGE_NAME } -{ APPLICATION_VERSION } .tar.gz" )
422
432
ctx .run (f"mv { PYPI_PACKAGE_NAME } -{ APPLICATION_VERSION } { unique_name } " )
423
433
with ctx .cd (unique_name ):
424
- ctx .run ("poetry env use 3" )
425
- ctx .run ("poetry install" )
434
+ ctx .run ('poetry install --extras "plotting"' )
426
435
ctx .run ("source $(poetry env info -p)/bin/activate" )
427
436
ctx .run (
428
437
'python -c "import imageio;'
429
438
'imageio.plugins.freeimage.download()"'
430
439
)
431
440
if tests :
432
- ctx .run ("poetry run nosetests" )
441
+ ctx .run (
442
+ "poetry run py.test "
443
+ "--disable-warnings "
444
+ "--doctest-modules "
445
+ f"--ignore={ PYTHON_PACKAGE_NAME } /examples "
446
+ f"{ PYTHON_PACKAGE_NAME } " ,
447
+ env = {"MPLBACKEND" : "AGG" },
448
+ )
433
449
434
450
435
451
@task
@@ -452,14 +468,20 @@ def tag(ctx: Context):
452
468
with open (os .path .join (PYTHON_PACKAGE_NAME , "__init__.py" )) as file_handle :
453
469
file_content = file_handle .read ()
454
470
major_version = re .search (
455
- "__major_version__\\ s+=\\ s+'(.*)'" , file_content
456
- ).group (1 )
471
+ '__major_version__\\ s+=\\ s+"(.*)"' , file_content
472
+ ).group ( # type: ignore[union-attr]
473
+ 1
474
+ )
457
475
minor_version = re .search (
458
- "__minor_version__\\ s+=\\ s+'(.*)'" , file_content
459
- ).group (1 )
476
+ '__minor_version__\\ s+=\\ s+"(.*)"' , file_content
477
+ ).group ( # type: ignore[union-attr]
478
+ 1
479
+ )
460
480
change_version = re .search (
461
- "__change_version__\\ s+=\\ s+'(.*)'" , file_content
462
- ).group (1 )
481
+ '__change_version__\\ s+=\\ s+"(.*)"' , file_content
482
+ ).group ( # type: ignore[union-attr]
483
+ 1
484
+ )
463
485
464
486
version = "." .join ((major_version , minor_version , change_version ))
465
487
0 commit comments