Skip to content

Commit

Permalink
Merge pull request #91 from deadsnakes/check-from-deadsnakes
Browse files Browse the repository at this point in the history
add a check to make sure the package came from deadsnakes
  • Loading branch information
asottile authored Dec 4, 2022
2 parents f0f0ef3 + 51f089a commit e1eb441
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
matrix:
include:
- {python: '3.7', debug: true}
- {python: '3.10-dev', debug: false}
- {python: '3.11-dev', debug: false}
- {python: '3.12-dev', debug: false}
steps:
Expand Down
11 changes: 11 additions & 0 deletions bin/install-python
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ def main() -> int:
if _print_call(*cmd):
return 1

# check whether the installed package came from deadsnakes
out = subprocess.check_output(('apt-cache', 'policy', py)).decode()
seen = False
for line in out.splitlines():
if line.strip().startswith('*** '):
seen = True
elif seen and '/deadsnakes/' not in line:
raise SystemExit(f'package {py} is not from deadsnakes')
elif seen:
break

with open(os.environ['GITHUB_PATH'], 'a') as fp:
fp.write(f'{bindir}\n')

Expand Down

0 comments on commit e1eb441

Please sign in to comment.