Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: requirements/*.txt

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/dev.txt -r requirements/docs.txt
pip install ".[doc]"

- name: Build sphinx documentation
run: |
python setup.py build_docs
make html
# notify github this isn't a jekyll site
touch build/sphinx/html/.nojekyll

Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/manylinux.sh

This file was deleted.

30 changes: 14 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches: [deploy]
tags: [v*]
workflow_dispatch:

jobs:
build-sdist:
Expand All @@ -19,22 +20,19 @@ jobs:

- name: Install dependencies
run: |
# install deps required for building sdist/wheels
python -m pip install --upgrade pip
pip install -r requirements/dist.txt -r requirements/test.txt
pip install build ".[test,doc]"

- name: Test with pytest
env:
PY_COLORS: 1 # forcibly enable pytest colors
run: python setup.py test
run: pytest

- name: Build sdist
run: |
git clean -fxd
# build sdist
python setup.py sdist
# run in-place build so wheel deps use release versions
python setup.py build_py -i
make man
make sdist

- name: Output dist file info
run: |
Expand All @@ -52,23 +50,23 @@ jobs:
strategy:
fail-fast: false
matrix:
pyver: [cp39, cp310, cp311]
arch: [x86_64, aarch64, ppc64le, s390x]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: ${{matrix.arch}}

- name: Build wheels
uses: joerick/cibuildwheel@v2.10.0
uses: joerick/cibuildwheel@v2.11.2
with:
output-dir: dist
env:
CIBW_BUILD: ${{matrix.pyver}}-*
CIBW_ARCHS_LINUX: x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_24
CIBW_BEFORE_BUILD: pip install -r {project}/requirements/dist.txt && {project}/.github/workflows/manylinux.sh
CIBW_BEFORE_TEST: pip install -r {project}/requirements/test.txt
CIBW_ENVIRONMENT: PY_COLORS=1
CIBW_TEST_COMMAND: pytest -v {project}/tests
CIBW_ARCHS_LINUX: ${{matrix.arch}}

- name: Upload wheel artifacts
uses: actions/upload-artifact@v3
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ jobs:

- name: Pin dependencies to minimal versions
if: ${{ matrix.deps == 'minimal-deps' }}
run: |
sed -i -e 's:~=:==:' requirements/*
mv requirements/install.txt requirements/dev.txt
run: sed -e '/^requires-python/!s/~=/==/' -i pyproject.toml

# To use libtree-sitter-bash.so installed on the system, we need to compile
# it manually, because ubuntu doesn't yet package (but Gentoo does)
Expand All @@ -92,13 +90,12 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: requirements/*.txt
cache-dependency-path: pyproject.toml

- name: Install python deps
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/test.txt -r requirements/ci.txt
pip install .
pip install ".[test]"

- name: Test with pytest
env:
Expand Down Expand Up @@ -136,7 +133,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/dev.txt pylint
pip install . pylint

- name: Run linting tools
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ _trial_temp
/doc/_build
/doc/api
/doc/generated
/doc/man/pkgcheck
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ include LICENSE *.py *.rst
include tox.ini pyproject.toml .coveragerc .pylintrc
recursive-include bin *
recursive-include contrib *
recursive-include completion *
recursive-include data *
recursive-include doc *
recursive-exclude doc/generated *
recursive-exclude doc/man/pkgcheck *
recursive-include requirements *
recursive-include src *
recursive-include testdata *
Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
PYTHON ?= python
SPHINX_BUILD ?= $(PYTHON) -m sphinx.cmd.build

.PHONY: man html
man html:
$(SPHINX_BUILD) -a -b $@ doc build/sphinx/$@

.PHONY: sdist wheel
sdist wheel:
$(PYTHON) -m build --$@

.PHONY: clean
clean:
$(RM) -r build doc/man/pkgcheck doc/generated dist
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 5 additions & 34 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import os
import sys
from importlib import import_module

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
libdir = os.path.abspath(os.path.join('..', 'build', 'lib'))
if os.path.exists(libdir):
sys.path.insert(0, libdir)

os.environ['PKGDIST_REPODIR'] = os.path.abspath('..')
from snakeoil.dist import distutils_extensions as pkgdist

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -46,6 +32,7 @@
'sphinx.ext.coverage',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'snakeoil.dist.sphinxext',
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -61,17 +48,11 @@
master_doc = 'index'

# General information about the project.
project = pkgdist.MODULE_NAME
project = 'pkgcheck'
authors = ''
copyright = '2006-2021, pkgcheck contributors'
copyright = '2006-2022, pkgcheck contributors'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = pkgdist.module_version()
# The full version, including alpha/beta/rc tags.
# version is set by snakeoil extension
release = 'master'

# The language for content autogenerated by Sphinx. Refer to documentation
Expand Down Expand Up @@ -241,19 +222,9 @@

# -- Options for manual page output ---------------------------------------

bin_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'bin')
scripts = os.listdir(bin_path)

generated_man_pages = [
(f"{project}.scripts.{s.replace('-', '_')}", s) for s in scripts
]

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(f'man/{script}', script, import_module(module).__doc__.strip().split('\n', 1)[0], [], 1)
for module, script in generated_man_pages
]
man_pages = []

# If true, show URL addresses after external links.
#man_show_urls = False
Expand Down
4 changes: 2 additions & 2 deletions doc/generate/pkgcheck/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _rst_header(char, text, newline=True):

wrapper = TextWrapper(width=85)

for i, scope in enumerate(base.scopes.values()):
for scope in base.scopes.values():
_rst_header('-', scope.desc.capitalize() + ' scope')

checks = (x for x in objects.CHECKS.values() if x.scope == scope)
Expand All @@ -61,7 +61,7 @@ def _rst_header(char, text, newline=True):
explanation = '\n'.join(dedent(explanation).strip().split('\n'))
out('\n' + explanation)
if issubclass(check, GentooRepoCheck):
out(f'\n\n- Gentoo repo specific')
out('\n\n- Gentoo repo specific')
known_results = ', '.join(
f'`{r.__name__}`_' for r in
sorted(check.known_results, key=attrgetter('__name__')))
Expand Down
109 changes: 106 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,115 @@
[build-system]
requires = [
"wheel", "setuptools",
"setuptools >= 61.0.0",
"wheel",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need the explicit wheel dep?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprisingly enough, I do indeed use wheel, to mark my wheel as python ABI agnostic
The usage is with the line:

from wheel.bdist_wheel import bdist_wheel as orig_bdist_wheel

...

class bdist_wheel(orig_bdist_wheel):
    ...

# repeat all normal runtime dependencies here
"chardet",
"lazy-object-proxy",
"lxml",
"pathspec",
"tree-sitter>=0.19.0",
"snakeoil~=0.9.10",
"pkgcore~=0.12.11",
"snakeoil~=0.10.3",
"pkgcore~=0.12.17",
]
build-backend = "setuptools.build_meta"

[project]
name = "pkgcheck"
description = "pkgcore-based QA utility for ebuild repos"
readme = "README.rst"
license = {file = "LICENSE"}
requires-python = "~=3.9"
authors = [
{name = "Tim Harder", email = "radhermit@gmail.com"},
{name = "Arthur Zamarin", email = "arthurzam@gentoo.org"},
]
maintainers = [
{name = "Arthur Zamarin", email = "arthurzam@gentoo.org"},
]
classifiers = [
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
dynamic = ["version"]

dependencies = [
"chardet",
"lazy-object-proxy",
"lxml",
"pathspec",
"tree-sitter>=0.19.0",
"snakeoil~=0.10.3",
"pkgcore~=0.12.17",
]

[project.optional-dependencies]
test = [
"pytest>=6.0",
"pytest-cov",
"requests",
]
doc = [
"sphinx",
"tomli; python_version < '3.11'",
"snakeoil~=0.10.3",
]
network = [
"requests",
]

[project.urls]
Homepage = "https://github.com/pkgcore/pkgcheck"
Documentation = "https://pkgcore.github.io/pkgcheck/"
Source = "https://github.com/pkgcore/pkgcheck"

[project.scripts]
pkgcheck = "pkgcheck.scripts.__init__:main"

[tool.setuptools]
zip-safe = false

[tool.setuptools.dynamic]
version = {attr = "pkgcheck.__version__"}

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-vv -ra -l"
testpaths = ["tests"]

[tool.cibuildwheel]
build = "cp310-*"
build-frontend = "build"

before-build = [
"rm -f {project}/src/pkgcheck/bash/lang.so"
]
test-requires = ["pytest", "requests"]
test-command = "pytest {project}/tests"

# glibc 2.24
manylinux-x86_64-image = "manylinux_2_24"
manylinux-i686-image = "manylinux_2_24"
manylinux-aarch64-image = "manylinux_2_24"
manylinux-ppc64le-image = "manylinux_2_24"
manylinux-s390x-image = "manylinux_2_24"
test-skip = "*-*linux_{aarch64,ppc64le,s390x}"

[[tool.cibuildwheel.overrides]]
select = "*-musllinux*"
before-all = [
"apk add --no-cache git bash libxml2-dev libxslt-dev",
]

[[tool.cibuildwheel.overrides]]
select = "*-manylinux*"
before-all = [
"apt-get update",
"apt-get install -y git libxml2-dev libxslt-dev",
# "yum update -y",
# "yum install -y git libxslt-devel libxml2-devel",

"curl -L \"https://github.com/robxu9/bash-static/releases/download/5.1.016-1.2.3/bash-linux-$(uname -m)\" -o /usr/local/bin/bash",
"chmod +x /usr/local/bin/bash",
]
1 change: 0 additions & 1 deletion requirements/ci.txt

This file was deleted.

8 changes: 0 additions & 8 deletions requirements/dev.txt

This file was deleted.

Loading