Skip to content

Commit

Permalink
run pre-commit and disable dep update
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Aug 10, 2024
1 parent 0473249 commit 83492e6
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 12 deletions.
5 changes: 3 additions & 2 deletions conda_forge_tick/migrators/duplicate_lines.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import os
import re
import typing
import logging
from typing import Any

from conda_forge_tick.migrators.core import MiniMigrator
Expand All @@ -13,6 +13,7 @@

logger = logging.getLogger(__name__)


class DuplicateLinesCleanup(MiniMigrator):
regex_to_check = {
"noarch: generic": re.compile(r"^\s*noarch:\s*generic\s*$"),
Expand All @@ -36,7 +37,7 @@ def migrate(self, recipe_dir: str, attrs: "AttrsTypedDict", **kwargs: Any) -> No
if not os.path.exists("meta.yaml") and os.path.exists("recipe.yaml"):
logger.info(f"Skipping {self.__class__.__name__} for recipe.yaml")
return

Check warning on line 39 in conda_forge_tick/migrators/duplicate_lines.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/migrators/duplicate_lines.py#L38-L39

Added lines #L38 - L39 were not covered by tests

with open("meta.yaml") as fp:
raw_yaml = fp.read()

Expand Down
3 changes: 2 additions & 1 deletion conda_forge_tick/migrators/extra_jinj2a_keys_cleanup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import os
import re
import typing
import logging
from typing import Any

from conda_forge_tick.migrators.core import MiniMigrator
Expand All @@ -12,6 +12,7 @@

logger = logging.getLogger(__name__)


class ExtraJinja2KeysCleanup(MiniMigrator):
"""Remove extra Jinja2 keys that make things hard for the version migrator.
Expand Down
2 changes: 1 addition & 1 deletion conda_forge_tick/migrators/jinja2_vars_cleanup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import os
import re
import typing
import logging
from typing import Any

from conda_forge_tick.migrators.core import MiniMigrator
Expand Down
12 changes: 9 additions & 3 deletions conda_forge_tick/migrators/license.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ def _scrape_license_string(pkg):
],
check=True,
)
if not os.path.exists("r-%s/meta.yaml" % pkg) and os.path.exists("r-%s/recipe.yaml" % pkg):
if not os.path.exists("r-%s/meta.yaml" % pkg) and os.path.exists(
"r-%s/recipe.yaml" % pkg
):
logger.info("Skipping _scrape_license_string for recipe.yaml")
return

Check warning on line 205 in conda_forge_tick/migrators/license.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/migrators/license.py#L204-L205

Added lines #L204 - L205 were not covered by tests
with open("r-%s/meta.yaml" % pkg) as fp:
Expand Down Expand Up @@ -337,8 +339,12 @@ def migrate(self, recipe_dir: str, attrs: "AttrsTypedDict", **kwargs: Any) -> No
Copyright (c) 2017, Anthony Scopatz
Copyright (c) 2018, The Regro Developers
All rights reserved."""
if not os.path.exists("meta.yaml") and os.path.exists("recipe.yaml"):
logger.info("Skipping _scrape_license_string for recipe.yaml")
if not os.path.exists("meta.yaml") and os.path.exists(
"recipe.yaml"
):
logger.info(

Check warning on line 345 in conda_forge_tick/migrators/license.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/migrators/license.py#L345

Added line #L345 was not covered by tests
"Skipping _scrape_license_string for recipe.yaml"
)
return

Check warning on line 348 in conda_forge_tick/migrators/license.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/migrators/license.py#L348

Added line #L348 was not covered by tests
with open("meta.yaml") as f:
raw = f.read()
Expand Down
2 changes: 1 addition & 1 deletion conda_forge_tick/migrators/pip_check.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import io
import logging
import os
import re
import typing
import logging
from typing import Any

import ruamel.yaml
Expand Down
2 changes: 1 addition & 1 deletion conda_forge_tick/migrators/r_ucrt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import os
import re
import typing
import logging
from typing import Any

from conda_forge_tick.migrators.core import MiniMigrator
Expand Down
4 changes: 3 additions & 1 deletion conda_forge_tick/migrators/replacement.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ def filter(self, attrs: "AttrsTypedDict", not_bad_str_start: str = "") -> bool:
def migrate(
self, recipe_dir: str, attrs: "AttrsTypedDict", **kwargs: Any
) -> "MigrationUidTypedDict":
if not os.path.exists(os.path.join(recipe_dir, "meta.yaml")) and os.path.exists(os.path.join(recipe_dir, "recipe.yaml")):
if not os.path.exists(os.path.join(recipe_dir, "meta.yaml")) and os.path.exists(
os.path.join(recipe_dir, "recipe.yaml")
):
logger.info(f"Skipping {self.__class__.__name__} for recipe.yaml")
return

Check warning on line 117 in conda_forge_tick/migrators/replacement.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/migrators/replacement.py#L116-L117

Added lines #L116 - L117 were not covered by tests
with open(os.path.join(recipe_dir, "meta.yaml")) as f:
Expand Down
2 changes: 1 addition & 1 deletion conda_forge_tick/migrators/use_pip.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import os
import typing
import logging
from typing import Any

from conda_forge_tick.os_utils import pushd
Expand Down
4 changes: 3 additions & 1 deletion conda_forge_tick/migrators/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ def migrate(
) -> "MigrationUidTypedDict":
version = attrs["new_version"]

if not os.path.exists(os.path.join(recipe_dir, "meta.yaml")) and os.path.exists(os.path.join(recipe_dir, "recipe.yaml")):
if not os.path.exists(os.path.join(recipe_dir, "meta.yaml")) and os.path.exists(
os.path.join(recipe_dir, "recipe.yaml")
):
logger.info(f"Skipping {self.__class__.__name__} for recipe.yaml")
return

Check warning on line 202 in conda_forge_tick/migrators/version.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/migrators/version.py#L201-L202

Added lines #L201 - L202 were not covered by tests

Expand Down
4 changes: 4 additions & 0 deletions conda_forge_tick/update_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ def get_dep_updates_and_hints(
# no dependency updates or hinting
return {}, ""

if not (Path(recipe_dir) / "meta.yaml").exists():
logger.info("no meta.yaml found, skipping dep updates")
return {}, ""

Check warning on line 208 in conda_forge_tick/update_deps.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/update_deps.py#L207-L208

Added lines #L207 - L208 were not covered by tests

if update_deps in ["hint", "hint-source", "update-source"]:
dep_comparison = get_depfinder_comparison(
recipe_dir,
Expand Down

0 comments on commit 83492e6

Please sign in to comment.