grim/local-pipelines

linting

2016-07-23, Gary Kramlich
19f723eff865
Parents ad574fde605d
Children 306291b362a9
linting
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev-requirements.txt Sat Jul 23 00:03:43 2016 -0500
@@ -0,0 +1,3 @@
+-f requirements.txt
+
+flake8
--- a/pipelines/__init__.py Fri Jul 22 23:48:08 2016 -0500
+++ b/pipelines/__init__.py Sat Jul 23 00:03:43 2016 -0500
@@ -1,2 +1,1 @@
__version__ = "0.1.1"
-
--- a/pipelines/__main__.py Fri Jul 22 23:48:08 2016 -0500
+++ b/pipelines/__main__.py Sat Jul 23 00:03:43 2016 -0500
@@ -1,4 +1,3 @@
from pipelines.core import main
main()
-
--- a/pipelines/core.py Fri Jul 22 23:48:08 2016 -0500
+++ b/pipelines/core.py Sat Jul 23 00:03:43 2016 -0500
@@ -11,6 +11,7 @@
from pipelines import vcs
from pipelines.pipeline import Pipeline
+
def parse_args():
parser = argparse.ArgumentParser()
@@ -45,4 +46,3 @@
pipeline = Pipeline(config, path, branch)
sys.exit(pipeline.run())
-
--- a/pipelines/pipeline.py Fri Jul 22 23:48:08 2016 -0500
+++ b/pipelines/pipeline.py Sat Jul 23 00:03:43 2016 -0500
@@ -16,13 +16,14 @@
def _get_steps(self):
if "branches" in self.config["pipelines"]:
- for pattern, steps in self.config["pipelines"]["branches"].iteritems():
+ branches = self.config["pipelines"]["branches"]
+
+ for pattern, steps in branches.iteritems():
if fnmatch.fnmatch(self.branch, pattern):
return steps
return self.config["pipelines"]["default"]
-
def _determine_image(self, step):
return step.get("image", self.config.get("image"))
@@ -40,7 +41,7 @@
"docker",
"run",
"--rm=true",
- # TODO cid
+ # TODONT cidfile This is only used by the host.
"--entrypoint=/bin/bash",
"--memory=2048m",
# TODO envfile
@@ -79,4 +80,3 @@
return return_code
return 0
-
--- a/pipelines/vcs.py Fri Jul 22 23:48:08 2016 -0500
+++ b/pipelines/vcs.py Sat Jul 23 00:03:43 2016 -0500
@@ -2,11 +2,13 @@
import subprocess
+
_VCSS = {
'git': 'git rev-parse --abbrev-ref HEAD -C {}',
'hg': 'hg branch -R {}',
}
+
def get_branch(path):
branch = None
@@ -20,6 +22,6 @@
return branch
+
def get_vcses():
return _VCSS.keys()
-
--- a/setup.py Fri Jul 22 23:48:08 2016 -0500
+++ b/setup.py Sat Jul 23 00:03:43 2016 -0500
@@ -1,16 +1,14 @@
# vi:et:ts=4 sw=4 sts=4
-import os
-import sys
+from setuptools import setup, find_packages
-from setuptools import setup, find_packages
+from pipelines import __version__
+
_DESC = """local-pipelines is a parser for bitbucket-pipelines.yml files that
will run the pipeline using your local docker-engine.
"""
-from pipelines import __version__
-
def main():
""" Creates our package """
@@ -36,7 +34,7 @@
author='Gary Kramlich',
author_email='grim@reaperworld.com',
url='http://bitbucket.org/rw_grim/local-pipelines',
- entry_points = {
+ entry_points={
'console_scripts': ['pipelines=pipelines.core:main'],
}
)
@@ -44,4 +42,3 @@
if __name__ == '__main__':
main()
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tox.ini Sat Jul 23 00:03:43 2016 -0500
@@ -0,0 +1,4 @@
+[flake8]
+ignore =
+exclude = .hg,__pycache__,build,dist,*venv*
+max-complexity = 10