提交 2c591586 编辑于 作者: Timothy Crosley's avatar Timothy Crosley
浏览文件

Initial work toward fixing issue #873

显示 20 个添加16 个删除
+20 -16
......@@ -12,7 +12,7 @@ fi
export PROJECT_NAME=$OPEN_PROJECT_NAME
export PROJECT_DIR="$PWD"
if [ ! -d "venv" ]; then
if [ ! -d ".venv" ]; then
if ! hash pyvenv 2>/dev/null; then
function pyvenv()
{
......@@ -31,13 +31,13 @@ if [ ! -d "venv" ]; then
fi
echo "Making venv for $PROJECT_NAME"
pyvenv venv
. venv/bin/activate
pyvenv .venv
. .venv/bin/activate
python setup.py install
pip install -r requirements.txt
fi
. venv/bin/activate
. .venv/bin/activate
# Let's make sure this is a hubflow enabled repo
yes | git hf init >/dev/null 2>/dev/null
......
......@@ -65,5 +65,5 @@ atlassian-ide-plugin.xml
pip-selfcheck.json
# Python3 Venv Files
venv/
.venv/
pyvenv.cfg
......@@ -2,6 +2,8 @@ Changelog
=========
### 4.3.11 - March 3, 2019 - hot fix release
- Fixed issue #876: confused by symlinks pointing to virtualenv gives FIRSTPARTY not THIRDPARTY
- Fixed issue #873: current version skips every file on travis
- Additional caching to reduce performance regression introduced in 4.3.5
### 4.3.10 - March 2, 2019 - hot fix release
- Fixed Windows incompatibilities (Issue #835)
......
......@@ -47,7 +47,7 @@ class SortImports(object):
skipped = False
def __init__(self, file_path=None, file_contents=None, write_to_stdout=False, check=False,
show_diff=False, settings_path=None, ask_to_apply=False, **setting_overrides):
show_diff=False, settings_path=None, ask_to_apply=False, check_skip=True, **setting_overrides):
if not settings_path and file_path:
settings_path = os.path.dirname(os.path.abspath(file_path))
settings_path = settings_path or os.getcwd()
......@@ -93,7 +93,7 @@ class SortImports(object):
self.file_path = file_path or ""
if file_path:
file_path = os.path.abspath(file_path)
if settings.should_skip(file_path, self.config):
if check_skip and settings.should_skip(file_path, self.config):
self.skipped = True
if self.config['verbose']:
print("WARNING: {0} was skipped as it's listed in 'skip' setting"
......
......@@ -83,7 +83,7 @@ class SortAttempt(object):
def sort_imports(file_name, **arguments):
try:
result = SortImports(file_name, **arguments)
result = SortImports(file_name, check_skip=False, **arguments)
return SortAttempt(result.incorrectly_sorted, result.skipped)
except IOError as e:
print("WARNING: Unable to parse file {0} due to {1}".format(file_name, e))
......@@ -97,21 +97,17 @@ def iter_source_code(paths, config, skipped):
for path in paths:
if os.path.isdir(path):
if should_skip(path, config, os.getcwd()):
skipped.append(path)
continue
for dirpath, dirnames, filenames in os.walk(
path, topdown=True, followlinks=True
):
for dirname in list(dirnames):
if should_skip(dirname, config, dirpath):
if should_skip(dirname, config, dirpath, paths):
skipped.append(dirname)
dirnames.remove(dirname)
for filename in filenames:
filepath = os.path.join(dirpath, filename)
if is_python_file(filepath):
if should_skip(filename, config, dirpath):
if should_skip(filename, config, dirpath, paths):
skipped.append(filename)
else:
yield filepath
......
......@@ -317,16 +317,22 @@ def _get_config_data(file_path, sections):
def should_skip(filename, config, path=''):
"""Returns True if the file should be skipped based on the passed in settings."""
"""Returns True if the file and/or folder should be skipped based on the passed in settings."""
os_path = os.path.join(path, filename)
normalized_path = os_path.replace('\\', '/')
if normalized_path[1:2] == ':':
normalized_path = normalized_path[2:]
if config['safety_excludes'] and safety_exclude_re.search(normalized_path):
if config['safety_excludes'] and safety_exclude_re.search('/' + filename('\\', '/') + '/'):
return True
for skip_path in config['skip']:
for specified_path in specified_paths:
normalized_specified_path = specified_path.replace('\\', '/')
if normalized_path.startswith(normalized_specified_path):
normalized_path_skip = normalized_specified_path
if posixpath.abspath(normalized_path) == posixpath.abspath(skip_path.replace('\\', '/')):
return True
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册