Skip to content

Commit

Permalink
Better control over non-dynamic project metadata and license complian…
Browse files Browse the repository at this point in the history
…ce when building wheels (#28)

Closes #26 
Closes #27
  • Loading branch information
agriyakhetarpal authored Jan 9, 2024
2 parents 0ac6c2c + 1161c00 commit fd3cf92
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 7 deletions.
50 changes: 49 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Run style checks
run: pipx run nox -s lint

build:
build_wheels:
needs: [style]
name: Wheels (${{ matrix.runs-on }} / Python ${{ matrix.python-version }})
runs-on: ${{ matrix.runs-on }}
Expand Down Expand Up @@ -70,3 +70,51 @@ jobs:
- name: Test entry points for package
run: nox -s venv

inspect_distributions:
needs: [style]
name: Inspect ${{ matrix.distribution }} contents
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
distribution: ["sdist", "wheel"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Build, inspect, and display contents of source distribution (SDist)
if: matrix.distribution == 'sdist'
shell: bash
run: |
pipx run build --sdist . --outdir dist/
pipx run twine check dist/* --strict
mkdir -p output/sdist
tar -xf dist/*.tar.gz -C output/sdist
echo -e '## View source distribution (SDist) contents\n' >> $GITHUB_STEP_SUMMARY
echo -e '```\n' >> $GITHUB_STEP_SUMMARY
(cd output/sdist && tree -a * | sed 's/^/ /' | tee -a $GITHUB_STEP_SUMMARY)
echo -e '\n```\n' >> $GITHUB_STEP_SUMMARY
- name: Build, inspect, and display contents of binary distribution (wheel)
if: matrix.distribution == 'wheel'
shell: bash
run: |
pipx run build --wheel . --outdir wheelhouse/
pipx run twine check wheelhouse/* --strict
mkdir -p output/wheel
pipx run wheel unpack wheelhouse/*.whl -d output/wheel
echo -e '## View binary distribution (wheel) contents\n' >> $GITHUB_STEP_SUMMARY
echo -e '```\n' >> $GITHUB_STEP_SUMMARY
(cd output/wheel && tree -a * | sed 's/^/ /' | tee -a $GITHUB_STEP_SUMMARY)
echo -e '\n```\n' >> $GITHUB_STEP_SUMMARY
File renamed without changes.
8 changes: 6 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
include licenses/LICENSE-hugo.txt
include hugo/binaries/*
graft hugo
prune scripts

include LICENSE LICENSE-hugo.txt README.md pyproject.toml setup.py setup.cfg
exclude hugo/binaries/hugo-*

global-exclude __pycache__ *.py[cod] *.so *.dylib .DS_Store .venv
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ This package is designed to be used in the following scenarios:

### Licensing

This project is licensed under the terms of the [Apache 2.0 license](LICENSE). Hugo is available under Apache 2.0 (see [the Hugo license](licenses/LICENSE-hugo.txt)) as well.
This project is licensed under the terms of the [Apache 2.0 license](LICENSE). Hugo is available under Apache 2.0 (see [the Hugo license](LICENSE-hugo.txt)) as well.

### Footnotes

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Homepage = "https://github.com/agriyakhetarpal/hugo-python-distributions"
Issues = "https://github.com/agriyakhetarpal/hugo-python-distributions/issues"
Changelog = "https://github.com/agriyakhetarpal/hugo-python-distributions/releases"

[tool.setuptools.packages.find]
include = ["hugo", "hugo.*"]

[tool.ruff]
src = ["hugo"]
extend-select = [
Expand Down
11 changes: 11 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[options]
include_package_data = True

[options.entry_points]
console_scripts =
hugo = hugo.cli:__call

[metadata]
license_files =
LICENSE
LICENSE-hugo.txt
3 changes: 0 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,12 @@ def run(self):
"clean": Cleaner,
"bdist_wheel": HugoWheel,
},
packages=["hugo", "hugo.binaries"],
package_data={
"hugo": [
f"binaries/hugo-{HUGO_VERSION}-{HUGO_PLATFORM}-{os.environ.get('GOARCH', HUGO_ARCH)}"
+ FILE_EXT
],
},
include_package_data=True,
entry_points={"console_scripts": ["hugo=hugo.cli:__call"]},
# has to be kept in sync with the version in hugo/cli.py
version=HUGO_VERSION,
)

0 comments on commit fd3cf92

Please sign in to comment.