mirror of
https://github.com/jongracecox/anybadge.git
synced 2025-07-21 04:11:05 +02:00
- Add `--version` to cli - Add invoke tasks: - `package.build` - `package.install` - `test.cli` - Refactor invoke task implementation - Refactor `run_pypi_tests.sh` - Split into separate files to support running locally
31 lines
788 B
Python
31 lines
788 B
Python
import subprocess
|
|
from pathlib import Path
|
|
|
|
from invoke import task
|
|
|
|
PROJECT_DIR = Path(__file__).parent.parent
|
|
|
|
|
|
def run_build():
|
|
subprocess.run(["python", "setup.py", "bdist_wheel"])
|
|
|
|
|
|
@task
|
|
def build(c):
|
|
"""Build the package and write wheel to 'dist/' directory."""
|
|
print("Building package...")
|
|
run_build()
|
|
|
|
|
|
@task
|
|
def install(c):
|
|
"""Install the locally built version from 'dist/'."""
|
|
print("Installing package...")
|
|
file_list = list((Path(PROJECT_DIR) / Path("dist")).glob("anybadge-*.whl"))
|
|
if len(file_list) > 1:
|
|
print("Not sure which dist package to install. Clean dist directory first.")
|
|
return
|
|
dist_file = file_list[0]
|
|
print(f"Installing: {dist_file}")
|
|
subprocess.run(["pip", "install", "--force-reinstall", dist_file])
|