29
29
from conda_forge_tick .feedstock_parser import BOOTSTRAP_MAPPINGS
30
30
from conda_forge_tick .git_utils import (
31
31
DryRunBackend ,
32
- DuplicatePullRequestError ,
33
32
GitCli ,
34
33
GitCliError ,
35
34
GitPlatformBackend ,
36
35
RepositoryNotFoundError ,
37
36
github_backend ,
38
- is_github_api_limit_reached ,
37
+ is_github_api_limit_reached , DuplicatePullRequestError ,
39
38
)
40
39
from conda_forge_tick .lazy_json_backends import (
41
40
LazyJson ,
49
48
PR_LIMIT ,
50
49
load_migrators ,
51
50
)
52
- from conda_forge_tick .migration_runner import run_migration
53
- from conda_forge_tick .migrators import MigrationYaml , Migrator , Version
51
+ from conda_forge_tick .migrators import Migrator , Version , MigrationYaml
54
52
from conda_forge_tick .migrators .version import VersionMigrationError
55
53
from conda_forge_tick .os_utils import eval_cmd
56
54
from conda_forge_tick .rerender_feedstock import rerender_feedstock
68
66
load_existing_graph ,
69
67
sanitize_string ,
70
68
)
69
+ from .migration_runner import run_migration
71
70
72
71
from .migrators_types import MigrationUidTypedDict
73
72
from .models .pr_info import PullRequestInfoSpecial
@@ -467,34 +466,6 @@ def run_with_tmpdir(
467
466
)
468
467
469
468
470
- def run (
471
- context : ClonedFeedstockContext ,
472
- migrator : Migrator ,
473
- git_backend : GitPlatformBackend ,
474
- rerender : bool = True ,
475
- base_branch : str = "main" ,
476
- ** kwargs : typing .Any ,
477
- ) -> tuple [MigrationUidTypedDict , dict ] | tuple [Literal [False ], Literal [False ]]:
478
- """
479
- For a given feedstock and migration run the migration in a temporary directory that will be deleted after the
480
- migration is complete.
481
-
482
- The parameters are the same as for the `run` function. The only difference is that you pass a FeedstockContext
483
- instance instead of a ClonedFeedstockContext instance.
484
-
485
- The exceptions are the same as for the `run` function.
486
- """
487
- with context .reserve_clone_directory () as cloned_context :
488
- return run (
489
- context = cloned_context ,
490
- migrator = migrator ,
491
- git_backend = git_backend ,
492
- rerender = rerender ,
493
- base_branch = base_branch ,
494
- ** kwargs ,
495
- )
496
-
497
-
498
469
def run (
499
470
context : ClonedFeedstockContext ,
500
471
migrator : Migrator ,
@@ -879,10 +850,11 @@ def _run_migrator_on_feedstock_branch(
879
850
return good_prs , break_loop
880
851
881
852
882
- def _is_migrator_done (_mg_start , good_prs , time_per , pr_limit ):
853
+ def _is_migrator_done (
854
+ _mg_start , good_prs , time_per , pr_limit , git_backend : GitPlatformBackend
855
+ ):
883
856
curr_time = time .time ()
884
- backend = github_backend ()
885
- api_req = backend .get_api_requests_left ()
857
+ api_req = git_backend .get_api_requests_left ()
886
858
887
859
if curr_time - START_TIME > TIMEOUT :
888
860
logger .info (
@@ -960,7 +932,7 @@ def _run_migrator(
960
932
961
933
if package :
962
934
if package not in possible_nodes :
963
- logger .warning (
935
+ logger .info (
964
936
f"Package { package } is not a candidate for migration of { migrator_name } "
965
937
)
966
938
return 0
@@ -998,7 +970,9 @@ def _run_migrator(
998
970
flush = True ,
999
971
)
1000
972
1001
- if _is_migrator_done (_mg_start , good_prs , time_per , migrator .pr_limit ):
973
+ if _is_migrator_done (
974
+ _mg_start , good_prs , time_per , migrator .pr_limit , git_backend
975
+ ):
1002
976
return 0
1003
977
1004
978
for node_name in possible_nodes :
@@ -1015,7 +989,9 @@ def _run_migrator(
1015
989
):
1016
990
# Don't let CI timeout, break ahead of the timeout so we make certain
1017
991
# to write to the repo
1018
- if _is_migrator_done (_mg_start , good_prs , time_per , migrator .pr_limit ):
992
+ if _is_migrator_done (
993
+ _mg_start , good_prs , time_per , migrator .pr_limit , git_backend
994
+ ):
1019
995
break
1020
996
1021
997
base_branches = migrator .get_possible_feedstock_branches (attrs )
@@ -1370,6 +1346,7 @@ def main(ctx: CliContext, package: str | None = None) -> None:
1370
1346
temp ,
1371
1347
time_per_migrator [mg_ind ],
1372
1348
git_backend ,
1349
+ package ,
1373
1350
)
1374
1351
if good_prs > 0 :
1375
1352
pass
@@ -1384,5 +1361,5 @@ def main(ctx: CliContext, package: str | None = None) -> None:
1384
1361
# ],
1385
1362
# )
1386
1363
1387
- logger .info ("API Calls Remaining: %d" , github_backend () .get_api_requests_left ())
1364
+ logger .info (f "API Calls Remaining: { git_backend .get_api_requests_left ()} " )
1388
1365
logger .info ("Done" )
0 commit comments