build: PEP 517 build with tox
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
This commit is contained in:
parent
8f9dc637ee
commit
451af45ded
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
[run]
|
||||
omit = vsg/tests/*
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
[flake8]
|
||||
max-line-length = 160
|
||||
ignore =
|
||||
# Whitespace before ':': conflict with black
|
||||
E203
|
||||
# Line break occurred before a binary operator: conflict with black
|
||||
W503
|
||||
|
|
@ -38,7 +38,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
|
|
|
|||
|
|
@ -13,30 +13,121 @@ on:
|
|||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
BUILD_PYTHON_FOR_BUILD: "3.10"
|
||||
BUILD_PYTHON_FOR_BUILD_ALIAS: "py310"
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ubuntu-latest
|
||||
dist:
|
||||
name: dist
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # cannot be shallow as version will not be generated
|
||||
- name: python.install
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.BUILD_PYTHON_FOR_BUILD }}
|
||||
- name: dependencies.install
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install tox
|
||||
- name: dist
|
||||
run: |
|
||||
tox -e wheel-${{ env.BUILD_PYTHON_FOR_BUILD_ALIAS }}
|
||||
- name: archive.upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
path: |
|
||||
dist/wheel-${{ env.BUILD_PYTHON_FOR_BUILD_ALIAS }}
|
||||
|
||||
style:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: python.install
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.BUILD_PYTHON_FOR_BUILD }}
|
||||
- name: dependencies.install
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install tox
|
||||
- name: test
|
||||
run: |
|
||||
tox -e style
|
||||
|
||||
docs:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: python.install
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.BUILD_PYTHON_FOR_BUILD }}
|
||||
- name: dependencies.install
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install tox
|
||||
- name: build
|
||||
run: |
|
||||
tox -e docs
|
||||
- name: archive.upload
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docs
|
||||
path: |
|
||||
build.out/docs
|
||||
|
||||
build:
|
||||
name: ${{ matrix.python-version }}-build
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
python-version:
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
- "3.11"
|
||||
- "3.12"
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: python -m unittest
|
||||
|
||||
- name: Generate Code Coverage Report
|
||||
- name: python.install ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: dependencies.install
|
||||
run: |
|
||||
pip install coverage
|
||||
coverage run -m unittest
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install tox
|
||||
- name: build
|
||||
run: |
|
||||
tox
|
||||
- name: Upload Coverage to Codecov
|
||||
uses: codecov/codecov-action@v1
|
||||
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
directory: build.out
|
||||
- name: archive.upload
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build.out-${{ matrix.python-version }}
|
||||
path: |
|
||||
build.out
|
||||
# - name: SonarCloud Scan
|
||||
# uses: SonarSource/sonarcloud-github-action@master
|
||||
# env:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ dist
|
|||
# Sphinx
|
||||
_build
|
||||
|
||||
# Tox
|
||||
.tox
|
||||
build.out/
|
||||
|
||||
# This version file should never be committed
|
||||
vsg/version_info.*
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.12.1
|
||||
hooks: []
|
||||
#- id: black
|
||||
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.13.2
|
||||
hooks: []
|
||||
#- id: isort
|
||||
|
||||
- repo: https://github.com/asottile/add-trailing-comma
|
||||
rev: v3.1.0
|
||||
hooks: []
|
||||
#- id: add-trailing-comma
|
||||
|
||||
# repeat as above changes may cause rework
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.12.1
|
||||
hooks: []
|
||||
#- id: black
|
||||
|
||||
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
||||
rev: v1.5.4
|
||||
hooks: []
|
||||
#- id: forbid-tabs
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.5.0
|
||||
hooks:
|
||||
- id: check-added-large-files
|
||||
- id: check-case-conflict
|
||||
#- id: check-json
|
||||
#- id: check-executables-have-shebangs
|
||||
#- id: check-shebang-scripts-are-executable
|
||||
- id: check-symlinks
|
||||
- id: check-toml
|
||||
- id: check-xml
|
||||
- id: check-yaml
|
||||
- id: debug-statements
|
||||
- id: destroyed-symlinks
|
||||
- id: detect-private-key
|
||||
- id: fix-byte-order-marker
|
||||
#- id: end-of-file-fixer
|
||||
#- id: trailing-whitespace
|
||||
#- id: fix-encoding-pragma
|
||||
|
||||
- repo: https://github.com/mgedmin/check-manifest
|
||||
rev: "0.49"
|
||||
hooks:
|
||||
- id: check-manifest
|
||||
additional_dependencies:
|
||||
- setuptools-git-versioning
|
||||
args:
|
||||
- --no-build-isolation
|
||||
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.2.6
|
||||
hooks: []
|
||||
#- id: codespell
|
||||
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 7.0.0
|
||||
hooks: []
|
||||
#- id: flake8
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
|
||||
test-warnings: false
|
||||
|
||||
disable:
|
||||
- prospector_N801
|
||||
- prospector_N802
|
||||
- prospector_N806
|
||||
|
||||
pep8:
|
||||
full: true
|
||||
disable:
|
||||
- N801
|
||||
- N802
|
||||
- N806
|
||||
|
||||
prospector:
|
||||
disable:
|
||||
- N801
|
||||
- N802
|
||||
- N806
|
||||
|
||||
|
|
@ -1,36 +1,12 @@
|
|||
# Read the Docs configuration file for Sphinx projects
|
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||
|
||||
# Required
|
||||
version: 2
|
||||
|
||||
# Set the OS, Python version and other tools you might need
|
||||
build:
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "3.11"
|
||||
# You can also specify other tool versions:
|
||||
# nodejs: "20"
|
||||
# rust: "1.70"
|
||||
# golang: "1.20"
|
||||
|
||||
# Build documentation in the "docs/" directory with Sphinx
|
||||
sphinx:
|
||||
configuration: docs/conf.py
|
||||
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
|
||||
# builder: "dirhtml"
|
||||
# Fail on all warnings to avoid broken references
|
||||
# fail_on_warning: true
|
||||
|
||||
# Optionally build your docs in additional formats such as PDF and ePub
|
||||
# formats:
|
||||
# - pdf
|
||||
# - epub
|
||||
|
||||
# Optional but recommended, declare the Python requirements required
|
||||
# to build your documentation
|
||||
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
||||
python:
|
||||
install:
|
||||
- requirements: docs/requirements.txt
|
||||
|
||||
commands:
|
||||
- pip install tox
|
||||
- tox -e docs
|
||||
|
|
|
|||
32
MANIFEST.in
32
MANIFEST.in
|
|
@ -1,3 +1,29 @@
|
|||
include README.rst
|
||||
include vsg/styles/*.yaml
|
||||
include vsg/vhdlFile/indent/*.yaml
|
||||
exclude setup.cfg
|
||||
include *.properties
|
||||
include .flake8
|
||||
include .gitattributes
|
||||
include .gitignore
|
||||
include .pre-commit-config.yaml
|
||||
include .pre-commit-hooks.yaml
|
||||
include .readthedocs.yaml
|
||||
include .travis.yml
|
||||
include CODE_OF_CONDUCT.md
|
||||
include bin/vsg
|
||||
include bin/vsg_parser
|
||||
include bin/vsg_rule_doc_gen
|
||||
include docs/conf.py
|
||||
include docs/example_configuration_json_file.json
|
||||
include tox.ini
|
||||
recursive-include .github *.md
|
||||
recursive-include .github *.yml
|
||||
recursive-include docs *.gif
|
||||
recursive-include docs *.png
|
||||
recursive-include docs *.rst
|
||||
recursive-include docs *.svg
|
||||
recursive-include tests *.json
|
||||
recursive-include tests *.py
|
||||
recursive-include tests *.rst
|
||||
recursive-include tests *.txt
|
||||
recursive-include tests *.vhd
|
||||
recursive-include tests *.xml
|
||||
recursive-include tests *.yaml
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
SPHINXPROJ = vhdl-style-guide
|
||||
SOURCEDIR = .
|
||||
BUILDDIR = _build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
.PHONY: help Makefile
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
|
@ -54,17 +54,14 @@ author = u'Jeremiah C Leary'
|
|||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = str(vsg.version.sVersion)
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = str(vsg.version.sVersion)
|
||||
version = vsg.version.get_version()
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
language = 'en'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
@ECHO OFF
|
||||
|
||||
pushd %~dp0
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set SOURCEDIR=.
|
||||
set BUILDDIR=_build
|
||||
set SPHINXPROJ=vhdl-style-guide
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.http://sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
|
||||
|
||||
:end
|
||||
popd
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
docutils<0.18
|
||||
sphinx_rtd_theme==1.1.1
|
||||
readthedocs-sphinx-search==0.3.2
|
||||
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
[build-system]
|
||||
requires = [
|
||||
"setuptools",
|
||||
"setuptools-git-versioning",
|
||||
"wheel",
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "vsg"
|
||||
description = "VHDL Style Guide"
|
||||
classifiers = [
|
||||
"Development Status :: 4 - Beta",
|
||||
"Environment :: Console",
|
||||
"Intended Audience :: End Users/Desktop",
|
||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||
"Natural Language :: English",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Topic :: Software Development :: Quality Assurance",
|
||||
"Topic :: Text Processing :: General",
|
||||
]
|
||||
keywords = [
|
||||
"beautify",
|
||||
"guide",
|
||||
"lint",
|
||||
"style",
|
||||
"vhdl",
|
||||
]
|
||||
dynamic = [
|
||||
"version",
|
||||
]
|
||||
readme = "README.rst"
|
||||
requires-python = ">=3.8"
|
||||
|
||||
dependencies = [
|
||||
"PyYAML>=5.1",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"pre-commit",
|
||||
"pylint",
|
||||
]
|
||||
tests = [
|
||||
"pytest",
|
||||
"pytest-cov",
|
||||
"pytest-html",
|
||||
"pytest-html-reporter",
|
||||
"pytest-xdist[psutil]",
|
||||
]
|
||||
docs = [
|
||||
"docutils",
|
||||
"readthedocs-sphinx-search",
|
||||
"sphinx",
|
||||
"sphinx_rtd_theme",
|
||||
]
|
||||
|
||||
[[project.authors]]
|
||||
name = "Jeremiah C Leary"
|
||||
email = "jeremiah.c.leary@gmail.com"
|
||||
|
||||
[project.license]
|
||||
file = "LICENSE"
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/jeremiah-c-leary/vhdl-style-guide"
|
||||
Download = "https://github.com/jeremiah-c-leary/vhdl-style-guide"
|
||||
|
||||
[project.scripts]
|
||||
vsg = "vsg.__main__:main"
|
||||
|
||||
[tool.setuptools-git-versioning]
|
||||
enabled = true
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
"vsg.rules" = [
|
||||
"*/preamble_doc.rst",
|
||||
]
|
||||
"vsg.styles" = [
|
||||
"*.yaml",
|
||||
]
|
||||
"vsg.styles.code_examples" = [
|
||||
"README.rst",
|
||||
]
|
||||
"vsg.vhdlFile.indent" = [
|
||||
"*.yaml",
|
||||
]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
exclude = [
|
||||
"bin*",
|
||||
"build*",
|
||||
"docs*",
|
||||
"tests*",
|
||||
]
|
||||
|
||||
[tool.black]
|
||||
line-length = 160
|
||||
|
||||
[tool.pylint.MASTER]
|
||||
disable = [
|
||||
"missing-class-docstring",
|
||||
"missing-function-docstring",
|
||||
"missing-module-docstring",
|
||||
]
|
||||
|
||||
[tool.pylint.FORMAT]
|
||||
max-line-length = 160
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
atomic = true
|
||||
combine_as_imports = true
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
addopts = [
|
||||
"--cov=vsg",
|
||||
"--import-mode=importlib",
|
||||
"--self-contained-html",
|
||||
"-n", "auto",
|
||||
"-ra",
|
||||
]
|
||||
pythonpath = [
|
||||
".",
|
||||
]
|
||||
testpaths = [
|
||||
"tests",
|
||||
]
|
||||
|
||||
[tool.coverage.run]
|
||||
parallel = true
|
||||
branch = true
|
||||
source = [
|
||||
"vsg",
|
||||
]
|
||||
data_file = "${COVERAGE_DATA_FILE-.coverage}"
|
||||
|
||||
[tool.coverage.report]
|
||||
show_missing = true
|
||||
|
||||
[tool.check-manifest]
|
||||
ignore = [
|
||||
"*.egg-info",
|
||||
"*.egg-info/*",
|
||||
"PKG-INFO",
|
||||
]
|
||||
ignore-default-rules = true
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
[metadata]
|
||||
description-file = README.rst
|
||||
|
||||
[pep8]
|
||||
max-line-length = 160
|
||||
|
||||
[pycodestyle]
|
||||
max-line-length = 160
|
||||
64
setup.py
64
setup.py
|
|
@ -1,64 +0,0 @@
|
|||
from setuptools import setup
|
||||
from setuptools import find_packages
|
||||
|
||||
### Implement Version information
|
||||
import os
|
||||
|
||||
from vsg import version
|
||||
from vsg import install
|
||||
|
||||
sVersionInfoFileName = os.path.join('vsg', 'version_info.py')
|
||||
|
||||
sVersion, sShaNum = version.get_version_info()
|
||||
|
||||
if install.installing_from_git_repo():
|
||||
try:
|
||||
os.remove(sVersionInfoFileName)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
if not os.path.exists(sVersionInfoFileName):
|
||||
install.create_version_info_file(sVersion, sShaNum)
|
||||
|
||||
|
||||
def readme():
|
||||
with open('README.rst') as f:
|
||||
return f.read()
|
||||
|
||||
setup(
|
||||
name='vsg',
|
||||
version=str(sVersion),
|
||||
description='VHDL Style Guide',
|
||||
long_description=readme(),
|
||||
classifiers=[
|
||||
'Development Status :: 4 - Beta',
|
||||
'Environment :: Console',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Intended Audience :: End Users/Desktop',
|
||||
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
|
||||
'Natural Language :: English',
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Topic :: Software Development :: Quality Assurance',
|
||||
'Topic :: Text Processing :: General',
|
||||
],
|
||||
url='https://github.com/jeremiah-c-leary/vhdl-style-guide',
|
||||
download_url='https://github.com/jeremiah-c-leary/vhdl-style-guide',
|
||||
author='Jeremiah C Leary',
|
||||
author_email='jeremiah.c.leary@gmail.com',
|
||||
license='GNU General Public License',
|
||||
packages=find_packages(),
|
||||
zip_safe=False,
|
||||
include_package_data=True,
|
||||
test_suite='nose.collector',
|
||||
tests_require=['nose'],
|
||||
keywords=['vhdl', 'style', 'beautify', 'guide', 'lint'],
|
||||
install_requires=[
|
||||
'PyYAML>=5.1'
|
||||
],
|
||||
python_requires='>=3.5',
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'vsg = vsg.__main__:main'
|
||||
]
|
||||
}
|
||||
)
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
[tox]
|
||||
minversion = 3.10
|
||||
isolated_build = True
|
||||
skip_missing_interpreters = True
|
||||
requires =
|
||||
tox-gh-actions
|
||||
envlist = # order is important
|
||||
style
|
||||
{test, wheel}-py3{8,9,10,11,12}
|
||||
|
||||
[gh-actions]
|
||||
python =
|
||||
3.8: {test}-py38
|
||||
3.9: {test}-py39
|
||||
3.10: {test}-py310
|
||||
3.11: {test}-py311
|
||||
3.12: {test}-py312
|
||||
|
||||
[testenv]
|
||||
setenv =
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||
PYTHONWARNINGS=default
|
||||
|
||||
[testenv:style]
|
||||
extras =
|
||||
dev
|
||||
commands =
|
||||
pre-commit run --all-files {posargs}
|
||||
|
||||
[testenv:test-py3{8,9,10,11,12}]
|
||||
extras =
|
||||
tests
|
||||
setenv =
|
||||
COVERAGE_DATA_FILE=build.out/.coverage.{basepython}
|
||||
commands =
|
||||
pytest \
|
||||
--cov-report=html:build.out/{envname}/coverage \
|
||||
--cov-report=xml:build.out/{envname}/coverage.xml \
|
||||
--html-report=build.out/{envname}/report/pytest-report.html \
|
||||
--html=build.out/{envname}/test/pytest.html \
|
||||
{posargs:tests}
|
||||
|
||||
[testenv:lint-py3{8,9,10,11,12}]
|
||||
extras =
|
||||
dev
|
||||
commands =
|
||||
pylint \
|
||||
vsg \
|
||||
tests
|
||||
|
||||
[testenv:wheel-py3{8,9,10,11,12}]
|
||||
package = skip
|
||||
deps =
|
||||
build
|
||||
commands =
|
||||
python -m build \
|
||||
--wheel \
|
||||
--outdir=dist/{envname} \
|
||||
.
|
||||
|
||||
[testenv:docs]
|
||||
extras =
|
||||
docs
|
||||
commands =
|
||||
sphinx-build docs {env:READTHEDOCS_OUTPUT:build.out/{envname}}/html {env:SPHINXOPTS:}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
|
||||
import os
|
||||
|
||||
|
||||
def installing_from_git_repo():
|
||||
sPath = os.path.dirname(__file__)
|
||||
if os.path.isdir(os.path.join(sPath, '..', '.git')):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def create_version_info_file(sVersion, sShaNum):
|
||||
sVersionInfoFileName = os.path.join(os.path.dirname(__file__), 'version_info.py')
|
||||
|
||||
lVersionInfo = []
|
||||
lVersionInfo.append('sVersion = \'' + str(sVersion) + "'")
|
||||
lVersionInfo.append('sShaNum = \'' + str(sShaNum) + "'")
|
||||
|
||||
with open(sVersionInfoFileName, 'w') as oFile:
|
||||
for sLine in lVersionInfo:
|
||||
oFile.write(sLine + '\n')
|
||||
oFile.close()
|
||||
|
|
@ -1,73 +1,22 @@
|
|||
import importlib.metadata
|
||||
from pathlib import Path
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
sVersion = '3.22.0'
|
||||
# @functools.cache # uncomment when minimum python >= 3.10
|
||||
def get_distribution() -> importlib.metadata.Distribution:
|
||||
try:
|
||||
distribution = importlib.metadata.distribution("vsg")
|
||||
except importlib.metadata.PackageNotFoundError:
|
||||
distribution = importlib.metadata.PathDistribution(path=Path())
|
||||
return distribution
|
||||
|
||||
|
||||
# @functools.cache # uncomment when minimum python >= 3.10
|
||||
def get_version() -> str:
|
||||
return get_distribution().version or "DEVELOP"
|
||||
|
||||
|
||||
def print_version(oCommandLineArguments):
|
||||
|
||||
if (oCommandLineArguments.version):
|
||||
|
||||
sVersion, sShaNum = get_version_info()
|
||||
|
||||
print('VHDL Style Guide (VSG) version: ' + str(sVersion))
|
||||
|
||||
print('Git commit SHA: ' + str(sShaNum))
|
||||
|
||||
print('VHDL Style Guide (VSG) version: ' + get_version())
|
||||
exit(0)
|
||||
|
||||
|
||||
def get_version_info():
|
||||
|
||||
sVersion = '3.22.0'
|
||||
|
||||
if reporting_from_zip_file():
|
||||
return sVersion + '+zip.file', 'Unknown. Installed via zip file.'
|
||||
|
||||
if installed():
|
||||
from vsg import version_info
|
||||
return version_info.sVersion, version_info.sShaNum
|
||||
|
||||
if reporting_from_git_repo():
|
||||
sReturnPath = os.getcwd()
|
||||
sPath = os.path.dirname(__file__)
|
||||
os.chdir(sPath)
|
||||
lVersion = "0" # version if no tags (shallow checkout)
|
||||
try:
|
||||
lActual = subprocess.check_output(['git', 'describe', '--tags'])
|
||||
lActual = str(lActual.decode('utf-8')).split('\n')
|
||||
lVersion = lActual[0].split('-')
|
||||
sVersion = str(lVersion[0]) + '.dev' + str(lVersion[1])
|
||||
sShaNum = str(lVersion[-1][1:])
|
||||
except (IndexError, subprocess.CalledProcessError):
|
||||
sVersion = str(lVersion[0])
|
||||
lActual = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])
|
||||
lActual = str(lActual.decode('utf-8')).split('\n')
|
||||
sShaNum = str(lActual[0])
|
||||
os.chdir(sReturnPath)
|
||||
return sVersion, sShaNum
|
||||
|
||||
|
||||
def reporting_from_git_repo():
|
||||
sPath = os.path.dirname(__file__)
|
||||
if os.path.isdir(os.path.join(sPath, '..', '.git')):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def installed():
|
||||
if not reporting_from_git_repo() and version_info_file_exists():
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def reporting_from_zip_file():
|
||||
if not reporting_from_git_repo() and not installed():
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def version_info_file_exists():
|
||||
sVersionInfoFileName = os.path.join('vsg', 'version_info.py')
|
||||
return os.path.exists(sVersionInfoFileName)
|
||||
|
|
|
|||
Loading…
Reference in New Issue