Skip to content
Permalink
Browse files

Corrected inconsistent return values

  • Loading branch information...
joachimmetz committed Jun 28, 2018
1 parent 1af5531 commit e5db545d0f333e662d9cec653e79d0fa694673f9
Showing with 101 additions and 32 deletions.
  1. +4 −19 .pylintrc
  2. +3 −1 .travis.yml
  3. +8 −1 appveyor.yml
  4. +4 −2 artifacts/registry.py
  5. +1 −1 config/travis/install.sh
  6. +47 −0 config/travis/run_with_timeout.sh
  7. +16 −2 config/travis/runtests.sh
  8. +16 −4 setup.py
  9. +2 −2 utils/dependencies.py
@@ -1,4 +1,4 @@
# Pylint 1.7.x configuration file
# Pylint 1.7.x - 1.9.x configuration file
#
# This file is generated by l2tdevtools update-dependencies.py, any dependency
# related changes should be made in dependencies.ini.
@@ -55,24 +55,9 @@ confidence=
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
#
# Additional:
# fixme
# logging-format-interpolation
# no-self-use
# too-few-public-methods
# too-many-ancestors
# too-many-arguments
# too-many-boolean-expressions
# too-many-branches
# too-many-instance-attributes
# too-many-lines
# too-many-locals
# too-many-nested-blocks
# too-many-public-methods
# too-many-return-statements
# too-many-statements
# unsubscriptable-object
disable=parameter-unpacking,
disable=
duplicate-code,
parameter-unpacking,
raw-checker-failed,
bad-inline-option,
locally-disabled,
@@ -1,4 +1,6 @@
language: python
virtualenv:
system_site_packages: true
matrix:
include:
- env: TARGET="pylint"
@@ -41,6 +43,6 @@ matrix:
install:
- ./config/travis/install.sh
script:
- ./config/travis/runtests.sh
- ./config/travis/run_with_timeout.sh 30 ./config/travis/runtests.sh
after_success:
- if test ${TARGET} = "linux-python27"; then curl -o codecov.sh -s https://codecov.io/bash && /bin/bash ./codecov.sh; fi
@@ -11,7 +11,14 @@ install:
- cmd: "%PYTHON%\\Scripts\\pip.exe install pywin32 WMI"
- cmd: "%PYTHON%\\python.exe %PYTHON%\\Scripts\\pywin32_postinstall.py -install"
- cmd: git clone https://github.com/log2timeline/l2tdevtools.git ..\l2tdevtools
- cmd: mkdir dependencies && set PYTHONPATH=..\l2tdevtools && "%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type x86 --msi-targetdir "%PYTHON%" --track dev PyYAML funcsigs mock pbr six yapf
- cmd: if [%TARGET%]==[python27] (
mkdir dependencies &&
set PYTHONPATH=..\l2tdevtools &&
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type x86 --msi-targetdir "%PYTHON%" --track dev PyYAML funcsigs mock pbr six yapf )
- cmd: if [%TARGET%]==[python36] (
mkdir dependencies &&
set PYTHONPATH=..\l2tdevtools &&
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type x86 --msi-targetdir "%PYTHON%" --track dev PyYAML funcsigs mock pbr six yapf )

build: off

@@ -101,8 +101,10 @@ def GetDefinitionByName(self, name):
Returns:
ArtifactDefinition: an artifact definition or None if not available.
"""
if name:
return self._artifact_definitions.get(name.lower(), None)
if not name:
return None

return self._artifact_definitions.get(name.lower(), None)

def GetDefinitions(self):
"""Retrieves the artifact definitions.
@@ -42,7 +42,7 @@ then
sudo /usr/bin/hdiutil detach /Volumes/${PACKAGE}-*.pkg
done

elif test ${TRAVIS_OS_NAME} = "linux";
elif test ${TRAVIS_OS_NAME} = "linux" && test ${TARGET} != "jenkins";
then
sudo rm -f /etc/apt/sources.list.d/travis_ci_zeromq3-source.list;

@@ -0,0 +1,47 @@
#!/bin/bash
#
# Script to run commands on a Travis-CI test VM that otherwise would time out
# after 10 minutes. This replaces travis_wait and outputs stdout of the command
# running.
#
# This file is generated by l2tdevtools update-dependencies.py, any dependency
# related changes should be made in dependencies.ini.

