-
Notifications
You must be signed in to change notification settings - Fork 76
try windows support #134
base: master
Are you sure you want to change the base?
try windows support #134
Changes from 5 commits
8c42ddc
ef48d84
3306381
98ce759
6334dd7
d78f78a
ace7296
1bf8968
c43e541
9156e93
556679e
4955e3f
91343a7
da4beda
a700988
0263092
9b9705b
88b33ca
f25c299
9f803c2
9822480
48f9c41
0b3521c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ sudo: required | |
dist: trusty | ||
language: python | ||
python: | ||
- 2.7 | ||
# - 2.7 | ||
- 3.4 | ||
- 3.5 | ||
- 3.6 | ||
|
@@ -13,6 +13,7 @@ cache: pip | |
install: | ||
- pip install .[dev,test] coveralls | ||
- bash scripts/install-linters.sh | ||
- pip install -r requirements-dev.txt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be necessary as the pip command above is also installing dev and test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice, I see |
||
# command to run tests | ||
before_script: | ||
- export PATH=$PATH:/tmp/pmd-bin/bin:/usr/local/bin | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,8 @@ | |
|
||
import docopt | ||
import termcolor | ||
import colorama | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer colorama to be a dependency only for windows systems. |
||
colorama.init() | ||
import yaml | ||
|
||
import gitlint.git as git | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
|
||
# This can be just pathlib when 2.7 and 3.4 support is dropped. | ||
import pathlib2 as pathlib | ||
from shutil import which | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which does not.exist in python 2.7 |
||
|
||
|
||
def filter_lines(lines, filter_regex, groups=None): | ||
|
@@ -43,22 +44,6 @@ def filter_lines(lines, filter_regex, groups=None): | |
yield tuple(matched_groups.get(group) for group in groups) | ||
|
||
|
||
# TODO(skreft): add test | ||
def which(program): | ||
"""Returns a list of paths where the program is found.""" | ||
if (os.path.isabs(program) and os.path.isfile(program) | ||
and os.access(program, os.X_OK)): | ||
return [program] | ||
|
||
candidates = [] | ||
locations = os.environ.get("PATH").split(os.pathsep) | ||
for location in locations: | ||
candidate = os.path.join(location, program) | ||
if os.path.isfile(candidate) and os.access(candidate, os.X_OK): | ||
candidates.append(candidate) | ||
return candidates | ||
|
||
|
||
def programs_not_in_path(programs): | ||
"""Returns all the programs that are not found in the PATH.""" | ||
return [program for program in programs if not which(program)] | ||
|
@@ -75,6 +60,7 @@ def _open_for_write(filename): | |
def _get_cache_filename(name, filename): | ||
"""Returns the cache location for filename and linter name.""" | ||
filename = os.path.abspath(filename)[1:] | ||
filename = filename.lstrip(":\\") # for windows | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't a drive letter appears before :\? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed by |
||
home_folder = os.path.expanduser('~') | ||
base_cache_dir = os.path.join(home_folder, '.git-lint', 'cache') | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
termcolor | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Termcolor and colorama are not dev dependencies. But as said above, colorama should only be required for windows. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should be removed an instead add the dependencies to the setup file. But See https://hynek.me/articles/conditional-python-dependencies/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, i will change them to use setup.py, declaring-platform-specific-dependencies |
||
colorama | ||
nose | ||
docopt | ||
pyfakefs | ||
pyyaml | ||
pathlib2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hustlijian It's not acceptable to get rid of the Python 2.7 support.