Skip to content
Permalink
Browse files

Changed AppVeyor test to use Python 3.7 (#343)

  • Loading branch information...
joachimmetz committed Jun 10, 2019
1 parent 294a297 commit 5c3291e0aefd7a8b20398e7b16b5d53c72a26788
Showing with 104 additions and 70 deletions.
  1. +5 −5 appveyor.yml
  2. +30 −27 config/travis/install.sh
  3. +16 −16 config/travis/runtests.sh
  4. +10 −10 setup.py
  5. +43 −12 utils/dependencies.py
@@ -6,12 +6,12 @@ environment:
- TARGET: windows_python27
MACHINE_TYPE: "amd64"
PYTHON: "C:\\Python27-x64"
- TARGET: windows_python36
- TARGET: windows_python37
MACHINE_TYPE: "x86"
PYTHON: "C:\\Python36"
- TARGET: windows_python36
PYTHON: "C:\\Python37"
- TARGET: windows_python37
MACHINE_TYPE: "amd64"
PYTHON: "C:\\Python36-x64"
PYTHON: "C:\\Python37-x64"

install:
- cmd: '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 /release'
@@ -23,7 +23,7 @@ install:
mkdir dependencies &&
set PYTHONPATH=..\l2tdevtools &&
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type %MACHINE_TYPE% --msi-targetdir "%PYTHON%" --track dev PyYAML funcsigs mock pbr six )
- cmd: if [%TARGET%]==[windows_python36] (
- cmd: if [%TARGET%]==[windows_python37] (
mkdir dependencies &&
set PYTHONPATH=..\l2tdevtools &&
"%PYTHON%\\python.exe" ..\l2tdevtools\tools\update.py --download-directory dependencies --machine-type %MACHINE_TYPE% --msi-targetdir "%PYTHON%" --track dev PyYAML mock pbr six )
@@ -28,29 +28,7 @@ RPM_PYTHON3_TEST_DEPENDENCIES="python3-mock python3-pbr python3-setuptools pytho
# Exit on error.
set -e;

if test ${TRAVIS_OS_NAME} = "osx";
then
git clone https://github.com/log2timeline/l2tbinaries.git -b dev;

mv l2tbinaries ../;

for PACKAGE in ${L2TBINARIES_DEPENDENCIES};
do
echo "Installing: ${PACKAGE}";
sudo /usr/bin/hdiutil attach ../l2tbinaries/macos/${PACKAGE}-*.dmg;
sudo /usr/sbin/installer -target / -pkg /Volumes/${PACKAGE}-*.pkg/${PACKAGE}-*.pkg;
sudo /usr/bin/hdiutil detach /Volumes/${PACKAGE}-*.pkg
done

for PACKAGE in ${L2TBINARIES_TEST_DEPENDENCIES};
do
echo "Installing: ${PACKAGE}";
sudo /usr/bin/hdiutil attach ../l2tbinaries/macos/${PACKAGE}-*.dmg;
sudo /usr/sbin/installer -target / -pkg /Volumes/${PACKAGE}-*.pkg/${PACKAGE}-*.pkg;
sudo /usr/bin/hdiutil detach /Volumes/${PACKAGE}-*.pkg
done

elif test -n "${FEDORA_VERSION}";
if test -n "${FEDORA_VERSION}";
then
CONTAINER_NAME="fedora${FEDORA_VERSION}";

@@ -134,14 +112,39 @@ then
then
DPKG_PACKAGES="${DPKG_PACKAGES} python3-distutils pylint";
fi
if test ${TRAVIS_PYTHON_VERSION} = "2.7";
if test "${TARGET}" != "jenkins2" && test "${TARGET}" != "jenkins3";
then
DPKG_PACKAGES="${DPKG_PACKAGES} python ${DPKG_PYTHON2_DEPENDENCIES} ${DPKG_PYTHON2_TEST_DEPENDENCIES}";
else
DPKG_PACKAGES="${DPKG_PACKAGES} python3 ${DPKG_PYTHON3_DEPENDENCIES} ${DPKG_PYTHON3_TEST_DEPENDENCIES}";
if test ${TRAVIS_PYTHON_VERSION} = "2.7";
then
DPKG_PACKAGES="${DPKG_PACKAGES} python ${DPKG_PYTHON2_DEPENDENCIES} ${DPKG_PYTHON2_TEST_DEPENDENCIES}";
else
DPKG_PACKAGES="${DPKG_PACKAGES} python3 ${DPKG_PYTHON3_DEPENDENCIES} ${DPKG_PYTHON3_TEST_DEPENDENCIES}";
fi
fi
fi
docker exec -e "DEBIAN_FRONTEND=noninteractive" ${CONTAINER_NAME} sh -c "apt-get install -y ${DPKG_PACKAGES}";

docker cp ../artifacts ${CONTAINER_NAME}:/

elif test ${TRAVIS_OS_NAME} = "osx";
then
git clone https://github.com/log2timeline/l2tbinaries.git -b dev;

mv l2tbinaries ../;

for PACKAGE in ${L2TBINARIES_DEPENDENCIES};
do
echo "Installing: ${PACKAGE}";
sudo /usr/bin/hdiutil attach ../l2tbinaries/macos/${PACKAGE}-*.dmg;
sudo /usr/sbin/installer -target / -pkg /Volumes/${PACKAGE}-*.pkg/${PACKAGE}-*.pkg;
sudo /usr/bin/hdiutil detach /Volumes/${PACKAGE}-*.pkg
done

for PACKAGE in ${L2TBINARIES_TEST_DEPENDENCIES};
do
echo "Installing: ${PACKAGE}";
sudo /usr/bin/hdiutil attach ../l2tbinaries/macos/${PACKAGE}-*.dmg;
sudo /usr/sbin/installer -target / -pkg /Volumes/${PACKAGE}-*.pkg/${PACKAGE}-*.pkg;
sudo /usr/bin/hdiutil detach /Volumes/${PACKAGE}-*.pkg
done
fi
@@ -8,22 +8,7 @@
# Exit on error.
set -e;

if test "${TRAVIS_OS_NAME}" = "osx";
then
PYTHONPATH=/Library/Python/2.7/site-packages/ /usr/bin/python ./run_tests.py;

python ./setup.py build

python ./setup.py sdist

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 -n "${FEDORA_VERSION}";
if test -n "${FEDORA_VERSION}";
then
CONTAINER_NAME="fedora${FEDORA_VERSION}";
CONTAINER_OPTIONS="-e LANG=en_US.UTF-8";
@@ -86,4 +71,19 @@ then
fi
# Note that exec options need to be defined before the container name.
docker exec ${CONTAINER_OPTIONS} ${CONTAINER_NAME} sh -c "cd artifacts && ${TEST_COMMAND}";

elif test "${TRAVIS_OS_NAME}" = "osx";
then
PYTHONPATH=/Library/Python/2.7/site-packages/ /usr/bin/python ./run_tests.py;

python ./setup.py build

python ./setup.py sdist

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
fi
@@ -122,16 +122,6 @@ def _make_spec_file(self):
line = '%py2_install'

elif line.startswith('%files'):
python_spec_file.extend([
'%package -n %{name}-tools',
'Requires: {0:s}-artifacts >= %{{version}}'.format(
python_package),
'Summary: Tools for {0:s}'.format(summary),
'',
'%description -n %{name}-tools'])

python_spec_file.extend(description)

lines = [
'%files -n %{name}-data',
'%defattr(644,root,root,755)',
@@ -194,6 +184,16 @@ def _make_spec_file(self):

python_spec_file.extend(description)

python_spec_file.extend([
'%package -n %{name}-tools',
'Requires: {0:s}-artifacts >= %{{version}}'.format(
python_package),
'Summary: Tools for {0:s}'.format(summary),
'',
'%description -n %{name}-tools'])

python_spec_file.extend(description)

elif in_description:
# Ignore leading white lines in the description.
if not description and not line:
@@ -147,7 +147,7 @@ def _CheckPythonModule(self, dependency):
dependency (DependencyDefinition): dependency definition.
Returns:
tuple: consists:
tuple: containing:
bool: True if the Python module is available and conforms to
the minimum required version, False otherwise.
@@ -178,7 +178,7 @@ def _CheckPythonModuleVersion(
maximum_version (str): maximum version.
Returns:
tuple: consists:
tuple: containing:
bool: True if the Python module is available and conforms to
the minimum required version, False otherwise.
@@ -252,11 +252,43 @@ def _CheckPythonModuleVersion(
status_message = '{0:s} version: {1!s}'.format(module_name, module_version)
return True, status_message

def _CheckLZMA(self):
"""Checks the availability of lzma.
Returns:
tuple: containing:
bool: True if the Python module is available and conforms to
the minimum required version, False otherwise.
str: status message.
"""
# For Python 2 lzma can be both provided as lzma and backports.lzma.
module_name = 'lzma'

module_object = self._ImportPythonModule(module_name)
if not module_object:
module_name = 'backports.lzma'

module_object = self._ImportPythonModule(module_name)
if not module_object:
status_message = 'missing: lzma and backports.lzma.'
return False, status_message

# Note that the Python 3 lzma module had no __version__ attribute.
module_version = getattr(module_object, '__version__', None)
if module_version:
status_message = '{0:s} version: {1!s}'.format(
module_name, module_version)
else:
status_message = '{0:s}'.format(module_name)

return True, status_message

def _CheckSQLite3(self):
"""Checks the availability of sqlite3.
Returns:
tuple: consists:
tuple: containing:
bool: True if the Python module is available and conforms to
the minimum required version, False otherwise.
@@ -274,10 +306,10 @@ def _CheckSQLite3(self):
if not module_object:
module_name = 'sqlite3'

module_object = self._ImportPythonModule(module_name)
if not module_object:
status_message = 'missing: {0:s}.'.format(module_name)
return False, status_message
module_object = self._ImportPythonModule(module_name)
if not module_object:
status_message = 'missing: pysqlite2.dbapi2 and sqlite3.'
return False, status_message

return self._CheckPythonModuleVersion(
module_name, module_object, 'sqlite_version', minimum_version, None)
@@ -338,15 +370,14 @@ def CheckDependencies(self, verbose_output=True):
check_result = True

for module_name, dependency in sorted(self.dependencies.items()):
if module_name == 'sqlite3':
if module_name == 'lzma':
result, status_message = self._CheckLZMA()

elif module_name == 'sqlite3':
result, status_message = self._CheckSQLite3()
else:
result, status_message = self._CheckPythonModule(dependency)

if not result and module_name == 'lzma':
dependency.name = 'backports.lzma'
result, status_message = self._CheckPythonModule(dependency)

if not result and not dependency.is_optional:
check_result = False

0 comments on commit 5c3291e

Please sign in to comment.
You can’t perform that action at this time.