# Exit on error.
set -e

# Usage: ./run_with_timeout.sh [TIMEOUT] [COMMAND] [OPTION] [...]

TIMEOUT=$1;
shift

# Launch a command in the background.
$* &

PID_COMMAND=$!;

# Probe the command every minute.
MINUTES=0;

while kill -0 ${PID_COMMAND} >/dev/null 2>&1;
do
# Print to stdout, seeing this prints a space and a backspace
# there is no visible trace.
echo -n -e " \b";

if test ${MINUTES} -ge ${TIMEOUT};
then
kill -9 ${PID_COMMAND} >/dev/null 2>&1;

echo -e "\033[0;31m[ERROR] command: $* timed out after: ${MINUTES} minute(s).\033[0m";

exit 1;
fi
MINUTES=$(( ${MINUTES} + 1 ));

sleep 60;
done

wait ${PID_COMMAND};

exit $?;
@@ -8,11 +8,15 @@
# Exit on error.
set -e;

if test "${TARGET}" = "pylint";
if test "${TARGET}" = "jenkins";
then
./config/jenkins/linux/run_end_to_end_tests.sh "travis";

elif test "${TARGET}" = "pylint";
then
pylint --version

for FILE in `find setup.py artifacts tests -name \*.py`;
for FILE in `find setup.py artifacts config tests tools -name \*.py`;
do
echo "Checking: ${FILE}";

@@ -29,6 +33,11 @@ then

python ./setup.py bdist

if test -f tests/end-to-end.py;
then
PYTHONPATH=. python ./tests/end-to-end.py --debug -c config/end-to-end.ini;
fi

elif test "${TRAVIS_OS_NAME}" = "linux";
then
if test -n "${TOXENV}";
@@ -55,4 +64,9 @@ then
mkdir -p ${TMPSITEPACKAGES};

PYTHONPATH=${TMPSITEPACKAGES} python ./setup.py install --prefix=${TMPDIR};

if test -f tests/end-to-end.py;
then
PYTHONPATH=. python ./tests/end-to-end.py --debug -c config/end-to-end.ini;
fi
fi
@@ -33,10 +33,10 @@

import artifacts # pylint: disable=wrong-import-position


if not bdist_msi:
BdistMSICommand = None
else:

class BdistMSICommand(bdist_msi):
"""Custom handler for the bdist_msi command."""

@@ -52,7 +52,6 @@ def run(self):
if not bdist_rpm:
BdistRPMCommand = None
else:

class BdistRPMCommand(bdist_rpm):
"""Custom handler for the bdist_rpm command."""

@@ -93,8 +92,21 @@ def _make_spec_file(self):
in_description = True

elif line.startswith('%files'):
line = '%files -f INSTALLED_FILES -n {0:s}-%{{name}}'.format(
python_package)
# Cannot use %{_libdir} here since it can expand to "lib64".
lines = [
'%files -n {0:s}-%{{name}}'.format(python_package),
'%defattr(644,root,root,755)',
'%doc ACKNOWLEDGEMENTS AUTHORS LICENSE README',
'%{_prefix}/lib/python*/site-packages/**/*.py',
'%{_prefix}/lib/python*/site-packages/artifacts*.egg-info/*',
'',
'%exclude %{_prefix}/share/doc/*',
'%exclude %{_prefix}/lib/python*/site-packages/**/*.pyc',
'%exclude %{_prefix}/lib/python*/site-packages/**/*.pyo',
'%exclude %{_prefix}/lib/python*/site-packages/**/__pycache__/*']

python_spec_file.extend(lines)
break

elif line.startswith('%prep'):
in_description = False
@@ -76,7 +76,7 @@ def _GetConfigValue(self, config_parser, section_name, value_name):
try:
return config_parser.get(section_name, value_name)
except configparser.NoOptionError:
return
return None

def Read(self, file_object):
"""Reads dependency definitions.
@@ -287,7 +287,7 @@ def _ImportPythonModule(self, module_name):
try:
module_object = list(map(__import__, [module_name]))[0]
except ImportError:
return
return None

# If the module name contains dots get the upper most module object.
if '.' in module_name:

0 comments on commit e5db545

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.