fsfwgen is a package now

This commit is contained in:
Robin Mueller 2022-03-11 11:35:47 +01:00
parent c5ef1783a3
commit aec15d0961
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
21 changed files with 112 additions and 0 deletions

5
fsfwgen/__init__.py Normal file
View File

@ -0,0 +1,5 @@
VERSION_MAJOR = 0
VERSION_MINOR = 1
VERSION_REVISION = 0
__version__ = "0.1.0"

39
lint.py Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env python3
import os
import sys
def main():
exclude_dirs_flag = ""
if not os.path.exists("setup.cfg"):
exclude_dirs_flag = (
"--exclude .git,__pycache__,docs/conf.py,old,build,dist,venv"
)
additional_flags_both_steps = "--count --statistics"
additional_flags_first_step = "--select=E9,F63,F7,F82 --show-source"
flake8_first_step_cmd = (
f"flake8 . {additional_flags_both_steps} "
f"{additional_flags_first_step} {exclude_dirs_flag}"
)
status = os.system(flake8_first_step_cmd)
if os.name == "nt":
if status != 0:
print(f"Flake8 linter errors with status {status}")
else:
if os.WEXITSTATUS(status) != 0:
print(f"Flake8 linter errors with status {status}")
sys.exit(0)
additional_flags_second_step = (
'--exit-zero --max-complexity=10 --per-file-ignores="__init__.py:F401"'
)
if not os.path.exists("setup.cfg"):
additional_flags_second_step += " --max-line-length=100"
flake8_second_step_cmd = (
f"flake8 . {additional_flags_both_steps} {additional_flags_second_step}"
f" {exclude_dirs_flag}"
)
os.system(flake8_second_step_cmd)
if __name__ == "__main__":
main()

6
pyproject.toml Normal file
View File

@ -0,0 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"

50
setup.cfg Normal file
View File

@ -0,0 +1,50 @@
[metadata]
name = fsfwgen
description = FSFW Generator Core
version = attr: fsfwgen.__version__
long_description = file: README.md, NOTICE
long_description_content_type = text/markdown
license = Apache-2.0
author = Robin Mueller
author_email = muellerr@irs.uni-stuttgart.de
platform = any
url = https://egit.irs.uni-stuttgart.de/fsfw/fsfwgen
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Natural Language :: English
Operating System :: POSIX
Operating System :: Microsoft :: Windows
Programming Language :: Python :: 3
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Topic :: Communications
Topic :: Software Development :: Libraries
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Scientific/Engineering
[options]
install_requires =
colorlog>=6.0.0
package_dir =
= .
packages = find:
python_requires = >=3.8
[flake8]
max-line-length = 100
ignore = D203, W503
exclude =
.git,
__pycache__,
docs/conf.py,
old,
build,
dist,
venv
max-complexity = 10
extend-ignore =
# See https://github.com/PyCQA/pycodestyle/issues/373
E203,

12
setup.py Normal file
View File

@ -0,0 +1,12 @@
#!/usr/bin/python3
"""
We do the package handling in the static setup.cfg but include an empty setup.py
to allow editable installs https://packaging.python.org/tutorials/packaging-projects/
and provide extensibility
"""
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup()

View File