Skip to content

Commit

Permalink
Merge pull request #697 from conda-forge/debug-no-ver
Browse files Browse the repository at this point in the history
refactor: try a relative import
  • Loading branch information
beckermr authored Oct 1, 2024
2 parents 5894d6c + 8e5831c commit 913dec3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 48 deletions.
4 changes: 2 additions & 2 deletions conda_forge_webservices/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import logging

# from .utils import tmp_directory
import conda_forge_webservices
from .linting import (
compute_lint_message,
comment_on_pr,
Expand All @@ -23,6 +22,7 @@
)
from .update_teams import update_team
from .utils import ALLOWED_CMD_NON_FEEDSTOCKS, with_action_url
from ._version import __version__
from conda_forge_webservices.tokens import (
get_app_token_for_webservices_only,
get_gh_client,
Expand Down Expand Up @@ -986,7 +986,7 @@ def rerender(full_name, pr_num):

_, repo_name = full_name.split("/")
if repo_name == "cf-autotick-bot-test-package-feedstock":
ref = conda_forge_webservices.__version__.replace("+", ".")
ref = __version__.replace("+", ".")
workflow = gh.get_repo("conda-forge/conda-forge-webservices").get_workflow(
"webservices-workflow-dispatch.yml"
)
Expand Down
4 changes: 2 additions & 2 deletions conda_forge_webservices/linting.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from git import GitCommandError, Repo
import conda_smithy.lint_recipe

import conda_forge_webservices
from conda_forge_webservices.tokens import get_gh_client
from ._version import __version__

LOGGER = logging.getLogger("conda_forge_webservices.linting")
SKIP_MSGS = [
Expand Down Expand Up @@ -42,7 +42,7 @@ def lint_via_github_actions(full_name: str, pr_num: int) -> bool:
return False

if repo_name == "cf-autotick-bot-test-package-feedstock":
ref = conda_forge_webservices.__version__.replace("+", ".")
ref = __version__.replace("+", ".")
workflow = gh.get_repo("conda-forge/conda-forge-webservices").get_workflow(
"webservices-workflow-dispatch.yml"
)
Expand Down
6 changes: 5 additions & 1 deletion conda_forge_webservices/webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import github
from datetime import datetime, timezone

import conda_forge_webservices
import conda_forge_webservices.linting as linting
import conda_forge_webservices.feedstocks_service as feedstocks_service
import conda_forge_webservices.update_teams as update_teams
Expand Down Expand Up @@ -908,7 +909,10 @@ def main():
http_server = tornado.httpserver.HTTPServer(application, xheaders=True)
port = int(os.environ.get("PORT", 5000))

LOGGER.info("starting server")
LOGGER.info(
"starting server - conda-forge-webservices "
f"version {conda_forge_webservices.__version__}"
)

if args.local:
LOGGER.info("server address: http://127.0.0.1:5000/")
Expand Down
53 changes: 10 additions & 43 deletions scripts/delete_staged_recipes_token.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import tempfile
import subprocess
import os

import github
import requests

from conda_forge_webservices.utils import with_action_url
Expand All @@ -23,46 +22,14 @@ def feedstock_token_exists(organization, name):
feedstock_name = "staged-recipes"

if feedstock_token_exists("conda-forge", feedstock_name):
with tempfile.TemporaryDirectory() as tmpdir:
subprocess.check_call(
"git clone https://x-access-token:${GH_TOKEN}@github.com/conda-forge/"
"feedstock-tokens.git",
cwd=tmpdir,
shell=True,
)

subprocess.check_call(
"git remote set-url --push origin "
"https://x-access-token:${GH_TOKEN}@github.com/conda-forge/"
"feedstock-tokens.git",
cwd=os.path.join(tmpdir, "feedstock-tokens"),
shell=True,
)

subprocess.check_call(
f"git rm tokens/{feedstock_name}.json",
cwd=os.path.join(tmpdir, "feedstock-tokens"),
shell=True,
)

msg = with_action_url(
gh = github.Github(auth=github.Auth.Token(os.environ["GH_TOKEN"]))
repo = gh.get_repo("conda-forge/feedstock-tokens")
file = repo.get_contents(f"tokens/{feedstock_name}.json")
repo.delete_file(
path=file.path,
message=with_action_url(
"[ci skip] [skip ci] [cf admin skip] ***NO_CI*** "
f"removing token for {feedstock_name}"
)
subprocess.check_call(
f"git commit --allow-empty -am '{msg}'",
cwd=os.path.join(tmpdir, "feedstock-tokens"),
shell=True,
)

subprocess.check_call(
"git pull",
cwd=os.path.join(tmpdir, "feedstock-tokens"),
shell=True,
)

subprocess.check_call(
"git push",
cwd=os.path.join(tmpdir, "feedstock-tokens"),
shell=True,
)
),
sha=file.sha,
)

0 comments on commit 913dec3

Please sign in to comment.