Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit 3c4f7f0

Browse files
authored
Merge pull request #33 from edmorley/flake8
Add a basic Travis configuration that runs flake8 and 'bob --help'
2 parents ace8d61 + dea1b17 commit 3c4f7f0

File tree

7 files changed

+41
-15
lines changed

7 files changed

+41
-15
lines changed

.travis.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
sudo: false
2+
dist: trusty
3+
language: python
4+
python:
5+
- "2.7"
6+
- "3.4"
7+
- "3.5"
8+
- "3.6"
9+
install:
10+
- pip install .
11+
- pip install -r requirements.txt
12+
script:
13+
- flake8
14+
# TODO: Replace with an actual test suite:
15+
# https://github.com/kennethreitz/bob-builder/issues/31
16+
- bob --help
17+
matrix:
18+
allow_failures:
19+
- python: "3.4"
20+
- python: "3.5"
21+
- python: "3.6"
22+
fast_finish: true

bob/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
from . import cli
2+
3+
__all__ = ['cli']

bob/cli.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
from .utils import print_stderr
2222

2323

24-
2524
def build(formula):
26-
2725
f = Formula(path=formula)
2826

2927
try:
@@ -37,10 +35,6 @@ def build(formula):
3735

3836
return f
3937

40-
# Tarball
41-
# Upload to an s3 bucket
42-
# Then, sidestep.
43-
4438

4539
def deploy(formula, overwrite):
4640
f = build(formula)
@@ -52,17 +46,14 @@ def deploy(formula, overwrite):
5246
f.deploy(allow_overwrite=overwrite)
5347

5448

55-
5649
def main():
57-
5850
args = docopt(__doc__)
5951

6052
formula = args['<formula>']
6153
do_build = args['build']
6254
do_deploy = args['deploy']
6355
do_overwrite = args['--overwrite']
6456

65-
6657
if do_build:
6758
build(formula)
6859

bob/models.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
from __future__ import print_function
44

55
import os
6+
import re
67
import shutil
78
import sys
89
from tempfile import mkstemp, mkdtemp
910

10-
import re
11+
from .utils import (
12+
archive_tree, extract_tree, iter_marker_lines, mkdir_p,
13+
pipe, print_stderr, process, S3ConnectionHandler)
1114

12-
from .utils import *
1315

1416
WORKSPACE = os.environ.get('WORKSPACE_DIR', 'workspace')
1517
DEFAULT_BUILD_PATH = os.environ.get('DEFAULT_BUILD_PATH', '/app/.heroku/')
@@ -76,7 +78,6 @@ def depends_on(self):
7678

7779
return depends
7880

79-
8081
@property
8182
def build_path(self):
8283
"""Extracts a declared build path from a given formula."""
@@ -87,7 +88,6 @@ def build_path(self):
8788
# If none was provided, fallback to default.
8889
return DEFAULT_BUILD_PATH
8990

90-
9191
def resolve_deps(self):
9292

9393
# Dependency metadata, extracted from bash comments.
@@ -155,7 +155,6 @@ def archive(self):
155155
print('Created: {}'.format(archive))
156156
self.archived_path = archive
157157

158-
159158
def deploy(self, allow_overwrite=False):
160159
"""Deploys the formula's archive to S3."""
161160
assert self.archived_path

bob/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def archive_tree(dir, archive):
6464
for item in os.listdir(dir):
6565
tar.add(dir+"/"+item, arcname=item)
6666

67+
6768
def extract_tree(archive, dir):
6869
"""Extract tar.gz archive to a given directory."""
6970
with tarfile.open(archive, 'r:gz') as tar:

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
flake8==3.3.0
12
sphinx
2-
alabaster
3+
alabaster

setup.cfg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[flake8]
2+
exclude = .git,__pycache__,docs/
3+
ignore =
4+
# The default ignore list:
5+
E121,E123,E126,E226,E24,E704,
6+
# Our additions:
7+
# E127: continuation line over-indented for visual indent
8+
# E128: continuation line under-indented for visual indent
9+
# E501: line too long
10+
E127,E128,E501

0 commit comments

Comments
 (0)