kopia lustrzana https://github.com/jedie/PyInventory
Merge pull request #42 from jedie/update-bootstrap
Update own bootstrap file from dev-shell via testspull/44/head
commit
ad5c8a8285
12
devshell.py
12
devshell.py
|
@ -5,6 +5,12 @@
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Just call this file, and the magic happens ;)
|
Just call this file, and the magic happens ;)
|
||||||
|
|
||||||
|
This file is from: https://pypi.org/project/dev-shell/
|
||||||
|
Source: https://github.com/jedie/dev-shell/blob/main/devshell.py
|
||||||
|
|
||||||
|
:copyleft: 2021 by Jens Diemer
|
||||||
|
:license: GNU GPL v3 or above
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -30,11 +36,11 @@ assert sys.version_info >= (3, 7), 'Python version is too old!'
|
||||||
|
|
||||||
|
|
||||||
if sys.platform == 'win32': # wtf
|
if sys.platform == 'win32': # wtf
|
||||||
# Files under Windows, e.g.: .../.venv/Scripts/python3.exe
|
# Files under Windows, e.g.: .../.venv/Scripts/python.exe
|
||||||
BIN_NAME = 'Scripts'
|
BIN_NAME = 'Scripts'
|
||||||
FILE_EXT = '.exe'
|
FILE_EXT = '.exe'
|
||||||
else:
|
else:
|
||||||
# Files under Linux/Mac and all other than Windows, e.g.: .../.venv/bin/python3
|
# Files under Linux/Mac and all other than Windows, e.g.: .../.venv/bin/python
|
||||||
BIN_NAME = 'bin'
|
BIN_NAME = 'bin'
|
||||||
FILE_EXT = ''
|
FILE_EXT = ''
|
||||||
|
|
||||||
|
@ -84,6 +90,8 @@ def noop_signal_handler(signal_num, frame):
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
|
assert DEP_LOCK_PATH.is_file(), f'File not found: "{DEP_LOCK_PATH}" !'
|
||||||
|
|
||||||
if len(argv) == 2 and argv[1] in ('--update', '--help'):
|
if len(argv) == 2 and argv[1] in ('--update', '--help'):
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog=Path(__file__).name,
|
prog=Path(__file__).name,
|
||||||
|
|
|
@ -220,7 +220,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dev-shell"
|
name = "dev-shell"
|
||||||
version = "0.2.0"
|
version = "0.2.2"
|
||||||
description = "Devloper shell for easy startup..."
|
description = "Devloper shell for easy startup..."
|
||||||
category = "dev"
|
category = "dev"
|
||||||
optional = false
|
optional = false
|
||||||
|
@ -574,7 +574,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "importlib-metadata"
|
name = "importlib-metadata"
|
||||||
version = "3.10.0"
|
version = "3.10.1"
|
||||||
description = "Read metadata from Python packages"
|
description = "Read metadata from Python packages"
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = false
|
||||||
|
@ -1362,7 +1362,7 @@ postgres = ["psycopg2-binary"]
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = ">=3.7,<4.0.0"
|
python-versions = ">=3.7,<4.0.0"
|
||||||
content-hash = "fe3bc4d98ff9858f87a8887cf0269034b5e5cf55f223815365b81d2d43a8e9ac"
|
content-hash = "8d8786dc29411ab6dabaeeb1105cd3a1c96c5549dedb9e7c00acd840c26095d4"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
appdirs = [
|
appdirs = [
|
||||||
|
@ -1542,8 +1542,8 @@ defusedxml = [
|
||||||
{file = "defusedxml-0.7.1.tar.gz", hash = "sha256:1bb3032db185915b62d7c6209c5a8792be6a32ab2fedacc84e01b52c51aa3e69"},
|
{file = "defusedxml-0.7.1.tar.gz", hash = "sha256:1bb3032db185915b62d7c6209c5a8792be6a32ab2fedacc84e01b52c51aa3e69"},
|
||||||
]
|
]
|
||||||
dev-shell = [
|
dev-shell = [
|
||||||
{file = "dev-shell-0.2.0.tar.gz", hash = "sha256:a200fc8a7ea65feb111126afb73a3d7a279aa782d41a21997694c9a3b3d784be"},
|
{file = "dev-shell-0.2.2.tar.gz", hash = "sha256:a1791912db2acbec34f45f2d0ca78bdab08f06ae14653b11b3942b956a1874b6"},
|
||||||
{file = "dev_shell-0.2.0-py3-none-any.whl", hash = "sha256:7628b0d60d803a9be49be8e1bfbcdb50832a95d74b606dc418d7c3e4277f445b"},
|
{file = "dev_shell-0.2.2-py3-none-any.whl", hash = "sha256:e544346f6c658911dba1dcd7bd1448273b633fad9ebd207ed4d282130a8fee69"},
|
||||||
]
|
]
|
||||||
diff-match-patch = [
|
diff-match-patch = [
|
||||||
{file = "diff-match-patch-20200713.tar.gz", hash = "sha256:da6f5a01aa586df23dfc89f3827e1cafbb5420be9d87769eeb079ddfd9477a18"},
|
{file = "diff-match-patch-20200713.tar.gz", hash = "sha256:da6f5a01aa586df23dfc89f3827e1cafbb5420be9d87769eeb079ddfd9477a18"},
|
||||||
|
@ -1669,8 +1669,8 @@ idna = [
|
||||||
{file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"},
|
{file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"},
|
||||||
]
|
]
|
||||||
importlib-metadata = [
|
importlib-metadata = [
|
||||||
{file = "importlib_metadata-3.10.0-py3-none-any.whl", hash = "sha256:d2d46ef77ffc85cbf7dac7e81dd663fde71c45326131bea8033b9bad42268ebe"},
|
{file = "importlib_metadata-3.10.1-py3-none-any.whl", hash = "sha256:2ec0faae539743ae6aaa84b49a169670a465f7f5d64e6add98388cc29fd1f2f6"},
|
||||||
{file = "importlib_metadata-3.10.0.tar.gz", hash = "sha256:c9db46394197244adf2f0b08ec5bc3cf16757e9590b02af1fca085c16c0d600a"},
|
{file = "importlib_metadata-3.10.1.tar.gz", hash = "sha256:c9356b657de65c53744046fa8f7358afe0714a1af7d570c00c3835c2d724a7c1"},
|
||||||
]
|
]
|
||||||
iniconfig = [
|
iniconfig = [
|
||||||
{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
|
{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
|
||||||
|
|
|
@ -61,12 +61,12 @@ docker = ["docker-compose"]
|
||||||
postgres = ["psycopg2-binary"]
|
postgres = ["psycopg2-binary"]
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
dev_shell = "*" # https://github.com/jedie/dev-shell
|
dev_shell = ">=0.2.2" # https://github.com/jedie/dev-shell
|
||||||
poetry-publish = "*" # https://github.com/jedie/poetry-publish
|
poetry-publish = "*" # https://github.com/jedie/poetry-publish
|
||||||
python-creole = "*" # https://github.com/jedie/python-creole
|
python-creole = "*" # https://github.com/jedie/python-creole
|
||||||
tox = "*"
|
tox = "*"
|
||||||
pytest = "*"
|
pytest = "*"
|
||||||
pytest-randomly = "!=3.6.0" # https://github.com/python-poetry/poetry/issues/2372#issuecomment-812558146
|
pytest-randomly = "*"
|
||||||
pytest-cov = "*"
|
pytest-cov = "*"
|
||||||
pytest-django = "*"
|
pytest-django = "*"
|
||||||
pytest-parallel = "*"
|
pytest-parallel = "*"
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
import filecmp
|
||||||
|
import shutil
|
||||||
|
from pathlib import Path
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
import dev_shell
|
||||||
|
from dev_shell.utils.assertion import assert_is_file
|
||||||
|
|
||||||
|
from inventory_project.dev_shell import PACKAGE_ROOT
|
||||||
|
|
||||||
|
|
||||||
|
class BootstrapTestCase(TestCase):
|
||||||
|
def test_our_bootstrap_is_up2date(self):
|
||||||
|
source_file_path = Path(dev_shell.__file__).parent / 'bootstrap-source.py'
|
||||||
|
assert_is_file(source_file_path)
|
||||||
|
|
||||||
|
own_bootstrap_file = PACKAGE_ROOT / 'devshell.py'
|
||||||
|
assert_is_file(own_bootstrap_file)
|
||||||
|
|
||||||
|
are_the_same = filecmp.cmp(source_file_path, own_bootstrap_file, shallow=False)
|
||||||
|
if not are_the_same:
|
||||||
|
shutil.copyfile(
|
||||||
|
src=source_file_path,
|
||||||
|
dst=own_bootstrap_file,
|
||||||
|
follow_symlinks=False
|
||||||
|
)
|
||||||
|
raise AssertionError(f'Bootstrap "{own_bootstrap_file}" updated!')
|
Ładowanie…
Reference in New Issue