Exclude development environments from package
Publicar paquete PyPI / publish (push) Successful in 1m48s
Publicar paquete PyPI / publish (push) Successful in 1m48s
This commit is contained in:
@@ -55,6 +55,7 @@ jobs:
|
||||
run: |
|
||||
.ci-venv/bin/python -m build
|
||||
.ci-venv/bin/python -m twine check dist/*
|
||||
.ci-venv/bin/python tools/check_wheel.py
|
||||
|
||||
- name: Publicar en Gitea PyPI
|
||||
env:
|
||||
|
||||
@@ -43,6 +43,15 @@ include = [
|
||||
'tests/**/*.rst',
|
||||
'tests/**/*.json',
|
||||
]
|
||||
exclude = [
|
||||
'**/.ci-venv/**',
|
||||
'**/.test-venv/**',
|
||||
'**/.venv/**',
|
||||
'**/__pycache__/**',
|
||||
'**/*.py[co]',
|
||||
'build/**',
|
||||
'dist/**',
|
||||
]
|
||||
|
||||
[tool.hatch.build.targets.wheel.sources]
|
||||
"" = "trytond/modules/ncf_manager"
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Reject development artifacts accidentally bundled in a wheel."""
|
||||
|
||||
from pathlib import Path
|
||||
from zipfile import ZipFile
|
||||
|
||||
|
||||
wheel = next(Path('dist').glob('*.whl'))
|
||||
forbidden = {'.ci-venv', '.test-venv', '.venv', '__pycache__'}
|
||||
with ZipFile(wheel) as archive:
|
||||
invalid = [
|
||||
name for name in archive.namelist()
|
||||
if forbidden.intersection(Path(name).parts)
|
||||
or name.endswith(('.pyc', '.pyo'))
|
||||
]
|
||||
if invalid:
|
||||
raise SystemExit(f'Forbidden wheel content: {invalid[:10]}')
|
||||
print(f'Validated clean wheel: {wheel}')
|
||||
Reference in New Issue
Block a user