5
5
6
6
from fastapi import APIRouter
7
7
8
- from conda_forge_tick .settings import GITHUB_RUNNER_DEBUG , GRAPH_REPO_DEFAULT_BRANCH
8
+ from conda_forge_tick .settings import settings
9
9
10
10
11
11
class GitHubAccount (StrEnum ):
@@ -44,32 +44,14 @@ class GitHubAccount(StrEnum):
44
44
45
45
FEEDSTOCK_SUFFIX = "-feedstock"
46
46
47
- TRANSPARENT_URLS = {
48
- f"https://raw.githubusercontent.com/regro/cf-graph-countyfair/{ GRAPH_REPO_DEFAULT_BRANCH } /mappings/pypi/name_mapping.yaml" ,
49
- f"https://raw.githubusercontent.com/regro/cf-graph-countyfair/{ GRAPH_REPO_DEFAULT_BRANCH } /mappings/pypi/grayskull_pypi_mapping.json" ,
50
- "https://api.github.com/*" ,
51
- "https://pypi.io/packages/source/*" ,
52
- "https://pypi.org/packages/source/*" ,
53
- "https://files.pythonhosted.org/packages/*" ,
54
- "https://api.anaconda.org/package/conda-forge/conda-forge-pinning" ,
55
- "https://api.anaconda.org/download/conda-forge/conda-forge-pinning/*" ,
56
- "https://binstar-cio-packages-prod.s3.amazonaws.com/*" ,
57
- }
58
- """
59
- Requests to those are forwarded to the actual upstream URLs in the tests.
60
- Use Unix filename patterns (provided by fnmatch) to specify wildcards:
61
-
62
- https://docs.python.org/3/library/fnmatch.html
63
- """
64
-
65
47
66
48
def setup_logging (default_level : int ):
67
49
"""
68
50
Set up the Python logging module.
69
51
Uses the passed log level as the default level.
70
52
If running within GitHub Actions and the workflow runs in debug mode, the log level is never set above DEBUG.
71
53
"""
72
- if GITHUB_RUNNER_DEBUG and default_level > logging .DEBUG :
54
+ if settings (). github_runner_debug and default_level > logging .DEBUG :
73
55
level = logging .DEBUG
74
56
else :
75
57
level = default_level
@@ -84,6 +66,28 @@ def is_user_account(account: GitHubAccount) -> bool:
84
66
return IS_USER_ACCOUNT [account ]
85
67
86
68
69
+ def get_transparent_urls () -> set [str ]:
70
+ """
71
+ Returns URLs which should be forwarded to the actual upstream URLs in the tests.
72
+ Unix filename patterns (provided by fnmatch) are used to specify wildcards:
73
+ https://docs.python.org/3/library/fnmatch.html
74
+ """
75
+
76
+ # this is not a constant because the graph_repo_default_branch setting is dynamic
77
+ graph_repo_default_branch = settings ().graph_repo_default_branch
78
+ return {
79
+ f"https://raw.githubusercontent.com/regro/cf-graph-countyfair/{ graph_repo_default_branch } /mappings/pypi/name_mapping.yaml" ,
80
+ f"https://raw.githubusercontent.com/regro/cf-graph-countyfair/{ graph_repo_default_branch } /mappings/pypi/grayskull_pypi_mapping.json" ,
81
+ "https://api.github.com/*" ,
82
+ "https://pypi.io/packages/source/*" ,
83
+ "https://pypi.org/packages/source/*" ,
84
+ "https://files.pythonhosted.org/packages/*" ,
85
+ "https://api.anaconda.org/package/conda-forge/conda-forge-pinning" ,
86
+ "https://api.anaconda.org/download/conda-forge/conda-forge-pinning/*" ,
87
+ "https://binstar-cio-packages-prod.s3.amazonaws.com/*" ,
88
+ }
89
+
90
+
87
91
def get_global_router ():
88
92
"""
89
93
Returns the global FastAPI router to be included in all test scenarios.
0 commit comments