Browse Source
cli: bootstrap a cli that does nothing but tests ok
keep-around/fc4da7e162326c896a399d617ed2c2fc73cb0fbd
cli: bootstrap a cli that does nothing but tests ok
keep-around/fc4da7e162326c896a399d617ed2c2fc73cb0fbd

No known key found for this signature in database
GPG Key ID: 900857755EF189C2
18 changed files with 315 additions and 11 deletions
-
7.dockerignore
-
5.gitignore
-
2.gitlab-ci.yml
-
0enough/cli/__init__.py
-
12enough/cli/create.py
-
26enough/cmd.py
-
9enough/common/data/base.dockerfile
-
9enough/version.py
-
7requirements-dev.in
-
117requirements-dev.txt
-
8requirements.in
-
22requirements.txt
-
44setup.cfg
-
8setup.py
-
7tests/enough/test_cmd.py
-
14tests/run-tests.sh
-
6tests/tox.dockerfile
-
23tox.ini
@ -0,0 +1,7 @@ |
|||
.git |
|||
.tox |
|||
venv |
|||
.eggs |
|||
**/__pycache__ |
|||
**/*.pyc |
|||
**/*.pyo |
@ -0,0 +1,2 @@ |
|||
jobs: |
|||
script: tests/run-tests.sh |
@ -0,0 +1,12 @@ |
|||
from cliff.command import Command |
|||
|
|||
|
|||
class Create(Command): |
|||
"Create" |
|||
|
|||
def get_parser(self, prog_name): |
|||
parser = super(Create, self).get_parser(prog_name) |
|||
return parser |
|||
|
|||
def take_action(self, parsed_args): |
|||
print("OK") |
@ -0,0 +1,26 @@ |
|||
import sys |
|||
|
|||
from cliff.app import App |
|||
from cliff.commandmanager import CommandManager |
|||
|
|||
from enough.version import __version__ |
|||
|
|||
|
|||
class EnoughApp(App): |
|||
|
|||
def __init__(self): |
|||
super(EnoughApp, self).__init__( |
|||
description='enough', |
|||
version=__version__, |
|||
command_manager=CommandManager('enough.cli'), |
|||
deferred_help=True, |
|||
) |
|||
|
|||
|
|||
def main(argv=sys.argv[1:]): |
|||
myapp = EnoughApp() |
|||
return myapp.run(argv) |
|||
|
|||
|
|||
if __name__ == '__main__': |
|||
sys.exit(main(sys.argv[1:])) |
@ -0,0 +1,9 @@ |
|||
FROM debian:buster |
|||
|
|||
RUN apt-get update && \ |
|||
apt-get install --quiet -y curl virtualenv python2 gcc libssl-dev python-dev make |
|||
RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh |
|||
|
|||
WORKDIR /opt |
|||
RUN virtualenv venv |
|||
ENV PATH="/opt/venv/bin:${PATH}" |
@ -0,0 +1,9 @@ |
|||
import pbr.version |
|||
|
|||
__all__ = ['__version__'] |
|||
|
|||
version_info = pbr.version.VersionInfo('enough') |
|||
try: |
|||
__version__ = version_info.version_string() |
|||
except AttributeError: |
|||
__version__ = None |
@ -0,0 +1,7 @@ |
|||
tox>=3.5 |
|||
pip-tools>=3.1 |
|||
pytest>=4.0.1 |
|||
pytest_mock>=1.10 |
|||
flake8>=3.5 |
|||
coverage>=4.5 |
|||
sphinx>=1.8.2 |
@ -0,0 +1,117 @@ |
|||
# |
|||
# This file is autogenerated by pip-compile |
|||
# To update, run: |
|||
# |
|||
# pip-compile --output-file requirements-dev.txt requirements.in requirements-dev.in |
|||
# |
|||
-e git+https://github.com/fmnisme/python-icinga2api.git@9a1a3cc7968d6c72bf49e97ef387b2824e6835e9#egg=icinga2api |
|||
alabaster==0.7.12 # via sphinx |
|||
ansible-lint==3.4.23 # via molecule |
|||
ansible==2.7.5 |
|||
anyconfig==0.9.4 # via molecule |
|||
appdirs==1.4.3 # via openstacksdk |
|||
arrow==0.12.1 # via jinja2-time |
|||
asn1crypto==0.24.0 # via cryptography |
|||
atomicwrites==1.2.1 # via pytest |
|||
attrs==18.2.0 # via pytest |
|||
babel==2.6.0 # via sphinx |
|||
backports.functools-lru-cache==1.5 # via arrow |
|||
bcrypt==3.1.5 # via paramiko |
|||
binaryornot==0.4.4 # via cookiecutter |
|||
cerberus==1.2 # via molecule |
|||
certifi==2018.11.29 # via requests |
|||
cffi==1.11.5 # via bcrypt, cryptography, pynacl |
|||
chardet==3.0.4 # via binaryornot, requests |
|||
click-completion==0.3.1 # via molecule |
|||
click==6.7 # via click-completion, cookiecutter, molecule, pip-tools, python-gilt |
|||
cliff==2.14.0 |
|||
cmd2==0.8.9 # via cliff |
|||
colorama==0.3.9 # via molecule, python-gilt |
|||
configparser==3.5.0 # via flake8 |
|||
contextlib2==0.5.5 # via cmd2 |
|||
cookiecutter==1.6.0 # via molecule |
|||
coverage==4.5.2 |
|||
cryptography==2.4.2 # via ansible, openstacksdk, paramiko |
|||
decorator==4.3.0 # via openstacksdk |
|||
docutils==0.14 # via sphinx |
|||
dogpile.cache==0.6.8 # via openstacksdk |
|||
enum34==1.1.6 # via cmd2, cryptography, flake8 |
|||
fasteners==0.14.1 # via python-gilt |
|||
filelock==3.0.10 # via tox |
|||
flake8==3.5.0 |
|||
funcsigs==1.0.2 # via mock, pytest |
|||
future==0.17.1 # via cookiecutter |
|||
futures==3.2.0 # via openstacksdk |
|||
git-url-parse==1.1.0 # via python-gilt |
|||
idna==2.8 # via cryptography, requests |
|||
imagesize==1.1.0 # via sphinx |
|||
ipaddress==1.0.22 # via cryptography, openstacksdk |
|||
iso8601==0.1.12 # via keystoneauth1, openstacksdk |
|||
jinja2-time==0.2.0 # via cookiecutter |
|||
jinja2==2.10 # via ansible, click-completion, cookiecutter, jinja2-time, molecule, sphinx |
|||
jmespath==0.9.3 # via openstacksdk |
|||
jsonpatch==1.23 # via openstacksdk |
|||
jsonpointer==2.0 # via jsonpatch |
|||
keystoneauth1==3.11.2 # via openstacksdk |
|||
markupsafe==1.1.0 # via jinja2 |
|||
mccabe==0.6.1 # via flake8 |
|||
mock==2.0.0 # via pytest-mock |
|||
molecule==2.16.0 |
|||
monotonic==1.5 # via fasteners |
|||
more-itertools==5.0.0 # via pytest |
|||
munch==2.3.2 # via openstacksdk |
|||
netaddr==0.7.19 |
|||
netifaces==0.10.9 # via openstacksdk |
|||
openstacksdk==0.22.0 |
|||
os-client-config==1.31.2 # via shade |
|||
os-service-types==1.4.0 # via keystoneauth1, openstacksdk |
|||
packaging==18.0 # via sphinx |
|||
paramiko==2.4.2 # via ansible |
|||
pathlib2==2.3.3 # via pytest |
|||
pathspec==0.5.9 # via yamllint |
|||
pbr==4.0.4 # via cliff, git-url-parse, keystoneauth1, mock, molecule, openstacksdk, os-service-types, python-gilt, shade, stevedore |
|||
pexpect==4.6.0 # via molecule |
|||
pip-tools==3.2.0 |
|||
pluggy==0.8.0 # via pytest, tox |
|||
poyo==0.4.2 # via cookiecutter |
|||
prettytable==0.7.2 # via cliff |
|||
psutil==5.4.6 # via molecule |
|||
ptyprocess==0.6.0 # via pexpect |
|||
py==1.7.0 # via pytest, tox |
|||
pyasn1==0.4.5 # via paramiko |
|||
pycodestyle==2.3.1 # via flake8 |
|||
pycparser==2.19 # via cffi |
|||
pyflakes==1.6.0 # via flake8 |
|||
pygments==2.3.1 # via sphinx |
|||
pynacl==1.3.0 # via paramiko |
|||
pyparsing==2.3.0 # via cliff, cmd2, packaging |
|||
pyperclip==1.7.0 # via cmd2 |
|||
pytest-mock==1.10.0 |
|||
pytest==4.1.0 |
|||
python-dateutil==2.7.5 # via arrow |
|||
python-gilt==1.2.1 # via molecule |
|||
pytz==2018.9 # via babel |
|||
pyyaml==3.12 # via ansible, ansible-lint, cliff, molecule, openstacksdk, python-gilt, yamllint |
|||
requests==2.21.0 # via cookiecutter, keystoneauth1, sphinx |
|||
requestsexceptions==1.4.0 # via openstacksdk |
|||
scandir==1.9.0 # via pathlib2 |
|||
sh==1.12.14 # via molecule, python-gilt |
|||
shade==1.30.0 |
|||
six==1.11.0 # via ansible-lint, bcrypt, click-completion, cliff, cmd2, cryptography, fasteners, keystoneauth1, mock, molecule, more-itertools, munch, openstacksdk, packaging, pathlib2, pip-tools, pynacl, pytest, python-dateutil, sphinx, stevedore, testinfra, tox |
|||
snowballstemmer==1.2.1 # via sphinx |
|||
sphinx==1.8.3 |
|||
sphinxcontrib-websupport==1.1.0 # via sphinx |
|||
stevedore==1.30.0 # via cliff, keystoneauth1 |
|||
subprocess32==3.5.3 # via cmd2 |
|||
tabulate==0.8.2 # via molecule |
|||
testinfra==1.14.0 |
|||
toml==0.10.0 # via tox |
|||
tox==3.6.1 |
|||
tree-format==0.1.2 # via molecule |
|||
typing==3.6.6 # via sphinx |
|||
unicodecsv==0.14.1 # via cliff |
|||
urllib3==1.24.1 # via requests |
|||
virtualenv==16.2.0 # via tox |
|||
wcwidth==0.1.7 # via cmd2 |
|||
whichcraft==0.5.2 # via cookiecutter |
|||
yamllint==1.11.1 # via molecule |
@ -1,12 +1,10 @@ |
|||
cliff>=2.14 |
|||
ansible==2.7.5 |
|||
pip-tools==3.2.0 |
|||
molecule==2.16.0 |
|||
shade==1.30.0 |
|||
sphinx |
|||
# we need 1.7.1 otherwise it fails but ... molecule wants 1.6.3 so we need |
|||
# to patch requirements.txt manually. Debugging conflicts requires running |
|||
# pip-compile --verbose because of https://github.com/jazzband/pip-tools/issues/220 |
|||
testinfra |
|||
sphinx==1.8.3 |
|||
testinfra==1.14.0 |
|||
openstacksdk==0.22.0 |
|||
netaddr==0.7.19 |
|||
-e git+https://github.com/fmnisme/python-icinga2api.git@9a1a3cc7968d6c72bf49e97ef387b2824e6835e9#egg=icinga2api |
@ -0,0 +1,44 @@ |
|||
[metadata] |
|||
name = enough |
|||
author = Enough Community |
|||
version = 1.0 |
|||
release = |
|||
author-email = contact@enough.community |
|||
summary = Helping journalists and human rights defefenders to communicate securely and privately |
|||
description-file = README.md |
|||
description-content-type = text/markdown; charset=UTF-8 |
|||
home-page = https://lab.enough.community/main/infrastructure |
|||
project_urls = |
|||
Bug Tracker = https://lab.enough.community/main/infrastructure/issues |
|||
Documentation = https://enough-community.readthedocs.io/ |
|||
Source Code = https://lab.enough.community/main/infrastructure |
|||
license = AGPLv3+ |
|||
# https://pypi.org/pypi?%3Aaction=list_classifiers |
|||
classifier = |
|||
Development Status :: 4 - Beta |
|||
Environment :: Console |
|||
Intended Audience :: Developers |
|||
Intended Audience :: Information Technology |
|||
License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+) |
|||
Operating System :: OS Independent |
|||
Programming Language :: Python |
|||
keywords = |
|||
setup |
|||
distutils |
|||
|
|||
[files] |
|||
packages = |
|||
enough |
|||
|
|||
[entry_points] |
|||
console_scripts = |
|||
enough = enough.cmd:main |
|||
|
|||
enough.cli = |
|||
create = enough.cli.create:Create |
|||
|
|||
[build_sphinx] |
|||
all-files = 1 |
|||
warning-is-error = 1 |
|||
build-dir = build |
|||
source-dir = docs |
@ -0,0 +1,8 @@ |
|||
#!/usr/bin/env python |
|||
|
|||
from setuptools import setup |
|||
|
|||
setup( |
|||
setup_requires=['pbr'], |
|||
pbr=True, |
|||
) |
@ -0,0 +1,7 @@ |
|||
from enough.cmd import main |
|||
|
|||
|
|||
def test_help(capsys): |
|||
assert main(['create']) == 0 |
|||
out, err = capsys.readouterr() |
|||
assert 'OK' in out |
@ -0,0 +1,14 @@ |
|||
#!/bin/bash |
|||
|
|||
set -ex |
|||
|
|||
name=enough-tox-$(date +%s) |
|||
|
|||
trap "docker rm -f $name >& /dev/null || true ; docker rmi --no-prune $name >& /dev/null || true" EXIT |
|||
|
|||
( |
|||
cat enough/common/data/base.dockerfile |
|||
cat tests/tox.dockerfile |
|||
) | docker build --tag $name -f - . |
|||
|
|||
docker run --rm --name $name -v /var/run/docker.sock:/var/run/docker.sock $name tox |
@ -0,0 +1,6 @@ |
|||
RUN pip install tox |
|||
RUN apt-get install -y git |
|||
RUN git init |
|||
COPY requirements-dev.txt tox.ini setup.cfg setup.py README.md /opt/ |
|||
RUN tox --notest |
|||
COPY . /opt |
@ -0,0 +1,23 @@ |
|||
[tox] |
|||
minversion = 2.0 |
|||
envlist = py27,pep8,docs |
|||
|
|||
[testenv] |
|||
setenv = VIRTUAL_ENV={envdir} |
|||
usedevelop = True |
|||
install_command = pip install {opts} {packages} |
|||
deps = |
|||
-r{toxinidir}/requirements-dev.txt |
|||
commands = coverage run --source=enough {envbindir}/py.test --durations 10 {posargs:tests} |
|||
coverage report --omit=*test*,*tox* --show-missing |
|||
|
|||
[testenv:pep8] |
|||
commands = flake8 {posargs} |
|||
|
|||
[testenv:docs] |
|||
commands = sphinx-build -W -vvv -b html docs build/html |
|||
|
|||
[flake8] |
|||
exclude = venv,.tox,dist,doc,*.egg,build,docs/conf.py,src |
|||
show-source = true |
|||
max_line_length = 100 |
Write
Preview
Loading…
Cancel
Save
Reference in new issue