@@ -180,7 +180,7 @@ def main(force):
180
180
envvar = "RH_PYTHON_PACKAGES" ,
181
181
default = ["." ],
182
182
multiple = True ,
183
- help = " The list of paths to Python packages" ,
183
+ help = ' The list of strings of the form "path_to_package:name_of_package"' ,
184
184
)
185
185
]
186
186
@@ -291,7 +291,7 @@ def prep_git(ref, branch, repo, auth, username, git_url):
291
291
def bump_version (version_spec , version_cmd , python_packages ):
292
292
"""Prep git and env variables and bump version"""
293
293
prev_dir = os .getcwd ()
294
- for python_package in python_packages :
294
+ for python_package in [ p . split ( ":" )[ 0 ] for p in python_packages ] :
295
295
os .chdir (python_package )
296
296
lib .bump_version (version_spec , version_cmd )
297
297
os .chdir (prev_dir )
@@ -386,32 +386,31 @@ def check_changelog(
386
386
def build_python (dist_dir , python_packages ):
387
387
"""Build Python dist files"""
388
388
prev_dir = os .getcwd ()
389
- for python_package in python_packages :
389
+ clean = True
390
+ for python_package in [p .split (":" )[0 ] for p in python_packages ]:
390
391
os .chdir (python_package )
391
392
if not util .PYPROJECT .exists () and not util .SETUP_PY .exists ():
392
393
util .log (
393
394
f"Skipping build-python in { python_package } since there are no python package files"
394
395
)
395
396
else :
396
- python .build_dist (dist_dir )
397
+ python .build_dist (
398
+ Path (os .path .relpath ("." , python_package )) / dist_dir , clean = clean
399
+ )
400
+ clean = False
397
401
os .chdir (prev_dir )
398
402
399
403
400
404
@main .command ()
401
405
@add_options (dist_dir_options )
402
- @add_options (python_packages_options )
403
406
@use_checkout_dir ()
404
- def check_python (dist_dir , python_packages ):
407
+ def check_python (dist_dir ):
405
408
"""Check Python dist files"""
406
- prev_dir = os .getcwd ()
407
- for python_package in python_packages :
408
- os .chdir (python_package )
409
- for dist_file in glob (f"{ dist_dir } /*" ):
410
- if Path (dist_file ).suffix not in [".gz" , ".whl" ]:
411
- util .log (f"Skipping non-python dist file { dist_file } " )
412
- continue
413
- python .check_dist (dist_file )
414
- os .chdir (prev_dir )
409
+ for dist_file in glob (f"{ dist_dir } /*" ):
410
+ if Path (dist_file ).suffix not in [".gz" , ".whl" ]:
411
+ util .log (f"Skipping non-python dist file { dist_file } " )
412
+ continue
413
+ python .check_dist (dist_file )
415
414
416
415
417
416
@main .command ()
@@ -480,7 +479,6 @@ def check_links(ignore_glob, ignore_links, cache_file, links_expire):
480
479
481
480
@main .command ()
482
481
@add_options (dist_dir_options )
483
- @add_options (python_packages_options )
484
482
@click .option (
485
483
"--release-message" ,
486
484
envvar = "RH_RELEASE_MESSAGE" ,
@@ -506,21 +504,11 @@ def check_links(ignore_glob, ignore_links, cache_file, links_expire):
506
504
)
507
505
@use_checkout_dir ()
508
506
def tag_release (
509
- dist_dir ,
510
- python_packages ,
511
- release_message ,
512
- tag_format ,
513
- tag_message ,
514
- no_git_tag_workspace ,
507
+ dist_dir , release_message , tag_format , tag_message , no_git_tag_workspace
515
508
):
516
509
"""Create release commit and tag"""
517
510
lib .tag_release (
518
- dist_dir ,
519
- python_packages ,
520
- release_message ,
521
- tag_format ,
522
- tag_message ,
523
- no_git_tag_workspace ,
511
+ dist_dir , release_message , tag_format , tag_message , no_git_tag_workspace
524
512
)
525
513
526
514
@@ -531,7 +519,6 @@ def tag_release(
531
519
@add_options (version_cmd_options )
532
520
@add_options (dist_dir_options )
533
521
@add_options (dry_run_options )
534
- @add_options (python_packages_options )
535
522
@click .option (
536
523
"--post-version-spec" ,
537
524
envvar = "RH_POST_VERSION_SPEC" ,
@@ -557,7 +544,6 @@ def draft_release(
557
544
post_version_spec ,
558
545
post_version_message ,
559
546
assets ,
560
- python_packages ,
561
547
):
562
548
"""Publish Draft GitHub release"""
563
549
lib .draft_release (
@@ -572,7 +558,6 @@ def draft_release(
572
558
post_version_spec ,
573
559
post_version_message ,
574
560
assets ,
575
- python_packages ,
576
561
)
577
562
578
563
@@ -588,27 +573,35 @@ def delete_release(auth, release_url):
588
573
@main .command ()
589
574
@add_options (auth_options )
590
575
@add_options (dist_dir_options )
591
- @add_options (python_packages_options )
592
576
@add_options (dry_run_options )
593
577
@add_options (npm_install_options )
594
578
@click .argument ("release-url" , nargs = 1 )
595
- def extract_release (
596
- auth , dist_dir , python_packages , dry_run , release_url , npm_install_options
597
- ):
579
+ def extract_release (auth , dist_dir , dry_run , release_url , npm_install_options ):
598
580
"""Download and verify assets from a draft GitHub release"""
599
- lib .extract_release (
600
- auth , dist_dir , python_packages , dry_run , release_url , npm_install_options
601
- )
581
+ lib .extract_release (auth , dist_dir , dry_run , release_url , npm_install_options )
602
582
603
583
604
584
@main .command ()
605
585
@add_options (dist_dir_options )
586
+ @click .option ("--npm-token" , help = "A token for the npm release" , envvar = "NPM_TOKEN" )
587
+ @click .option (
588
+ "--npm-cmd" ,
589
+ help = "The command to run for npm release" ,
590
+ envvar = "RH_NPM_COMMAND" ,
591
+ default = "npm publish" ,
592
+ )
606
593
@click .option (
607
594
"--twine-cmd" ,
608
595
help = "The twine to run for Python release" ,
609
596
envvar = "TWINE_COMMAND" ,
610
597
default = "twine upload" ,
611
598
)
599
+ @click .option (
600
+ "--npm-registry" ,
601
+ help = "The npm registry to target for publishing" ,
602
+ envvar = "NPM_REGISTRY" ,
603
+ default = "https://registry.npmjs.org/" ,
604
+ )
612
605
@click .option (
613
606
"--twine-registry" ,
614
607
help = "The pypi register to target for publishing" ,
@@ -619,64 +612,30 @@ def extract_release(
619
612
@add_options (python_packages_options )
620
613
@click .argument ("release-url" , nargs = 1 , required = False )
621
614
@use_checkout_dir ()
622
- def publish_assets_py (
615
+ def publish_assets (
623
616
dist_dir ,
617
+ npm_token ,
618
+ npm_cmd ,
624
619
twine_cmd ,
620
+ npm_registry ,
625
621
twine_registry ,
626
622
dry_run ,
627
623
release_url ,
628
624
python_packages ,
629
625
):
630
- """Publish release asset(s) to PyPI"""
631
- prev_dir = os .getcwd ()
626
+ """Publish release asset(s)"""
632
627
for python_package in python_packages :
633
- os .chdir (python_package )
634
- lib .publish_assets_py (
628
+ lib .publish_assets (
635
629
dist_dir ,
630
+ npm_token ,
631
+ npm_cmd ,
636
632
twine_cmd ,
633
+ npm_registry ,
637
634
twine_registry ,
638
635
dry_run ,
639
636
release_url ,
640
637
python_package ,
641
638
)
642
- os .chdir (prev_dir )
643
-
644
-
645
- @main .command ()
646
- @add_options (dist_dir_options )
647
- @click .option ("--npm-token" , help = "A token for the npm release" , envvar = "NPM_TOKEN" )
648
- @click .option (
649
- "--npm-cmd" ,
650
- help = "The command to run for npm release" ,
651
- envvar = "RH_NPM_COMMAND" ,
652
- default = "npm publish" ,
653
- )
654
- @click .option (
655
- "--npm-registry" ,
656
- help = "The npm registry to target for publishing" ,
657
- envvar = "NPM_REGISTRY" ,
658
- default = "https://registry.npmjs.org/" ,
659
- )
660
- @add_options (dry_run_options )
661
- @click .argument ("release-url" , nargs = 1 , required = False )
662
- @use_checkout_dir ()
663
- def publish_assets_npm (
664
- dist_dir ,
665
- npm_token ,
666
- npm_cmd ,
667
- npm_registry ,
668
- dry_run ,
669
- release_url ,
670
- ):
671
- """Publish release asset(s) to NPM"""
672
- lib .publish_assets_npm (
673
- dist_dir ,
674
- npm_token ,
675
- npm_cmd ,
676
- npm_registry ,
677
- dry_run ,
678
- release_url ,
679
- )
680
639
681
640
682
641
@main .command ()
0 commit comments