build: reworked with setuptools
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
This commit is contained in:
28
Makefile
Normal file
28
Makefile
Normal file
@ -0,0 +1,28 @@
|
||||
VERSION=0.0.1
|
||||
VPPCFG:=vppcfg
|
||||
PYTHON?=python3
|
||||
PIP?=pip
|
||||
PIP_DEPENDS=build yamale netaddr pylint
|
||||
PIP_DEPENDS+=argparse pyyaml ipaddress pyinstaller black
|
||||
WHL_INSTALL=dist/$(VPPCFG)-$(VERSION)-py3-none-any.whl
|
||||
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
$(PYTHON) -m build
|
||||
|
||||
.PHONY: install-deps
|
||||
install-deps:
|
||||
sudo $(PIP) install $(PIP_DEPENDS)
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
sudo $(PIP) install $(WHL_INSTALL)
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
sudo $(PIP) uninstall $(VPPCFG)
|
||||
|
||||
.PHONY: wipe
|
||||
wipe:
|
||||
$(RM) -rf dist $(VPPCFG).egg-info
|
23
README.md
23
README.md
@ -13,21 +13,20 @@ If you're interested in helping, reach out to <pim at ipng dot ch> to disc
|
||||
This program expects Python3 and PIP to be installed. It's known to work on OpenBSD and Debian.
|
||||
|
||||
```
|
||||
sudo pip3 install argparse
|
||||
sudo pip3 install yamale
|
||||
sudo pip3 install pyyaml
|
||||
sudo pip3 install netaddr
|
||||
sudo pip3 install ipaddress
|
||||
sudo pip3 install pyinstaller
|
||||
sudo pip3 install black
|
||||
sudo pip3 install pylint
|
||||
## Install python build dependencies
|
||||
$ make install-deps
|
||||
|
||||
## Ensure all unittests pass.
|
||||
./tests.py -d -t unittest/yaml/*.yaml
|
||||
$ vppcfg/tests.py -d -t unittest/yaml/*.yaml
|
||||
|
||||
## Build vppcfg
|
||||
$ make build
|
||||
|
||||
## Install the tool with PIP
|
||||
$ make install
|
||||
|
||||
###
|
||||
|
||||
## Build the tool
|
||||
pyinstaller vppcfg.spec --onefile
|
||||
dist/vppcfg -h
|
||||
```
|
||||
|
||||
## Running
|
||||
|
17
pyproject.toml
Normal file
17
pyproject.toml
Normal file
@ -0,0 +1,17 @@
|
||||
[build-system]
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "vppcfg"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
'requests',
|
||||
'importlib-metadata; python_version<"3.8"',
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
vppcfg = "vppcfg:vppcfg.main"
|
||||
|
||||
[options]
|
||||
include_package_data = true
|
42
vppcfg.spec
42
vppcfg.spec
@ -1,42 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
block_cipher = None
|
||||
|
||||
|
||||
added_files = [ ( 'schema.yaml', '.') ]
|
||||
|
||||
a = Analysis(['vppcfg'],
|
||||
pathex=['/home/pim/src/vppcfg'],
|
||||
binaries=[],
|
||||
datas=added_files,
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False)
|
||||
pyz = PYZ(a.pure, a.zipped_data,
|
||||
cipher=block_cipher)
|
||||
|
||||
exe = EXE(pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='vppcfg',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=True,
|
||||
disable_windowed_traceback=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None )
|
9
vppcfg/__init__.py
Normal file
9
vppcfg/__init__.py
Normal file
@ -0,0 +1,9 @@
|
||||
import os, sys
|
||||
|
||||
ROOT_DIR = os.path.dirname(__file__)
|
||||
|
||||
# fix the module load path
|
||||
sys.path.insert(0, ROOT_DIR)
|
||||
|
||||
# fix the yaml search path
|
||||
os.chdir(ROOT_DIR)
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user