aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-11-16 14:35:05 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2022-11-16 20:08:28 +0200
commit27dd5ec2b8ca977e0b9711eca0d6cba543743a4e (patch)
treec35b3f648ca6cdb1473f02a5b837a654e81b1f7f
parentcommit: mention `-e` as nice option (diff)
downloadpkgdev-27dd5ec2b8ca977e0b9711eca0d6cba543743a4e.tar.gz
pkgdev-27dd5ec2b8ca977e0b9711eca0d6cba543743a4e.tar.bz2
pkgdev-27dd5ec2b8ca977e0b9711eca0d6cba543743a4e.zip
build backend: use custom wrapper around flit
For pkgcore we need to run multiple preparations of generating files before creating sdist or wheel. Flit is a very simple and nice build backend, much more than setuptools. Also migrate to use snakeoil.dist sphinx extension for generating man and html, to remove various logic from `doc/conf.py`. Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--.github/workflows/doc.yml4
-rw-r--r--.github/workflows/release.yml16
-rw-r--r--.github/workflows/test.yml17
-rw-r--r--LICENSE2
-rw-r--r--MANIFEST.in10
-rw-r--r--Makefile14
-rw-r--r--README.rst17
l---------bin/pkgdev1
-rw-r--r--data/share/bash-completion/completions/pkgdev (renamed from completion/bash/pkgdev)0
-rw-r--r--data/share/zsh/site-functions/_pkgdev (renamed from completion/zsh/_pkgdev)0
-rw-r--r--doc/Makefile193
-rw-r--r--doc/conf.py39
-rw-r--r--py_build.py44
-rw-r--r--pyproject.toml68
-rw-r--r--requirements/ci.txt1
-rw-r--r--requirements/dev.txt3
-rw-r--r--requirements/dist.txt4
-rw-r--r--requirements/docs.txt1
-rw-r--r--requirements/install.txt3
-rw-r--r--requirements/pyproject.toml6
-rw-r--r--requirements/test.txt1
-rw-r--r--requirements/tox.txt3
-rw-r--r--setup.cfg4
-rwxr-xr-xsetup.py28
-rwxr-xr-xsrc/pkgdev/scripts/__init__.py8
-rw-r--r--tests/scripts/test_pkgdev.py10
-rw-r--r--tox.ini25
27 files changed, 152 insertions, 370 deletions
diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml
index 4c84bf8..2536351 100644
--- a/.github/workflows/doc.yml
+++ b/.github/workflows/doc.yml
@@ -29,11 +29,11 @@ jobs:
- 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
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index bff1b12..f24e520 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -4,6 +4,7 @@ on:
push:
branches: [deploy]
tags: [v*]
+ workflow_dispatch:
jobs:
build-and-deploy:
@@ -15,26 +16,26 @@ jobs:
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
- python-version: '3.10'
+ python-version: "3.10"
- 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
- python setup.py sdist
+ make man
+ make sdist
- name: Build wheel
- run: python setup.py bdist_wheel
+ run: make wheel
- name: Output dist file info
run: |
@@ -52,8 +53,7 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
if: startsWith(github.ref, 'refs/tags/')
- run: |
- twine upload dist/*
+ run: twine upload dist/*
- name: Create GitHub release
uses: softprops/action-gh-release@v1
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 0926dc5..0102337 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -13,12 +13,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
- python-version: ['3.8', '3.9', '3.10']
+ python-version: ['3.9', '3.10', '3.11']
experimental: [false]
include:
- - os: ubuntu-latest
- python-version: '3.11.0-beta - 3.11'
- experimental: true
+ # - os: ubuntu-latest
+ # python-version: '3.11.0-beta - 3.11'
+ # experimental: true
- os: macos-latest
python-version: '3.10'
experimental: false
@@ -33,7 +33,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- cache-dependency-path: requirements/*.txt
+ cache-dependency-path: pyproject.toml
# experimental targets generally lack lxml wheels
- name: Install libxml2 and libxslt development packages
@@ -48,11 +48,10 @@ jobs:
# enable gnu-sed usage as "sed"
echo "/usr/local/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
- - name: Install 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:
@@ -80,7 +79,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: |
diff --git a/LICENSE b/LICENSE
index 565838d..3cc36cb 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2021, pkgdev contributors
+Copyright (c) 2021-2022, pkgdev contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index 66af44c..0000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,10 +0,0 @@
-include LICENSE *.py *.rst
-include tox.ini pyproject.toml .coveragerc .pylintrc
-recursive-include bin *
-recursive-include completion *
-recursive-include data *
-recursive-include doc *
-recursive-include requirements *
-recursive-include src *
-recursive-include tests *
-global-exclude *.pyc *.pyo __pycache__
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..596050b
--- /dev/null
+++ b/Makefile
@@ -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/sphinx doc/api doc/generated doc/_build dist
diff --git a/README.rst b/README.rst
index 838d418..7bf7985 100644
--- a/README.rst
+++ b/README.rst
@@ -37,22 +37,7 @@ Installing from git::
Installing from a tarball::
- python setup.py install
-
-Tests
-=====
-
-A standalone test runner is integrated in setup.py::
-
- python setup.py test
-
-In addition, a tox config is provided so the testsuite can be run in a
-virtualenv setup against all supported python versions. To run tests for all
-environments just execute **tox** in the root directory of a repo or unpacked
-tarball. Otherwise, for a specific python version execute something similar to
-the following::
-
- tox -e py39
+ pip install .
.. _pkgcheck: https://github.com/pkgcore/pkgcheck
diff --git a/bin/pkgdev b/bin/pkgdev
deleted file mode 120000
index 747b025..0000000
--- a/bin/pkgdev
+++ /dev/null
@@ -1 +0,0 @@
-../src/pkgdev/scripts/__init__.py \ No newline at end of file
diff --git a/completion/bash/pkgdev b/data/share/bash-completion/completions/pkgdev
index 1408292..1408292 100644
--- a/completion/bash/pkgdev
+++ b/data/share/bash-completion/completions/pkgdev
diff --git a/completion/zsh/_pkgdev b/data/share/zsh/site-functions/_pkgdev
index f2c95bc..f2c95bc 100644
--- a/completion/zsh/_pkgdev
+++ b/data/share/zsh/site-functions/_pkgdev
diff --git a/doc/Makefile b/doc/Makefile
deleted file mode 100644
index d55c9df..0000000
--- a/doc/Makefile
+++ /dev/null
@@ -1,193 +0,0 @@
-# Makefile for Sphinx documentation
-#
-
-# which python version to use; overridable from the commandline.
-PYTHONPATH = ../
-PYTHON = python
-# You can set these variables from the command line.
-SPHINXOPTS =
-SPHINXBUILD = sphinx-build
-PAPER =
-BUILDDIR = _build
-TOPDIR = ..
-PACKAGEDIR = ../src
-PREFIX = /usr/local
-MAN_PREFIX = $(PREFIX)/share/man
-
-# User-friendly check for sphinx-build
-ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
-$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
-endif
-
-# Internal variables.
-PAPEROPT_a4 = -D latex_paper_size=a4
-PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
-# the i18n builder cannot share the environment and doctrees with the others
-I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
-export PYTHONPATH
-
-.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
-
-help:
- @echo "Please use \`make <target>' where <target> is one of"
- @echo " html to make standalone HTML files"
- @echo " dirhtml to make HTML files named index.html in directories"
- @echo " singlehtml to make a single large HTML file"
- @echo " pickle to make pickle files"
- @echo " json to make JSON files"
- @echo " htmlhelp to make HTML files and a HTML help project"
- @echo " qthelp to make HTML files and a qthelp project"
- @echo " devhelp to make HTML files and a Devhelp project"
- @echo " epub to make an epub"
- @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
- @echo " latexpdf to make LaTeX files and run them through pdflatex"
- @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
- @echo " text to make text files"
- @echo " man to make manual pages"
- @echo " texinfo to make Texinfo files"
- @echo " info to make Texinfo files and run them through makeinfo"
- @echo " gettext to make PO message catalogs"
- @echo " changes to make an overview of all changed/added/deprecated items"
- @echo " xml to make Docutils-native XML files"
- @echo " pseudoxml to make pseudoxml-XML files for display purposes"
- @echo " linkcheck to check all external links for integrity"
- @echo " doctest to run all doctests embedded in the documentation (if enabled)"
-
-clean:
- -rm -rf $(BUILDDIR) api generated
-
-html:
- $(PYTHON) -m snakeoil.dist.generate_docs --html $(TOPDIR) $(PACKAGEDIR) pkgdev
- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
-
-dirhtml:
- $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
-
-singlehtml:
- $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
- @echo
- @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
-
-pickle:
- $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
- @echo
- @echo "Build finished; now you can process the pickle files."
-
-json:
- $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
- @echo
- @echo "Build finished; now you can process the JSON files."
-
-htmlhelp:
- $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
- @echo
- @echo "Build finished; now you can run HTML Help Workshop with the" \
- ".hhp project file in $(BUILDDIR)/htmlhelp."
-
-qthelp:
- $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
- @echo
- @echo "Build finished; now you can run "qcollectiongenerator" with the" \
- ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
- @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pkgdev.qhcp"
- @echo "To view the help file:"
- @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pkgdev.qhc"
-
-devhelp:
- $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
- @echo
- @echo "Build finished."
- @echo "To view the help file:"
- @echo "# mkdir -p $$HOME/.local/share/devhelp/pkgdev"
- @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pkgdev"
- @echo "# devhelp"
-
-epub:
- $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
- @echo
- @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
-
-latex:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo
- @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
- @echo "Run \`make' in that directory to run these through (pdf)latex" \
- "(use \`make latexpdf' here to do that automatically)."
-
-latexpdf:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo "Running LaTeX files through pdflatex..."
- $(MAKE) -C $(BUILDDIR)/latex all-pdf
- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-
-latexpdfja:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo "Running LaTeX files through platex and dvipdfmx..."
- $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-
-text:
- $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
- @echo
- @echo "Build finished. The text files are in $(BUILDDIR)/text."
-
-man:
- $(PYTHON) -m snakeoil.dist.generate_docs --man $(TOPDIR) $(PACKAGEDIR) pkgdev
- $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
- @echo
- @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
-
-install_man:
- @for file in $(BUILDDIR)/man/*; do \
- install -d -m 755 "$(DESTDIR)$(MAN_PREFIX)/man$$(echo $$file | sed 's/.*\.//')"; \
- install -m 644 "$${file}" "$(DESTDIR)$(MAN_PREFIX)/man$$(echo $$file | sed 's/.*\.//')"; \
- done
-
-texinfo:
- $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
- @echo
- @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
- @echo "Run \`make' in that directory to run these through makeinfo" \
- "(use \`make info' here to do that automatically)."
-
-info:
- $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
- @echo "Running Texinfo files through makeinfo..."
- make -C $(BUILDDIR)/texinfo info
- @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
-
-gettext:
- $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
- @echo
- @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
-
-changes:
- $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
- @echo
- @echo "The overview file is in $(BUILDDIR)/changes."
-
-linkcheck:
- $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
- @echo
- @echo "Link check complete; look for any errors in the above output " \
- "or in $(BUILDDIR)/linkcheck/output.txt."
-
-doctest:
- $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
- @echo "Testing of doctests in the sources finished, look at the " \
- "results in $(BUILDDIR)/doctest/output.txt."
-
-xml:
- $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
- @echo
- @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
-
-pseudoxml:
- $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
- @echo
- @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/doc/conf.py b/doc/conf.py
index 7deb456..6a6de98 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -13,24 +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
-from pathlib import Path
-
-# 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.
-
-if (src_path := Path(__file__).parent.parent / 'src').is_dir():
- sys.path.insert(0, str(src_path.resolve()))
-
-if (libdir := Path(__file__).parent.parent / 'build/lib').is_dir():
- sys.path.insert(0, str(libdir.resolve()))
-
-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.
@@ -50,6 +32,7 @@ extensions = [
'sphinx.ext.coverage',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
+ 'snakeoil.dist.sphinxext',
]
# Add any paths that contain templates here, relative to this directory.
@@ -65,17 +48,11 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
-project = pkgdist.MODULE_NAME
+project = 'pkgdev'
authors = ''
copyright = '2021-2022, pkgdev 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
@@ -245,17 +222,9 @@ latex_documents = [
# -- Options for manual page output ---------------------------------------
-generated_man_pages = [
- (f"{project}.scripts.{s.name.replace('-', '_')}", s.name)
- for s in (Path(__file__).parent.parent / 'bin').iterdir()
-]
-
# 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
diff --git a/py_build.py b/py_build.py
new file mode 100644
index 0000000..f224a1b
--- /dev/null
+++ b/py_build.py
@@ -0,0 +1,44 @@
+from functools import partial
+from pathlib import Path
+
+from flit_core import buildapi
+
+
+def write_verinfo(cleanup_files):
+ cleanup_files.append(path := Path.cwd() / "src/pkgdev/_verinfo.py")
+ path.parent.mkdir(parents=True, exist_ok=True)
+ print(f"generating version info: {path}")
+ from snakeoil.version import get_git_version
+ path.write_text(f"version_info={get_git_version(Path.cwd())!r}")
+
+
+def prepare_pkgcore(callback):
+ cleanup_files = []
+ try:
+ write_verinfo(cleanup_files)
+
+ return callback()
+ finally:
+ for path in cleanup_files:
+ try:
+ path.unlink()
+ except OSError:
+ pass
+
+
+def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
+ """Builds a wheel, places it in wheel_directory"""
+ callback = partial(buildapi.build_wheel, wheel_directory, config_settings, metadata_directory)
+ return prepare_pkgcore(callback)
+
+
+def build_editable(wheel_directory, config_settings=None, metadata_directory=None):
+ """Builds an "editable" wheel, places it in wheel_directory"""
+ callback = partial(buildapi.build_editable, wheel_directory, config_settings, metadata_directory)
+ return prepare_pkgcore(callback)
+
+
+def build_sdist(sdist_directory, config_settings=None):
+ """Builds an sdist, places it in sdist_directory"""
+ callback = partial(buildapi.build_sdist, sdist_directory, config_settings)
+ return prepare_pkgcore(callback)
diff --git a/pyproject.toml b/pyproject.toml
index 1006a99..b078b4f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,11 +1,71 @@
[build-system]
requires = [
- "wheel", "setuptools",
- "snakeoil @ https://github.com/pkgcore/snakeoil/archive/master.tar.gz",
+ "flit_core >=3.8,<4",
+ "snakeoil ~=0.10.3",
+]
+build-backend = "py_build"
+backend-path = ["."]
+
+[project]
+name = "pkgdev"
+description = "collection of tools for Gentoo development"
+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 = [
+ "snakeoil~=0.10.3",
+ "pkgcore~=0.12.16",
+ "pkgcheck~=0.10.16",
+]
+
+[project.optional-dependencies]
+test = [
+ "pytest>=6.0",
+ "pytest-cov",
+]
+doc = [
+ "sphinx",
+ "tomli; python_version < '3.11'"
+]
+
+[project.urls]
+Homepage = "https://github.com/pkgcore/pkgdev"
+Documentation = "https://pkgcore.github.io/pkgdev/"
+Source = "https://github.com/pkgcore/pkgdev"
+
+[project.scripts]
+pkgdev = "pkgdev.scripts.__init__:main"
+
+[tool.flit.external-data]
+directory = "data"
+
+[tool.flit.sdist]
+include = [
+ "Makefile", "py_build.py",
+ "NEWS.rst", "doc", "tests",
+ "build/sphinx/man/*.1",
+]
+exclude = [
+ ".github/", ".gitignore",
+ "doc/api/", "doc/generated/", "doc/_build/",
]
-build-backend = "setuptools.build_meta"
[tool.pytest.ini_options]
minversion = "6.0"
-addopts = "-ra"
+addopts = "-vv -ra -l"
testpaths = ["tests"]
diff --git a/requirements/ci.txt b/requirements/ci.txt
deleted file mode 100644
index c75c448..0000000
--- a/requirements/ci.txt
+++ /dev/null
@@ -1 +0,0 @@
-pytest-cov
diff --git a/requirements/dev.txt b/requirements/dev.txt
deleted file mode 100644
index c863221..0000000
--- a/requirements/dev.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-snakeoil @ https://github.com/pkgcore/snakeoil/archive/master.tar.gz
-pkgcore @ https://github.com/pkgcore/pkgcore/archive/master.tar.gz
-pkgcheck @ https://github.com/pkgcore/pkgcheck/archive/master.tar.gz
diff --git a/requirements/dist.txt b/requirements/dist.txt
deleted file mode 100644
index ec03116..0000000
--- a/requirements/dist.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# deps for building sdist/wheels for pypi
--r install.txt
--r docs.txt
-wheel
diff --git a/requirements/docs.txt b/requirements/docs.txt
deleted file mode 100644
index 6966869..0000000
--- a/requirements/docs.txt
+++ /dev/null
@@ -1 +0,0 @@
-sphinx
diff --git a/requirements/install.txt b/requirements/install.txt
deleted file mode 100644
index c6023c6..0000000
--- a/requirements/install.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-snakeoil~=0.10.1
-pkgcore~=0.12.16
-pkgcheck~=0.10.16
diff --git a/requirements/pyproject.toml b/requirements/pyproject.toml
deleted file mode 100644
index 4ed11f6..0000000
--- a/requirements/pyproject.toml
+++ /dev/null
@@ -1,6 +0,0 @@
-[build-system]
-requires = [
- "wheel", "setuptools",
- "snakeoil~=0.10.1",
-]
-build-backend = "setuptools.build_meta"
diff --git a/requirements/test.txt b/requirements/test.txt
deleted file mode 100644
index e079f8a..0000000
--- a/requirements/test.txt
+++ /dev/null
@@ -1 +0,0 @@
-pytest
diff --git a/requirements/tox.txt b/requirements/tox.txt
deleted file mode 100644
index 4e49649..0000000
--- a/requirements/tox.txt
+++ /dev/null
@@ -1,3 +0,0 @@
--r dev.txt
--r test.txt
--r ci.txt
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index e02618b..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-[build_sphinx]
-source-dir = doc
-build-dir = build/sphinx
-all_files = 1
diff --git a/setup.py b/setup.py
deleted file mode 100755
index f7014b6..0000000
--- a/setup.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python3
-
-from itertools import chain
-
-from setuptools import setup
-from snakeoil.dist import distutils_extensions as pkgdist
-
-pkgdist_setup, pkgdist_cmds = pkgdist.setup()
-
-
-setup(**dict(
- pkgdist_setup,
- license='BSD',
- author='Tim Harder',
- author_email='radhermit@gmail.com',
- description='collection of tools for Gentoo development',
- url='https://github.com/pkgcore/pkgdev',
- data_files=list(chain(
- pkgdist.data_mapping('share/bash-completion/completions', 'completion/bash'),
- pkgdist.data_mapping('share/zsh/site-functions', 'completion/zsh'),
- )),
- classifiers=[
- 'License :: OSI Approved :: BSD License',
- 'Programming Language :: Python :: 3.8',
- 'Programming Language :: Python :: 3.9',
- 'Programming Language :: Python :: 3.10',
- ],
-))
diff --git a/src/pkgdev/scripts/__init__.py b/src/pkgdev/scripts/__init__.py
index 2f92c43..164a7f8 100755
--- a/src/pkgdev/scripts/__init__.py
+++ b/src/pkgdev/scripts/__init__.py
@@ -38,9 +38,13 @@ def run(script_name):
sys.exit(tool())
-if __name__ == '__main__':
+def main():
# We're in a git repo or tarball so add the src dir to the system path.
# Note that this assumes a certain module layout.
src_dir = os.path.realpath(__file__).rsplit(os.path.sep, 3)[0]
sys.path.insert(0, src_dir)
- run(os.path.basename(__file__))
+ run(os.path.basename(sys.argv[0]))
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/scripts/test_pkgdev.py b/tests/scripts/test_pkgdev.py
index 8155bdc..7a64c17 100644
--- a/tests/scripts/test_pkgdev.py
+++ b/tests/scripts/test_pkgdev.py
@@ -51,13 +51,3 @@ class TestPkgdev:
assert excinfo.value.code == 0
out, err = capsys.readouterr()
assert out.startswith(project)
-
- def test_installed(self):
- """Verify tests are running in environment where generated modules exist."""
- try:
- importlib.import_module(f'{project}._verinfo')
- except ImportError:
- pytest.fail(
- 'not running against installed or released package\n'
- '(use `setup.py test` when running from git)'
- )
diff --git a/tox.ini b/tox.ini
deleted file mode 100644
index 41b77fb..0000000
--- a/tox.ini
+++ /dev/null
@@ -1,25 +0,0 @@
-[tox]
-envlist = py38, py39
-[testenv]
-# force latest virtualenv/pip
-download = true
-deps = -rrequirements/tox.txt
-commands =
- pytest --cov {posargs:-v}
-
-# build docs
-[testenv:docs]
-skip_install = true
-deps =
- -rrequirements/dev.txt
- -rrequirements/docs.txt
-commands =
- python setup.py build_docs
-
-# build dist files
-[testenv:dist]
-skip_install = true
-deps = -rrequirements/dist.txt
-commands =
- python setup.py sdist
- python setup.py bdist_wheel