Antilint
This commit is contained in:
parent
f5f9ae6ef9
commit
93678709c7
@ -232,9 +232,7 @@ def convert_textx_recipe(txrecipe_or_subblock, parent: Optional[MenuBlock]):
|
||||
elif isinstance(directive, scoml_classes["IfSetDirective"]):
|
||||
var = directive.variable
|
||||
assert isinstance(var, str)
|
||||
recipe.control_directives.append(
|
||||
IfSetDirective(var)
|
||||
)
|
||||
recipe.control_directives.append(IfSetDirective(var))
|
||||
else:
|
||||
raise ValueError(f"Unknown directive {directive}")
|
||||
|
||||
@ -282,9 +280,7 @@ def convert_textx_block(txblock, parent: Optional[MenuBlock]) -> MenuBlock:
|
||||
elif isinstance(directive, scoml_classes["IfSetDirective"]):
|
||||
var = directive.variable
|
||||
assert isinstance(var, str)
|
||||
block.control_directives.append(
|
||||
IfSetDirective(var)
|
||||
)
|
||||
block.control_directives.append(IfSetDirective(var))
|
||||
elif isinstance(directive, scoml_classes["ImportDirective"]):
|
||||
block.import_directives.append(directive.importee)
|
||||
elif isinstance(directive, scoml_classes["ResourceEdgeDirective"]):
|
||||
@ -469,7 +465,9 @@ class MenuLoader:
|
||||
assert applicable_user is not None
|
||||
|
||||
sous_vars = self._head.variables[sous]
|
||||
for context_vars, for_indices in self._control_apply(fors, sous_vars, tuple()):
|
||||
for context_vars, for_indices in self._control_apply(
|
||||
fors, sous_vars, tuple()
|
||||
):
|
||||
context = RecipeContext(
|
||||
sous=sous,
|
||||
user=applicable_user,
|
||||
@ -663,7 +661,10 @@ class MenuLoader:
|
||||
)
|
||||
|
||||
def _control_apply(
|
||||
self, controls: Tuple[ControlDirective, ...], vars: "Variables", accum: Tuple[int, ...]
|
||||
self,
|
||||
controls: Tuple[ControlDirective, ...],
|
||||
vars: "Variables",
|
||||
accum: Tuple[int, ...],
|
||||
) -> Iterable[Tuple["Variables", Tuple[int, ...]]]:
|
||||
if not controls:
|
||||
yield vars, accum
|
||||
|
@ -118,7 +118,9 @@ class Variables:
|
||||
elif isinstance(current, list):
|
||||
current = current[int(k)]
|
||||
else:
|
||||
raise ValueError(f"non-dictionary, non-list encountered when getting {name}")
|
||||
raise ValueError(
|
||||
f"non-dictionary, non-list encountered when getting {name}"
|
||||
)
|
||||
|
||||
return current
|
||||
except KeyError:
|
||||
|
80
setup.py
80
setup.py
@ -12,13 +12,13 @@ from shutil import rmtree
|
||||
from setuptools import find_packages, setup, Command
|
||||
|
||||
# Package meta-data.
|
||||
NAME = 'scone'
|
||||
DESCRIPTION = 'Simple CONfiguration Engine'
|
||||
URL = 'https://librepush.net/project/scone'
|
||||
EMAIL = 'rei@librepush.net'
|
||||
AUTHOR = 'Olivier \'reivilibre\''
|
||||
REQUIRES_PYTHON = '>=3.7.0'
|
||||
VERSION = '0.1.0'
|
||||
NAME = "scone"
|
||||
DESCRIPTION = "Simple CONfiguration Engine"
|
||||
URL = "https://librepush.net/project/scone"
|
||||
EMAIL = "rei@librepush.net"
|
||||
AUTHOR = "Olivier 'reivilibre'"
|
||||
REQUIRES_PYTHON = ">=3.7.0"
|
||||
VERSION = "0.1.0"
|
||||
|
||||
# What packages are required for this module to be executed?
|
||||
REQUIRED = [
|
||||
@ -28,7 +28,7 @@ REQUIRED = [
|
||||
"attrs~=19.3.0",
|
||||
"cattrs~=1.0.0",
|
||||
"canonicaljson~=1.2.0",
|
||||
"immutabledict==1.0.0"
|
||||
"immutabledict==1.0.0",
|
||||
]
|
||||
|
||||
|
||||
@ -49,14 +49,13 @@ EXTRAS = {
|
||||
"aiosqlite~=0.15.0",
|
||||
"requests",
|
||||
"Jinja2",
|
||||
"typeguard"
|
||||
"typeguard",
|
||||
],
|
||||
"sous": EX_SOUS_ALL,
|
||||
"sous-core": EX_SOUS_BASE,
|
||||
"sous-pg": EX_SOUS_PG,
|
||||
"sous-mysql": EX_SOUS_MYSQL,
|
||||
|
||||
"docker": ["docker"] # TODO do this more properly if we can...
|
||||
"docker": ["docker"], # TODO do this more properly if we can...
|
||||
}
|
||||
|
||||
# The rest you shouldn't have to touch too much :)
|
||||
@ -69,8 +68,8 @@ here = os.path.abspath(os.path.dirname(__file__))
|
||||
# Import the README and use it as the long-description.
|
||||
# Note: this will only work if 'README.md' is present in your MANIFEST.in file!
|
||||
try:
|
||||
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
|
||||
long_description = '\n' + f.read()
|
||||
with io.open(os.path.join(here, "README.md"), encoding="utf-8") as f:
|
||||
long_description = "\n" + f.read()
|
||||
except FileNotFoundError:
|
||||
long_description = DESCRIPTION
|
||||
|
||||
@ -78,22 +77,22 @@ except FileNotFoundError:
|
||||
about = {}
|
||||
if not VERSION:
|
||||
project_slug = NAME.lower().replace("-", "_").replace(" ", "_")
|
||||
with open(os.path.join(here, project_slug, '__version__.py')) as f:
|
||||
with open(os.path.join(here, project_slug, "__version__.py")) as f:
|
||||
exec(f.read(), about)
|
||||
else:
|
||||
about['__version__'] = VERSION
|
||||
about["__version__"] = VERSION
|
||||
|
||||
|
||||
class UploadCommand(Command):
|
||||
"""Support setup.py upload."""
|
||||
|
||||
description = 'Build and publish the package.'
|
||||
description = "Build and publish the package."
|
||||
user_options = []
|
||||
|
||||
@staticmethod
|
||||
def status(s):
|
||||
"""Prints things in bold."""
|
||||
print('\033[1m{0}\033[0m'.format(s))
|
||||
print("\033[1m{0}\033[0m".format(s))
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
@ -103,20 +102,20 @@ class UploadCommand(Command):
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
self.status('Removing previous builds…')
|
||||
rmtree(os.path.join(here, 'dist'))
|
||||
self.status("Removing previous builds…")
|
||||
rmtree(os.path.join(here, "dist"))
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
self.status('Building Source and Wheel (universal) distribution…')
|
||||
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
|
||||
self.status("Building Source and Wheel (universal) distribution…")
|
||||
os.system("{0} setup.py sdist bdist_wheel --universal".format(sys.executable))
|
||||
|
||||
self.status('Uploading the package to PyPI via Twine…')
|
||||
os.system('twine upload dist/*')
|
||||
self.status("Uploading the package to PyPI via Twine…")
|
||||
os.system("twine upload dist/*")
|
||||
|
||||
self.status('Pushing git tags…')
|
||||
os.system('git tag v{0}'.format(about['__version__']))
|
||||
os.system('git push --tags')
|
||||
self.status("Pushing git tags…")
|
||||
os.system("git tag v{0}".format(about["__version__"]))
|
||||
os.system("git push --tags")
|
||||
|
||||
sys.exit()
|
||||
|
||||
@ -124,10 +123,10 @@ class UploadCommand(Command):
|
||||
# Where the magic happens:
|
||||
setup(
|
||||
name=NAME,
|
||||
version=about['__version__'],
|
||||
version=about["__version__"],
|
||||
description=DESCRIPTION,
|
||||
long_description=long_description,
|
||||
long_description_content_type='text/markdown',
|
||||
long_description_content_type="text/markdown",
|
||||
author=AUTHOR,
|
||||
author_email=EMAIL,
|
||||
python_requires=REQUIRES_PYTHON,
|
||||
@ -135,12 +134,11 @@ setup(
|
||||
packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]),
|
||||
# If your package is a single module, use this instead of 'packages':
|
||||
# py_modules=['mypackage'],
|
||||
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'scone=scone.head.cli:cli',
|
||||
'scone-freezer=scone.head.cli.freezer:cli',
|
||||
'michelin=scone.head.cli.michelin:cli'
|
||||
"console_scripts": [
|
||||
"scone=scone.head.cli:cli",
|
||||
"scone-freezer=scone.head.cli.freezer:cli",
|
||||
"michelin=scone.head.cli.michelin:cli",
|
||||
],
|
||||
},
|
||||
install_requires=REQUIRED,
|
||||
@ -150,14 +148,12 @@ setup(
|
||||
classifiers=[
|
||||
# Trove classifiers
|
||||
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: Implementation :: CPython',
|
||||
'Programming Language :: Python :: Implementation :: PyPy'
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
"Programming Language :: Python :: Implementation :: PyPy",
|
||||
],
|
||||
# $ setup.py publish support.
|
||||
cmdclass={
|
||||
'upload': UploadCommand,
|
||||
},
|
||||
)
|
||||
cmdclass={"upload": UploadCommand,},
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user