Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

try windows support #134

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

try windows support #134

wants to merge 23 commits into from

Conversation

hustlijian
Copy link

  1. set windows cache directory
  2. splint lines
  3. use which

@sk-
Copy link
Owner

sk- commented Nov 16, 2018

@hustlijian thanks for the pr. I left some comments. Something that's missing though is to configure CI to run on windows.

.travis.yml Outdated
@@ -13,6 +13,7 @@ cache: pip
install:
- pip install .[dev,test] coveralls
- bash scripts/install-linters.sh
- pip install -r requirements-dev.txt
Copy link
Owner

Choose a reason for hiding this comment

The 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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, I see colorama will installed: travis-jobs

@@ -50,6 +50,8 @@

import docopt
import termcolor
import colorama
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer colorama to be a dependency only for windows systems.

gitlint/utils.py Outdated
@@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which does not.exist in python 2.7

gitlint/utils.py Outdated
@@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't a drive letter appears before :\?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed by filename = os.path.abspath(filename)[1:]

@@ -0,0 +1,7 @@
termcolor
Copy link
Owner

Choose a reason for hiding this comment

The 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.

Copy link
Owner

Choose a reason for hiding this comment

The 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 colorama should only be required for windows.

See https://hynek.me/articles/conditional-python-dependencies/

Copy link
Author

Choose a reason for hiding this comment

The 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

.travis.yml Outdated
@@ -2,7 +2,7 @@ sudo: required
dist: trusty
language: python
python:
- 2.7
# - 2.7
Copy link
Owner

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.

@hustlijian
Copy link
Author

hustlijian commented Nov 17, 2018

@sk- I changed some code, and got python2.7/3.4 ci passed: travis build#9 , but two pyfakefs test can not passed, Can you help with it?

Copy link
Owner

@sk- sk- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea about how to fix the tests, but that seems related to your changes as I just tested master and the tests still pass.

Also in the PR you need to enable testing in windows in the Travis config. See https://blog.travis-ci.com/2018-10-11-windows-early-release

@@ -0,0 +1,7 @@
termcolor
Copy link
Owner

Choose a reason for hiding this comment

The 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 colorama should only be required for windows.

See https://hynek.me/articles/conditional-python-dependencies/

gitlint/utils.py Outdated
@@ -21,6 +21,72 @@
import pathlib2 as pathlib


# copy from python3, shutil.which
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which version of python was used? Which commit?

Probably is better to depend on a backported version of which like. https://pypi.org/project/backports.shutil_which/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience, I will improve this PR later。

@hustlijian
Copy link
Author

@sk- I fixed the Travis test, and the windows travics for language 'python' is currently unsupported, should we try appveyor ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants