Skip to content

Commit

Permalink
setup: consolidate dist-minimal in the noxfile
Browse files Browse the repository at this point in the history
  • Loading branch information
svinota committed Mar 14, 2023
1 parent a012696 commit 016111d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
11 changes: 1 addition & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,7 @@ dist: setup

.PHONY: dist-minimal
dist-minimal: setup
# backup original files
mv -f setup.cfg .setup.cfg.orig
mv -f pyroute2/__init__.py .init.py.orig
# replace with the minimal package
cp -f setup.minimal.cfg setup.cfg
cp -f pyroute2/minimal.py pyroute2/__init__.py
$(call nox,-e build)
# restore the original files
mv -f setup.cfg.orig setup.cfg
mv -f .init.py.orig pyroute2/__init__.py
$(call nox,-e build_minimal)

.PHONY: install
install: setup
Expand Down
13 changes: 11 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,15 @@ def setup_venv_minimal(session, config):
session.install('twine')
session.install('-r', 'requirements.dev.txt')
session.install('-r', 'requirements.docs.txt')
session.run('mv', '-f', 'setup.cfg', 'setup.cfg.orig', external=True)
session.run('mv', '-f', 'setup.cfg', '.setup.cfg.orig', external=True)
session.run('mv', '-f', 'pyroute2/__init__.py', '.init.py.orig', external=True)
session.run('cp', 'setup.minimal.cfg', 'setup.cfg', external=True)
session.run('cp', 'pyroute2/minimal.py', 'pyroute2/__init__.py', external=True)
session.run('python', '-m', 'build')
session.run('python', '-m', 'twine', 'check', 'dist/*')
session.install('.')
session.run('mv', '-f', 'setup.cfg.orig', 'setup.cfg', external=True)
session.run('mv', '-f', '.setup.cfg.orig', 'setup.cfg', external=True)
session.run('mv', '-f', '.init.py.orig', 'pyroute2/__init__.py', external=True)
tmpdir = os.path.abspath(session.create_tmp())
session.run('cp', '-a', 'lab', tmpdir, external=True)
session.run('cp', '-a', 'tests', tmpdir, external=True)
Expand Down Expand Up @@ -311,3 +314,9 @@ def build(session):
session.install('twine')
session.run('python', '-m', 'build')
session.run('python', '-m', 'twine', 'check', 'dist/*')

@nox.session
@add_session_config
def build_minimal(session, config):
'''Build the minimal package'''
setup_venv_minimal(session, config)

0 comments on commit 016111d

Please sign in to comment.