Skip to content

Commit

Permalink
Update buildsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
sumpfork committed Mar 19, 2024
1 parent 98a7589 commit add7329
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install setuptools wheel twine build
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
python -m build sdist bdist_wheel
twine upload dist/*
21 changes: 15 additions & 6 deletions dodo.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
import distutils.core
import glob
import os

import build
from domdiv.tools import bgg_release, update_language

DOIT_CONFIG = {"default_tasks": ["build"]}


def buildit():
try:
builder = build.ProjectBuilder(".")
builder.prepare("wheel", "dist")
builder.build("sdist", "dist")
except Exception as e:
print(e)
return False
return True


def glob_no_dirs(spec):
return [fname for fname in glob.glob(spec) if os.path.isfile(fname)]

Expand Down Expand Up @@ -48,15 +59,13 @@ def task_build():
files = [
fname
for fname in glob_no_dirs("src/domdiv/**/*")
+ glob.glob("card_db_src/**/*.json" + "setup.py")
+ glob.glob("card_db_src/**/*.json" + "pyproject.toml")
if os.path.isfile(fname)
]
return {
"file_dep": files,
"task_dep": ["update_languages"],
"actions": [
lambda: True if distutils.core.run_setup("setup.py", "sdist") else False
],
"actions": [buildit],
}


Expand All @@ -66,4 +75,4 @@ def task_make_bgg_release():

def task_test():
files = glob_no_dirs("src/domdiv/**")
return {"file_dep": files, "actions": ["python setup.py test"]}
return {"file_dep": files, "actions": ["pip install -e .[tests]", "pytest"]}
31 changes: 29 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@

[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.3", "pytest-runner"]
requires = ["setuptools>=61", "setuptools_scm[toml]>=6"]
build-backend = "setuptools.build_meta"

[project]
name = "domdiv"
dynamic = ["version"]
dependencies = ["reportlab", "Pillow", "configargparse"]
description = "Divider Generation for the Dominion Card Game"
keywords = ["boardgame", "cardgame", "dividers"]
authors = [{ name = "Peter Gorniak", email = "[email protected]" }]
readme = "README.md"

[project.urls]
"Say Thanks" = "https://boardgamegeek.com/thread/926575/web-page-generate-tabbed-dividers"
"Source" = "https://github.com/sumpfork/dominiontabs"
"Issue Tracker" = "https://github.com/sumpfork/dominiontabs/issues"
"Homepage" = "http://domtabs.sandflea.org"

[project.optional-dependencies]
dev = ["build", "twine", "pre-commit", "doit", "pytest"]

[project.scripts]
dominion_dividers = "domdiv.main:main"
domdiv_update_language = "domdiv.tools.update_language:run"
domdiv_bgg_release = "domdiv.tools.bgg_release:make_bgg_release"
domdiv_dedupe_cards = "domdiv.tools.cleanup_language_dupes:main"

[tools.setuptools_scm]
[tool.setuptools_scm]
version_file = "src/domdiv/_version.py"
32 changes: 0 additions & 32 deletions setup.py

This file was deleted.

17 changes: 17 additions & 0 deletions src/domdiv/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# file generated by setuptools_scm
# don't change, don't track in version control
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union

VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = "4.4.2.dev0+g98a7589.d20240318"
__version_tuple__ = version_tuple = (4, 4, 2, "dev0", "g98a7589.d20240318")
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[tox]
envlist = py39
isolated_build = True

[testenv]
deps = pytest
Expand Down

0 comments on commit add7329

Please sign in to comment.