From e3689f47b8ab58d1cdf2078e697cbcf8df108dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 10:20:23 +0200 Subject: [PATCH 01/19] add pre-commit and change conda-env. --- .gitignore | 2 + .pre-commit-config.yaml | 5 ++ .travis.yml | 138 +++++++++++++++++++++++------ .vscode/settings.json | 2 +- CONTRIBUTING.md | 135 +++++++++++++++++++++++----- README.rst | 2 +- appveyor.yml | 97 ++++++++++---------- environment.yml | 98 ++++++++++++++++++++ junit.xml | 10 +-- readthedocs.yml | 11 --- {conda.recipe => recipe}/meta.yaml | 26 +++--- release.py | 76 ---------------- 12 files changed, 402 insertions(+), 200 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 environment.yml delete mode 100644 readthedocs.yml rename {conda.recipe => recipe}/meta.yaml (56%) delete mode 100644 release.py diff --git a/.gitignore b/.gitignore index c54174a6..455e1cfb 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ parts/ sdist/ var/ wheels/ +pip-wheel-metadata/ *.egg-info/ .installed.cfg *.egg @@ -68,6 +69,7 @@ target/ .venv venv/ ENV/ +conda-env/ # Rope project settings .ropeproject diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..5ba9eeb8 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-added-large-files diff --git a/.travis.yml b/.travis.yml index de72da52..18321b41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,60 +1,148 @@ -# Config file for automatic building at travis-ci.org - +--- language: python +dist: xenial + +# Setting sudo to false opts in to Travis-CI container-based builds. sudo: false -python: - - "3.6" +# Turn off email notifications +notifications: + email: false + +env: + global: + # used by ci-helpers + - DEPS="pytest pytest-qt tox coveralls six" + - MINICONDA_VERSION=latest + - DISPLAY=":99.0" matrix: - fast_finish: true include: - - python: "3.6.1" - env: TOXENV=lint - - python: "3.6.1" - env: TOXENV=lint - - python: "3.6.1" - env: TOXENV=py36 - - python: "3.7" - env: TOXENV=py37 + - os: linux + env: PYTHON_VERSION="3.5" + - os: linux + env: PYTHON_VERSION="3.6" + - os: linux + env: PYTHON_VERSION="3.7" + - os: osx + osx_image: xcode9.4 + env: PYTHON_VERSION="3.5" + - os: osx + osx_image: xcode10 + env: PYTHON_VERSION="3.6" + - os: osx + osx_image: xcode11 + env: PYTHON_VERSION="3.7" cache: directories: - $HOME/.cache/pip - $HOME/download +services: + - xvfb + before_install: - wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - bash miniconda.sh -b -p $HOME/miniconda - export PATH="$HOME/miniconda/bin:$PATH" - hash -r + - conda config --set always_yes yes --set changeps1 no - conda config --add channels conda-forge - - conda update -q conda - - conda config --set auto_update_conda no + - conda update -q conda --yes + - conda info -a # for debug reasons + + # to aid in debugging + - echo ${TRAVIS_BRANCH} + - echo ${TRAVIS_REPO_SLUG} + - echo ${GIT_TARGET_EXTRA} + - echo ${GIT_SOURCE_EXTRA} install: - - conda create -q -n jmbuild python=$TRAVIS_PYTHON_VERSION - - source activate jmbuild - - conda install tox - - conda install pexpect openpyxl - - conda install pip - - pip install . + - export GIT_FULL_HASH=`git rev-parse HEAD` + - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} + - conda list # for debug reasons + +before_script: + # We need to create a (fake) display on Travis, let's use a funny resolution + - export DISPLAY=:99.0 + - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render + + # Make sure everyone uses the correct python (this is handled by conda) + - which python + - python --version + - pwd + - ls + # Help color output from each test + - RESET='\033[0m'; + RED='\033[00;31m'; + GREEN='\033[00;32m'; + YELLOW='\033[00;33m'; + BLUE='\033[00;34m'; + PURPLE='\033[00;35m'; + CYAN='\033[00;36m'; + WHITE='\033[00;37m'; + start_test() { + echo -e "${BLUE}======== Starting $1 ========${RESET}"; + }; + check_output() { + ret=$?; + if [ $ret == 0 ]; then + echo -e "${GREEN}>>>>>> $1 passed <<<<<<${RESET}"; + else + echo -e "${RED}>>>>>> $1 FAILED <<<<<<${RESET}"; + fi; + return $ret; + }; + + - if [ "${TEST}" == "extra" ]; then + start_test "repo size check"; + mkdir ~/repo-clone && cd ~/repo-clone && + git init && git remote add -t ${TRAVIS_BRANCH} origin git://github.com/${TRAVIS_REPO_SLUG}.git && + git fetch origin ${GIT_TARGET_EXTRA} && + git checkout -qf FETCH_HEAD && + git tag travis-merge-target && + git gc --aggressive && + TARGET_SIZE=`du -s . | sed -e "s/\t.*//"` && + git pull origin ${GIT_SOURCE_EXTRA} && + git gc --aggressive && + MERGE_SIZE=`du -s . | sed -e "s/\t.*//"` && + if [ "${MERGE_SIZE}" != "${TARGET_SIZE}" ]; then + SIZE_DIFF=`expr \( ${MERGE_SIZE} - ${TARGET_SIZE} \)`; + else + SIZE_DIFF=0; + fi; + fi; script: - - tox -e lint - - tox -e py37 + - source conda-env/bin/activate + - tox -e ${PYTHON} - tox -e docs after_success: - - conda install -c conda-forge codecov - - conda install conda-build anaconda-client pytest pytest-cov - codecov - coveralls - conda build conda.recipe --no-test - conda install --use-local jmopenorders - conda info -a +before_deploy: + # Conda deploy if on tag + # ANACONDA_TOKEN should be provided by Travis + # How to generate ANACONDA_TOKEN: https://docs.anaconda.com/anaconda-cloud/user-guide/tasks/work-with-accounts#creating-access-tokens + + # https://conda.io/docs/user-guide/tasks/build-packages/install-conda-build.html + - conda config --set anaconda_upload no + - travis_wait 60 conda build --quiet --no-test --output-folder conda_build conda.recipe + + # Convert to other platforms: OSX, WIN + - conda convert --platform win-64 conda_build/linux-64/*.tar.bz2 -o conda_build/ + - conda convert --platform osx-64 conda_build/linux-64/*.tar.bz2 -o conda_build/ + # Upload to Anaconda + # We could use --all but too much platforms to uploaded + - ls conda_build/*/*.tar.bz2 | xargs -I {} anaconda -v -t $ANACONDA_TOKEN upload -u jmuelbert {} + deploy: provider: pypi skip_upload_docs: true diff --git a/.vscode/settings.json b/.vscode/settings.json index 6134e853..7a13639f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "python.pythonPath": "/miniconda3/envs/cliapp37/bin/python", + "python.pythonPath": "/Users/juergen/Documents/Projects/GitHub/openorders-py/master/conda-env/bin/python2.7", "python.linting.pylintEnabled": true, "python.linting.pylintArgs": ["--reports", "12", "--disable-msg", "I0011"], "python.linting.flake8Enabled": true, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 40839489..acddb159 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,32 +1,127 @@ -# Contributing to openorders # +.. highlight:: shell -First time contributing to openorders ? -Read our [Code of Conduct](https://github.com/jmuelbert/jmopenorders/blob/master/CODE_OF_CONDUCT.md#code-of-conduct). +============ +Contributing +============ -All kinds of contributions are very appreciated, be it documentation, code or build system improvements, be it a small patch, a feature or maybe even becoming a co-maintainer of Tiled. Bug reports and feature requests are of course welcome too! +Contributions are welcome, and they are greatly appreciated! Every little bit +helps, and credit will always be given. -## Reporting an Issue ## +You can contribute in many ways: -Make sure to mention the following things: +Types of Contributions +---------------------- -* How the issue can reproduced -* What behavior you expected instead -* What actually happened -* jmbde version, operating system, etc. if possibly relevant. +Report Bugs +~~~~~~~~~~~ -Also, please consider adding a screenshot or video if it helps illustrate the issue. +Report bugs at https://github.com/jmuelbert/jmopenorders/issues. -## Requesting a Feature ## +If you are reporting a bug, please include: -First of all, look around the already open issues to see if the feature was already requested in some form. In that case it's better to comment on the existing feature instead. +* Your operating system name and version. +* Any details about your local setup that might be helpful in troubleshooting. +* Detailed steps to reproduce the bug. -In any case, be sure to describe the feature in enough detail, to consider its implications on existing parts of the software if relevant and to describe how it would help you in particular. Also, please consider including a mockup if the issue includes UI changes. +Fix Bugs +~~~~~~~~ -## Submitting a Patch ## +Look through the GitHub issues for bugs. Anything tagged with "bug" and "help +wanted" is open to whoever wants to implement it. -* Ideally, start with something small to get familiar with the review process and work up from there. -* Make an effort to follow the overal coding style, which is roughly based on the [Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/). -* Be prepared for detailed feedback on your patch and to make several revisions. -* Each pull request will be built automatically for Windows, Linux and macOS. If the build fails anywhere, please check if it may be a problem with your patch. +Implement Features +~~~~~~~~~~~~~~~~~~ -Thanks a lot for your contribution! +Look through the GitHub issues for features. Anything tagged with "enhancement" +and "help wanted" is open to whoever wants to implement it. + +Write Documentation +~~~~~~~~~~~~~~~~~~~ + +PrettyQt could always use more documentation, whether as part of the +official jmopenorders docs, in docstrings, or even on the web in blog posts, +articles, and such. + +Submit Feedback +~~~~~~~~~~~~~~~ + +The best way to send feedback is to file an issue at https://github.com/jmuelbert/jmopenorders/issues. + +If you are proposing a feature: + +* Explain in detail how it would work. +* Keep the scope as narrow as possible, to make it easier to implement. +* Remember that this is a volunteer-driven project, and that contributions + are welcome :) + +Get Started! +------------ + +Ready to contribute? Here's how to set up `jmbde` for local development. + +1. Fork the `jmopenorders` repo on GitHub. +2. Clone your fork locally:: + + $ git clone git@github.com:your_name_here/jmopenorders.git + +3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: + + $ mkvirtualenv jmopenorders + $ cd jmopenorders/ + $ python setup.py develop + +4. Create a branch for local development:: + + $ git checkout -b name-of-your-bugfix-or-feature + + Now you can make your changes locally. + +5. When you're done making changes, check that your changes pass flake8 and the + tests, including testing other Python versions with tox:: + + $ flake8 jmopenorders tests + $ python setup.py test or py.test + $ tox + + To get flake8 and tox, just pip install them into your virtualenv. + +6. Commit your changes and push your branch to GitHub:: + + $ git add . + $ git commit -m "Your detailed description of your changes." + $ git push origin name-of-your-bugfix-or-feature + +7. Submit a pull request through the GitHub website. + +Pull Request Guidelines +----------------------- + +Before you submit a pull request, check that it meets these guidelines: + +1. The pull request should include tests. +2. If the pull request adds functionality, the docs should be updated. Put + your new functionality into a function with a docstring, and add the + feature to the list in README.rst. +3. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check + https://travis-ci.org/jmuelbert/jmopenorders/pull_requests + and make sure that the tests pass for all supported Python versions. + +Tips +---- + +To run a subset of tests:: + +$ py.test tests.test_prettyqt + + +Deploying +--------- + +A reminder for the maintainers on how to deploy. +Make sure all your changes are committed (including an entry in HISTORY.rst). +Then run:: + +$ git push +$ git push --tags + +Travis will then deploy to PyPI if tests pass. diff --git a/README.rst b/README.rst index 99fb2d7c..9a59b843 100644 --- a/README.rst +++ b/README.rst @@ -2,7 +2,7 @@ jmopenorders ============ .. image:: https://img.shields.io/pypi/v/jmopenorders.svg - :target: https://pypi.python.org/pypi/jmopenorders + :target: https://pypi.python.org/pypi/jmopenorders/ :alt: PyPi .. image:: https://img.shields.io/pypi/wheel/jmopenorders.svg diff --git a/appveyor.yml b/appveyor.yml index fd14155f..5c2c5651 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,65 +1,66 @@ -# AppVeyor.com is a Continuous Integration service to build and run tests under -# Windows +shallow_clone: false -environment: - global: - # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the - # /E:ON and /V:ON options are not enabled in the batch script intepreter - # See: http://stackoverflow.com/a/13751649/163740 - CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\tools\\appveyor\\run_with_env.cmd" +image: + - Ubuntu + - Ubuntu1804 + - Visual Studio 2015 +environment: matrix: - - PYTHON: "C:\\Miniconda36-x64" - PYTHON_VERSION: "3.6" - PYTHON_ARCH: "64" + - PYTHON_VERSION: "3.6" + PYTEST_QT_API: "pyside2" + CONDA_DEPENDENCIES: "pytest-qt pytest pyside2=2.*" + - PYTHON_VERSION: "3.7" + PYTEST_QT_API: "pyside2" + CONDA_DEPENDENCIES: "pytest-qt pytest pyside2=2.*" + - PYTHON_VERSION: "3.8" + PYTEST_QT_API: "pyside2" + CONDA_DEPENDENCIES: "pytest-qt pytest pyside2=2.*" - - PYTHON: "C:\\Miniconda36-x64" - PYTHON_VERSION: "3.7" - PYTHON_ARCH: "64" + global: + PYTHON: "C:\\conda" + CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\ci-helpers\\appveyor\\windows_sdk.cmd" + PYTHON_ARCH: + "64" # needs to be set for CMD_IN_ENV to succeed. If a mix + # of 32 bit and 64 bit builds are needed, move this + # to the matrix section. + # Used by atropy ci-helpers + CONDA_CHANNELS: "conda-forge" -init: - - ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH% %HOME% +platform: + - x64 install: - # If there is a newer build queued for the same PR, cancel this one. - # The AppVeyor 'rollout builds' option is supposed to serve the same - # purpose but it is problematic because it tends to cancel builds pushed - # directly to master instead of just PR builds (or the converse). - # credits: JuliaLang developers. - - ps: - if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` - https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` - Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` - throw "There are newer queued builds for this pull request, failing early." } - # these correspond to folder naming of miniconda installs on appveyor. See - # https://www.appveyor.com/docs/installed-software#python - - if "%PYTHON_VERSION%" == "3.6" set "BASE_PYTHON_VERSION=36" - - if "%PYTHON_ARCH%" == "64" set "ARCH_LABEL=-x64" - - call "C:\Miniconda%BASE_PYTHON_VERSION%%ARCH_LABEL%\Scripts\activate.bat" + # Linux + - sh: sudo apt update + - sh: sudo apt -y --force-yes install libglu1-mesa xvfb libgl1-mesa-dri mesa-common-dev libglu1-mesa-dev + - sh: wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + - sh: bash miniconda.sh -b -p $HOME/miniconda + # Windows - Miniconda is in Image + - cmd: set "PATH="C:\Miniconda3-x64;C:\Miniconda3-x64\Scripts;%PATH%" + - conda activate base - conda config --set always_yes yes --set changeps1 no - - conda update -q conda - conda config --add channels conda-forge + - conda update -q conda --yes - conda config --set auto_update_conda no - - conda update -q --all - - conda install -q pytest pytest-cov conda-build anaconda-client - - conda install tox - - conda info - # this is to ensure dependencies - - conda build conda.recipe --no-test - - conda install --use-local jmopenorders - - conda info -a - - # Check that we have the expected version of Python - - python --version - - tox + - conda info -a # for debug reasons + - conda env create -fcon environment.yml -p conda-env python=${PYTHON_VERSION} + - cmd: conda-env/bin/activate.bat + - sh: source conda-env/bin/activate + - conda list + - pip install -e . + - pip install pytest-xvfb pytest-mock pytest-cov pytest-repeat codecov pyvirtualdisplay==0.2.1 + - conda list # for debug reason -# Not a .NET project, we build package in the install step instead +# Not a .NET project, we build in the install step instead build: false test_script: - - py.test --color=yes -v --cov jmopenorders --cov-report xml tests + - tox -e ${PYTHON} + - tox -e docs on_success: - - conda install -c conda-forge codecov - - codecov --env %PYTHON_VERSION% --file C:\projects\jmopenorders\coverage.xml + - codecov + +skip_tags: true diff --git a/environment.yml b/environment.yml new file mode 100644 index 00000000..0953e6c0 --- /dev/null +++ b/environment.yml @@ -0,0 +1,98 @@ +name: jmopenorders +channels: + - conda-forge + - defaults +dependencies: + - anaconda-client + - asn1crypto + - aspy.yaml + - atomicwrites + - attrs + - beautifulsoup4 + - bzip2 + - ca-certificates + - cached-property + - certifi + - cffi + - cfgv + - chardet + - clyent + - codecov + - conda + - conda-build + - conda-package-handling + - coverage + - cryptography + - decorator + - editdistance + - et_xmlfile + - filelock + - glob2 + - icu + - identify + - idna + - importlib_metadata + - ipython_genutils + - jdcal + - jinja2 + - jsonschema + - jupyter_core + - libarchive + - libcxx + - libcxxabi + - libffi + - libiconv + - liblief + - libxml2 + - lz4-c + - lzo + - markupsafe + - more-itertools + - nbformat + - ncurses + - nodeenv + - openpyxl + - openssl + - packaging + - pip + - pkginfo + - pluggy + - pre-commit + - psutil + - py + - py-lief + - pycosat + - pycparser + - pyopenssl + - pyparsing + - pyrsistent + - pysocks + - pytest + - pytest-cov + - python<=3.4 + - python-dateutil + - python-libarchive-c + - pytz + - pyyaml + - readline + - requests + - ripgrep + - ruamel_yaml + - setuptools + - six + - soupsieve + - sqlite + - tk + - toml + - tqdm + - traitlets + - urllib3 + - virtualenv + - wcwidth + - wheel + - xz + - yaml + - zipp + - zlib + - zstd +prefix: ./conda-envs/jmopenorders diff --git a/junit.xml b/junit.xml index 6ea5ea21..74f8a698 100644 --- a/junit.xml +++ b/junit.xml @@ -1,21 +1,21 @@ -ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_api.py'. +ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_api.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/test_api.py:11: in <module> from jmopenorders.api.hello import hello # tests __all__ -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_cli.py'. +E ImportError: No module named jmopenorders.api.helloImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_cli.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/test_cli.py:15: in <module> from jmopenorders.cli import main -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_config.py'. +E ImportError: No module named jmopenorders.cliImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_config.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/core/test_config.py:14: in <module> from jmopenorders.core.config import YamlConfig -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_logger.py'. +E ImportError: No module named jmopenorders.core.configImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_logger.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/core/test_logger.py:15: in <module> from jmopenorders.core.logger import Logger -E ModuleNotFoundError: No module named 'jmopenorders' \ No newline at end of file +E ImportError: No module named jmopenorders.core.logger \ No newline at end of file diff --git a/readthedocs.yml b/readthedocs.yml deleted file mode 100644 index 343098de..00000000 --- a/readthedocs.yml +++ /dev/null @@ -1,11 +0,0 @@ -# .readthedocs.yml - -build: - image: latest - -python: - version: 3.7 - setup_py_install: true - use_system_site_packages: true - -requirements_file: requirements_docs.txt \ No newline at end of file diff --git a/conda.recipe/meta.yaml b/recipe/meta.yaml similarity index 56% rename from conda.recipe/meta.yaml rename to recipe/meta.yaml index 718cf1d8..756fb119 100644 --- a/conda.recipe/meta.yaml +++ b/recipe/meta.yaml @@ -2,8 +2,8 @@ {% set version = "0.1.2" %} package: - name: "{{ name|lower }}" - version: "{{ version }}" + name: {{ name }} + version: {{ version }} source: url: "https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz" @@ -12,22 +12,22 @@ source: build: noarch: python number: 0 + script: pip install . --no-deps --ignore-installed entry_points: - jmopenorders = jmopenorders.cli:main - script: "python -m pip install . --no-deps --ignore-installed -vv" +# https://conda.io/docs/user-guide/tasks/build-packages/define-metadata.html#export-runtime-requirements requirements: - host: - - openpyxl - - pexpect + build: - pip - python - - python-slugify + run: - openpyxl - pexpect - python - python-slugify + - setuptools test: imports: @@ -39,13 +39,13 @@ test: - tox about: - home: "https://jmopenorders.github.io/" - license: "European Union Public Licence 1.2 (EUPL 1.2)" - license_family: "NONE" + home: https://jmopenorders.github.io/ + license: EUPL-1.2 + license_family: NONE license_file: "LICENSE" - summary: "jmopenorders is a generator to generate infos for the affected persons" - doc_url: "https://readthedocs.org/projects/jmopenorders/" - dev_url: "https://github.com/jmuelbert/jmopenorders" + summary: 'jmopenorders is a generator to generate infos for the affected persons' + dev_url: https://github.com/jmuelbert/jmopenorders + doc_url: https://jmopenorders.readthedocs.io extra: recipe-maintainers: diff --git a/release.py b/release.py deleted file mode 100644 index 728959eb..00000000 --- a/release.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# -# Copyright (c) 2019 Jürgen Mülbert. All rights reserved. -# -# Licensed under the EUPL, Version 1.2 or – as soon they -# will be approved by the European Commission - subsequent -# versions of the EUPL (the "Licence"); -# You may not use this work except in compliance with the -# Licence. -# You may obtain a copy of the Licence at: -# -# https://joinup.ec.europa.eu/page/eupl-text-11-12 -# -# Unless required by applicable law or agreed to in -# writing, software distributed under the Licence is -# distributed on an "AS IS" basis, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either -# express or implied. -# See the Licence for the specific language governing -# permissions and limitations under the Licence. -# -# Lizenziert unter der EUPL, Version 1.2 oder - sobald -# diese von der Europäischen Kommission genehmigt wurden - -# Folgeversionen der EUPL ("Lizenz"); -# Sie dürfen dieses Werk ausschließlich gemäß -# dieser Lizenz nutzen. -# Eine Kopie der Lizenz finden Sie hier: -# -# https://joinup.ec.europa.eu/page/eupl-text-11-12 -# -# Sofern nicht durch anwendbare Rechtsvorschriften -# gefordert oder in schriftlicher Form vereinbart, wird -# die unter der Lizenz verbreitete Software "so wie sie -# ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN - -# ausdrücklich oder stillschweigend - verbreitet. -# Die sprachspezifischen Genehmigungen und Beschränkungen -# unter der Lizenz sind dem Lizenztext zu entnehmen. -# - -from subprocess import call -import os -import re - -version = None - - -def get_new_setup_py_lines(): - global version - with open('setup.py', 'r') as sf: - current_setup = sf.readlines() - for line in current_setup: - if line.startswith('VERSION = '): - major, minor = re.findall(r"VERSION = '(\d+)\.(\d+)'", line)[0] - version = "{}.{}".format(major, int(minor) + 1) - yield "VERSION = '{}'\n".format(version) - else: - yield line - - -lines = list(get_new_setup_py_lines()) -with open('setup.py', 'w') as sf: - sf.writelines(lines) - -call('git pull', shell=True) -call('git commit -am "Bump to {}"'.format(version), shell=True) -call('git tag {}'.format(version), shell=True) -call('git push', shell=True) -call('git push --tags', shell=True) - -env = os.environ -env['CONVERT_README'] = 'true' -call('rm -rf dist/*') -call('python setup.py sdist bdist_wheel', shell=True, env=env) -call('twine upload dist/*', shell=True, env=env) From 6ced93335351c9e9ff340f7ebc168a546ece0c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 10:34:56 +0200 Subject: [PATCH 02/19] add tox to the dependencies. --- appveyor.yml | 1 + environment.yml | 1 + junit.xml | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 5c2c5651..560dd4c6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,6 +39,7 @@ install: # Windows - Miniconda is in Image - cmd: set "PATH="C:\Miniconda3-x64;C:\Miniconda3-x64\Scripts;%PATH%" + - sh: export PATH="$HOME/miniconda/bin;$PATH" - conda activate base - conda config --set always_yes yes --set changeps1 no - conda config --add channels conda-forge diff --git a/environment.yml b/environment.yml index 0953e6c0..9a2cdfec 100644 --- a/environment.yml +++ b/environment.yml @@ -84,6 +84,7 @@ dependencies: - sqlite - tk - toml + - tox - tqdm - traitlets - urllib3 diff --git a/junit.xml b/junit.xml index 74f8a698..4860b614 100644 --- a/junit.xml +++ b/junit.xml @@ -1,4 +1,4 @@ -ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_api.py'. +ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_api.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/test_api.py:11: in <module> From d0ceeba2da9ccfd9c5bac0d72f8d06578500bbd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 11:04:59 +0200 Subject: [PATCH 03/19] Many fixes(i.e. Quotes in Strings. --- .pre-commit-config.yaml | 15 + .travis.yml | 3 - .vscode/launch.json | 21 +- .vscode/settings.json | 15 +- appveyor.yml | 4 +- docs/source/_ext/edit_on_github.py | 4 +- docs/source/conf.py | 28 +- environment.yml | 2 +- jmopenorders/__init__.py | 4 +- jmopenorders/__main__.py | 2 +- jmopenorders/_version.py | 296 +++++++-------- jmopenorders/api/cleanoutputdir.py | 2 +- jmopenorders/api/generateorders.py | 32 +- jmopenorders/api/getdata.py | 4 +- jmopenorders/api/getserviceperson.py | 8 +- jmopenorders/api/hello.py | 6 +- jmopenorders/api/report.py | 14 +- jmopenorders/cli.py | 42 +-- jmopenorders/core/config.py | 10 +- jmopenorders/core/logger.py | 8 +- junit.xml | 10 +- resources/icons/app.svg | 0 resources/icons/demo.svg | 0 setup.py | 60 +-- tests/core/test_config.py | 30 +- tests/core/test_logger.py | 14 +- tests/generate_test_data.py | 100 ++--- tests/test_api.py | 10 +- tests/test_cli.py | 8 +- versioneer.py | 534 +++++++++++++-------------- 30 files changed, 642 insertions(+), 644 deletions(-) mode change 100755 => 100644 resources/icons/app.svg mode change 100755 => 100644 resources/icons/demo.svg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5ba9eeb8..ab7983c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,3 +3,18 @@ repos: rev: v2.3.0 hooks: - id: check-added-large-files + - id: check-ast + - id: check-byte-order-marker + - id: check-case-conflict + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-json + - id: check-merge-conflict + - id: check-symlinks + - id: check-toml + - id: check-vcs-permalinks + # - id: check-yaml - Problems with conda recipe + - id: check-xml + - id: debug-statements + - id: detect-private-key + - id: double-quote-string-fixer diff --git a/.travis.yml b/.travis.yml index 18321b41..15be9fab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,13 +26,10 @@ matrix: env: PYTHON_VERSION="3.7" - os: osx osx_image: xcode9.4 - env: PYTHON_VERSION="3.5" - os: osx osx_image: xcode10 - env: PYTHON_VERSION="3.6" - os: osx osx_image: xcode11 - env: PYTHON_VERSION="3.7" cache: directories: diff --git a/.vscode/launch.json b/.vscode/launch.json index f636bac8..d49a0799 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,15 +1,10 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", - "configurations": [ - { - "name": "Python: Aktuelle Datei", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "integratedTerminal" - } - ] -} \ No newline at end of file + "configurations": [{ + "name": "Python: Aktuelle Datei", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal" + }] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 7a13639f..31066d4a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "python.pythonPath": "/Users/juergen/Documents/Projects/GitHub/openorders-py/master/conda-env/bin/python2.7", + "python.pythonPath": "conda-env/bin/python", "python.linting.pylintEnabled": true, "python.linting.pylintArgs": ["--reports", "12", "--disable-msg", "I0011"], "python.linting.flake8Enabled": true, @@ -24,8 +24,6 @@ "pyqt-integration.linguist.cmd": "linguist", "pyside2-vsc.uic.cmd": "pyside2-uic", - - // files "files.trimTrailingWhitespace": true, "files.autoSave": "afterDelay", "files.exclude": { @@ -41,35 +39,26 @@ "**/.settings": true, "**/.factorypath": true }, - // Controls if quick suggestions should show up while typing "editor.quickSuggestions": { "other": true, "comments": false, "strings": false }, - // Controls if suggestions should be accepted on 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions. The value 'smart' means only accept a suggestion with Enter when it makes a textual change "editor.acceptSuggestionOnEnter": "on", - // Controls the delay in ms after which quick suggestions will show up. "editor.quickSuggestionsDelay": 10, - // Controls if suggestions should automatically show up when typing trigger characters "editor.suggestOnTriggerCharacters": true, - // Controls if pressing tab inserts the best suggestion and if tab cycles through other suggestions "editor.tabCompletion": "on", - // Controls whether sorting favours words that appear close to the cursor "editor.suggest.localityBonus": true, - // Controls how suggestions are pre-selected when showing the suggest list "editor.suggestSelection": "recentlyUsed", - // Enable word based suggestions "editor.wordBasedSuggestions": true, - // Enable parameter hints - "editor.parameterHints.enabled": true, + "editor.parameterHints.enabled": true } diff --git a/appveyor.yml b/appveyor.yml index 560dd4c6..0d95d384 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -40,7 +40,9 @@ install: # Windows - Miniconda is in Image - cmd: set "PATH="C:\Miniconda3-x64;C:\Miniconda3-x64\Scripts;%PATH%" - sh: export PATH="$HOME/miniconda/bin;$PATH" - - conda activate base + - sh: ls "$HOME/miniconda" + - sh: ls "$HOME/miniconda/bin" + # - conda activate base - conda config --set always_yes yes --set changeps1 no - conda config --add channels conda-forge - conda update -q conda --yes diff --git a/docs/source/_ext/edit_on_github.py b/docs/source/_ext/edit_on_github.py index 61f525de..c643946a 100644 --- a/docs/source/_ext/edit_on_github.py +++ b/docs/source/_ext/edit_on_github.py @@ -24,10 +24,10 @@ def html_page_context(app, pagename, templatename, context, doctree): return if not app.config.edit_on_github_project: - warnings.warn("edit_on_github_project not specified") + warnings.warn('edit_on_github_project not specified') return if not doctree: - warnings.warn("doctree is None") + warnings.warn('doctree is None') return path = os.path.relpath(doctree.get('source'), app.builder.srcdir) show_url = get_github_url(app, 'blob', path) diff --git a/docs/source/conf.py b/docs/source/conf.py index 4e9b2907..dbeeca8d 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,20 +24,20 @@ __version__ = '0.2.0' __short_version__ = __version__ -PROJECT_NAME = "JM OpenOrders" -PROJECT_PACKAGE_NAME = "jmopenorders" -PROJECT_LICENSE = "EUPL-1.2 " -PROJECT_AUTHOR = "Jürgen Mülbert" -PROJECT_COPYRIGHT = " 2018-{}, {}".format(dt.datetime.now().year, PROJECT_AUTHOR) -PROJECT_URL = "https://jmopenorders.github.io/" -PROJECT_EMAIL = "juergen.muelbert@gmail.com" +PROJECT_NAME = 'JM OpenOrders' +PROJECT_PACKAGE_NAME = 'jmopenorders' +PROJECT_LICENSE = 'EUPL-1.2 ' +PROJECT_AUTHOR = 'Jürgen Mülbert' +PROJECT_COPYRIGHT = ' 2018-{}, {}'.format(dt.datetime.now().year, PROJECT_AUTHOR) +PROJECT_URL = 'https://jmopenorders.github.io/' +PROJECT_EMAIL = 'juergen.muelbert@gmail.com' PROJECT_LONG_DESCRIPTION = 'A BDE Tool' -PROJECT_GITHUB_USERNAME = "jmuelbert" -PROJECT_GITHUB_REPOSITORY = "jmopenorders" +PROJECT_GITHUB_USERNAME = 'jmuelbert' +PROJECT_GITHUB_REPOSITORY = 'jmopenorders' -GITHUB_PATH = "{}/{}".format(PROJECT_GITHUB_USERNAME, PROJECT_GITHUB_REPOSITORY) -GITHUB_URL = "https://github.com/{}".format(GITHUB_PATH) +GITHUB_PATH = '{}/{}'.format(PROJECT_GITHUB_USERNAME, PROJECT_GITHUB_REPOSITORY) +GITHUB_URL = 'https://github.com/{}'.format(GITHUB_PATH) sys.path.insert(0, os.path.abspath('_ext')) sys.path.insert(0, os.path.abspath('../jmopenorders')) @@ -118,10 +118,10 @@ def linkcode_resolve(domain, info): except: lineno = None if lineno: - linespec = "#L%d" % (lineno + 1) + linespec = '#L%d' % (lineno + 1) else: - linespec = "" - index = fn.find("/homeassistant/") + linespec = '' + index = fn.find('/homeassistant/') if index == -1: index = 0 diff --git a/environment.yml b/environment.yml index 9a2cdfec..c40f98e6 100644 --- a/environment.yml +++ b/environment.yml @@ -69,7 +69,7 @@ dependencies: - pysocks - pytest - pytest-cov - - python<=3.4 + - python>=3.4 - python-dateutil - python-libarchive-c - pytz diff --git a/jmopenorders/__init__.py b/jmopenorders/__init__.py index 85d1aa0a..fe164fdc 100644 --- a/jmopenorders/__init__.py +++ b/jmopenorders/__init__.py @@ -5,11 +5,11 @@ """ -__all__ = ("VERSION", "Client", "get_version") # noqa +__all__ = ('VERSION', 'Client', 'get_version') # noqa # Declare child imports last to prevent recursion from ._version import get_versions -__version__ = get_versions()["version"] +__version__ = get_versions()['version'] del get_versions diff --git a/jmopenorders/__main__.py b/jmopenorders/__main__.py index ec02750d..dad54be7 100644 --- a/jmopenorders/__main__.py +++ b/jmopenorders/__main__.py @@ -14,5 +14,5 @@ def main() -> None: # Make the script executable -if __name__ == "__main__": +if __name__ == '__main__': raise SystemExit(main()) diff --git a/jmopenorders/_version.py b/jmopenorders/_version.py index 2c8ad8da..1fa673eb 100644 --- a/jmopenorders/_version.py +++ b/jmopenorders/_version.py @@ -23,10 +23,10 @@ def get_keywords(): # setup.py/versioneer.py will grep for the variable names, so they must # each be defined on a line of their own. _version.py will just call # get_keywords(). - git_refnames = "$Format:%d$" - git_full = "$Format:%H$" - git_date = "$Format:%ci$" - keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} + git_refnames = '$Format:%d$' + git_full = '$Format:%H$' + git_date = '$Format:%ci$' + keywords = {'refnames': git_refnames, 'full': git_full, 'date': git_date} return keywords @@ -39,11 +39,11 @@ def get_config(): # these strings are filled in when 'setup.py versioneer' creates # _version.py cfg = VersioneerConfig() - cfg.VCS = "git" - cfg.style = "" - cfg.tag_prefix = "" - cfg.parentdir_prefix = "jmopenorders-" - cfg.versionfile_source = "jmopenorders/_version.py" + cfg.VCS = 'git' + cfg.style = '' + cfg.tag_prefix = '' + cfg.parentdir_prefix = 'jmopenorders-' + cfg.versionfile_source = 'jmopenorders/_version.py' cfg.verbose = False return cfg @@ -86,20 +86,20 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, if e.errno == errno.ENOENT: continue if verbose: - print("unable to run %s" % dispcmd) + print('unable to run %s' % dispcmd) print(e) return None, None else: if verbose: - print("unable to find command, tried %s" % (commands,)) + print('unable to find command, tried %s' % (commands,)) return None, None stdout = p.communicate()[0].strip() if sys.version_info[0] >= 3: stdout = stdout.decode() if p.returncode != 0: if verbose: - print("unable to run %s (error)" % dispcmd) - print("stdout was %s" % stdout) + print('unable to run %s (error)' % dispcmd) + print('stdout was %s' % stdout) return None, p.returncode return stdout, p.returncode @@ -116,20 +116,20 @@ def versions_from_parentdir(parentdir_prefix, root, verbose): for i in range(3): dirname = os.path.basename(root) if dirname.startswith(parentdir_prefix): - return {"version": dirname[len(parentdir_prefix):], - "full-revisionid": None, - "dirty": False, "error": None, "date": None} + return {'version': dirname[len(parentdir_prefix):], + 'full-revisionid': None, + 'dirty': False, 'error': None, 'date': None} else: rootdirs.append(root) root = os.path.dirname(root) # up a level if verbose: - print("Tried directories %s but none started with prefix %s" % + print('Tried directories %s but none started with prefix %s' % (str(rootdirs), parentdir_prefix)) raise NotThisMethod("rootdir doesn't start with parentdir_prefix") -@register_vcs_handler("git", "get_keywords") +@register_vcs_handler('git', 'get_keywords') def git_get_keywords(versionfile_abs): """Extract version information from the given file.""" # the code embedded in _version.py can just fetch the value of these @@ -138,32 +138,32 @@ def git_get_keywords(versionfile_abs): # _version.py. keywords = {} try: - f = open(versionfile_abs, "r") + f = open(versionfile_abs, 'r') for line in f.readlines(): - if line.strip().startswith("git_refnames ="): + if line.strip().startswith('git_refnames ='): mo = re.search(r'=\s*"(.*)"', line) if mo: - keywords["refnames"] = mo.group(1) - if line.strip().startswith("git_full ="): + keywords['refnames'] = mo.group(1) + if line.strip().startswith('git_full ='): mo = re.search(r'=\s*"(.*)"', line) if mo: - keywords["full"] = mo.group(1) - if line.strip().startswith("git_date ="): + keywords['full'] = mo.group(1) + if line.strip().startswith('git_date ='): mo = re.search(r'=\s*"(.*)"', line) if mo: - keywords["date"] = mo.group(1) + keywords['date'] = mo.group(1) f.close() except EnvironmentError: pass return keywords -@register_vcs_handler("git", "keywords") +@register_vcs_handler('git', 'keywords') def git_versions_from_keywords(keywords, tag_prefix, verbose): """Get version information from git keywords.""" if not keywords: - raise NotThisMethod("no keywords at all, weird") - date = keywords.get("date") + raise NotThisMethod('no keywords at all, weird') + date = keywords.get('date') if date is not None: # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 @@ -171,16 +171,16 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): # it's been around since git-1.5.3, and it's too difficult to # discover which version we're using, or to work around using an # older one. - date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) - refnames = keywords["refnames"].strip() - if refnames.startswith("$Format"): + date = date.strip().replace(' ', 'T', 1).replace(' ', '', 1) + refnames = keywords['refnames'].strip() + if refnames.startswith('$Format'): if verbose: - print("keywords are unexpanded, not using") - raise NotThisMethod("unexpanded keywords, not a git-archive tarball") - refs = set([r.strip() for r in refnames.strip("()").split(",")]) + print('keywords are unexpanded, not using') + raise NotThisMethod('unexpanded keywords, not a git-archive tarball') + refs = set([r.strip() for r in refnames.strip('()').split(',')]) # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of # just "foo-1.0". If we see a "tag: " prefix, prefer those. - TAG = "tag: " + TAG = 'tag: ' tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) if not tags: # Either we're using git < 1.8.3, or there really are no tags. We use @@ -192,28 +192,28 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): # "stabilization", as well as "HEAD" and "master". tags = set([r for r in refs if re.search(r'\d', r)]) if verbose: - print("discarding '%s', no digits" % ",".join(refs - tags)) + print("discarding '%s', no digits" % ','.join(refs - tags)) if verbose: - print("likely tags: %s" % ",".join(sorted(tags))) + print('likely tags: %s' % ','.join(sorted(tags))) for ref in sorted(tags): # sorting will prefer e.g. "2.0" over "2.0rc1" if ref.startswith(tag_prefix): r = ref[len(tag_prefix):] if verbose: - print("picking %s" % r) - return {"version": r, - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": None, - "date": date} + print('picking %s' % r) + return {'version': r, + 'full-revisionid': keywords['full'].strip(), + 'dirty': False, 'error': None, + 'date': date} # no suitable tags, so version is "0+unknown", but full hex is still there if verbose: - print("no suitable tags, using unknown + full revision id") - return {"version": "0+unknown", - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": "no suitable tags", "date": None} + print('no suitable tags, using unknown + full revision id') + return {'version': '0+unknown', + 'full-revisionid': keywords['full'].strip(), + 'dirty': False, 'error': 'no suitable tags', 'date': None} -@register_vcs_handler("git", "pieces_from_vcs") +@register_vcs_handler('git', 'pieces_from_vcs') def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): """Get version from 'git describe' in the root of the source tree. @@ -221,55 +221,55 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): expanded, and _version.py hasn't already been rewritten with a short version string, meaning we're inside a checked out source tree. """ - GITS = ["git"] - if sys.platform == "win32": - GITS = ["git.cmd", "git.exe"] + GITS = ['git'] + if sys.platform == 'win32': + GITS = ['git.cmd', 'git.exe'] - out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, + out, rc = run_command(GITS, ['rev-parse', '--git-dir'], cwd=root, hide_stderr=True) if rc != 0: if verbose: - print("Directory %s not under git control" % root) + print('Directory %s not under git control' % root) raise NotThisMethod("'git rev-parse --git-dir' returned error") # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] # if there isn't one, this yields HEX[-dirty] (no NUM) - describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", - "--always", "--long", - "--match", "%s*" % tag_prefix], + describe_out, rc = run_command(GITS, ['describe', '--tags', '--dirty', + '--always', '--long', + '--match', '%s*' % tag_prefix], cwd=root) # --long was added in git-1.5.5 if describe_out is None: raise NotThisMethod("'git describe' failed") describe_out = describe_out.strip() - full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) + full_out, rc = run_command(GITS, ['rev-parse', 'HEAD'], cwd=root) if full_out is None: raise NotThisMethod("'git rev-parse' failed") full_out = full_out.strip() pieces = {} - pieces["long"] = full_out - pieces["short"] = full_out[:7] # maybe improved later - pieces["error"] = None + pieces['long'] = full_out + pieces['short'] = full_out[:7] # maybe improved later + pieces['error'] = None # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] # TAG might have hyphens. git_describe = describe_out # look for -dirty suffix - dirty = git_describe.endswith("-dirty") - pieces["dirty"] = dirty + dirty = git_describe.endswith('-dirty') + pieces['dirty'] = dirty if dirty: - git_describe = git_describe[:git_describe.rindex("-dirty")] + git_describe = git_describe[:git_describe.rindex('-dirty')] # now we have TAG-NUM-gHEX or HEX - if "-" in git_describe: + if '-' in git_describe: # TAG-NUM-gHEX mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) if not mo: # unparseable. Maybe git-describe is misbehaving? - pieces["error"] = ("unable to parse git-describe output: '%s'" + pieces['error'] = ("unable to parse git-describe output: '%s'" % describe_out) return pieces @@ -279,37 +279,37 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): if verbose: fmt = "tag '%s' doesn't start with prefix '%s'" print(fmt % (full_tag, tag_prefix)) - pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" + pieces['error'] = ("tag '%s' doesn't start with prefix '%s'" % (full_tag, tag_prefix)) return pieces - pieces["closest-tag"] = full_tag[len(tag_prefix):] + pieces['closest-tag'] = full_tag[len(tag_prefix):] # distance: number of commits since tag - pieces["distance"] = int(mo.group(2)) + pieces['distance'] = int(mo.group(2)) # commit: short hex revision ID - pieces["short"] = mo.group(3) + pieces['short'] = mo.group(3) else: # HEX: no tags - pieces["closest-tag"] = None - count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], + pieces['closest-tag'] = None + count_out, rc = run_command(GITS, ['rev-list', 'HEAD', '--count'], cwd=root) - pieces["distance"] = int(count_out) # total number of commits + pieces['distance'] = int(count_out) # total number of commits # commit date: see ISO-8601 comment in git_versions_from_keywords() - date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], + date = run_command(GITS, ['show', '-s', '--format=%ci', 'HEAD'], cwd=root)[0].strip() - pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + pieces['date'] = date.strip().replace(' ', 'T', 1).replace(' ', '', 1) return pieces def plus_or_dot(pieces): """Return a + if we don't already have one, else return a .""" - if "+" in pieces.get("closest-tag", ""): - return "." - return "+" + if '+' in pieces.get('closest-tag', ''): + return '.' + return '+' def render_pep440(pieces): @@ -321,19 +321,19 @@ def render_pep440(pieces): Exceptions: 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: + if pieces['closest-tag']: + rendered = pieces['closest-tag'] + if pieces['distance'] or pieces['dirty']: rendered += plus_or_dot(pieces) - rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) - if pieces["dirty"]: - rendered += ".dirty" + rendered += '%d.g%s' % (pieces['distance'], pieces['short']) + if pieces['dirty']: + rendered += '.dirty' else: # exception #1 - rendered = "0+untagged.%d.g%s" % (pieces["distance"], - pieces["short"]) - if pieces["dirty"]: - rendered += ".dirty" + rendered = '0+untagged.%d.g%s' % (pieces['distance'], + pieces['short']) + if pieces['dirty']: + rendered += '.dirty' return rendered @@ -343,13 +343,13 @@ def render_pep440_pre(pieces): Exceptions: 1: no tags. 0.post.devDISTANCE """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"]: - rendered += ".post.dev%d" % pieces["distance"] + if pieces['closest-tag']: + rendered = pieces['closest-tag'] + if pieces['distance']: + rendered += '.post.dev%d' % pieces['distance'] else: # exception #1 - rendered = "0.post.dev%d" % pieces["distance"] + rendered = '0.post.dev%d' % pieces['distance'] return rendered @@ -363,20 +363,20 @@ def render_pep440_post(pieces): Exceptions: 1: no tags. 0.postDISTANCE[.dev0] """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: - rendered += ".post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" + if pieces['closest-tag']: + rendered = pieces['closest-tag'] + if pieces['distance'] or pieces['dirty']: + rendered += '.post%d' % pieces['distance'] + if pieces['dirty']: + rendered += '.dev0' rendered += plus_or_dot(pieces) - rendered += "g%s" % pieces["short"] + rendered += 'g%s' % pieces['short'] else: # exception #1 - rendered = "0.post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" - rendered += "+g%s" % pieces["short"] + rendered = '0.post%d' % pieces['distance'] + if pieces['dirty']: + rendered += '.dev0' + rendered += '+g%s' % pieces['short'] return rendered @@ -388,17 +388,17 @@ def render_pep440_old(pieces): Eexceptions: 1: no tags. 0.postDISTANCE[.dev0] """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: - rendered += ".post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" + if pieces['closest-tag']: + rendered = pieces['closest-tag'] + if pieces['distance'] or pieces['dirty']: + rendered += '.post%d' % pieces['distance'] + if pieces['dirty']: + rendered += '.dev0' else: # exception #1 - rendered = "0.post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" + rendered = '0.post%d' % pieces['distance'] + if pieces['dirty']: + rendered += '.dev0' return rendered @@ -410,15 +410,15 @@ def render_git_describe(pieces): Exceptions: 1: no tags. HEX[-dirty] (note: no 'g' prefix) """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"]: - rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + if pieces['closest-tag']: + rendered = pieces['closest-tag'] + if pieces['distance']: + rendered += '-%d-g%s' % (pieces['distance'], pieces['short']) else: # exception #1 - rendered = pieces["short"] - if pieces["dirty"]: - rendered += "-dirty" + rendered = pieces['short'] + if pieces['dirty']: + rendered += '-dirty' return rendered @@ -431,47 +431,47 @@ def render_git_describe_long(pieces): Exceptions: 1: no tags. HEX[-dirty] (note: no 'g' prefix) """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + if pieces['closest-tag']: + rendered = pieces['closest-tag'] + rendered += '-%d-g%s' % (pieces['distance'], pieces['short']) else: # exception #1 - rendered = pieces["short"] - if pieces["dirty"]: - rendered += "-dirty" + rendered = pieces['short'] + if pieces['dirty']: + rendered += '-dirty' return rendered def render(pieces, style): """Render the given version pieces into the requested style.""" - if pieces["error"]: - return {"version": "unknown", - "full-revisionid": pieces.get("long"), - "dirty": None, - "error": pieces["error"], - "date": None} + if pieces['error']: + return {'version': 'unknown', + 'full-revisionid': pieces.get('long'), + 'dirty': None, + 'error': pieces['error'], + 'date': None} - if not style or style == "default": - style = "pep440" # the default + if not style or style == 'default': + style = 'pep440' # the default - if style == "pep440": + if style == 'pep440': rendered = render_pep440(pieces) - elif style == "pep440-pre": + elif style == 'pep440-pre': rendered = render_pep440_pre(pieces) - elif style == "pep440-post": + elif style == 'pep440-post': rendered = render_pep440_post(pieces) - elif style == "pep440-old": + elif style == 'pep440-old': rendered = render_pep440_old(pieces) - elif style == "git-describe": + elif style == 'git-describe': rendered = render_git_describe(pieces) - elif style == "git-describe-long": + elif style == 'git-describe-long': rendered = render_git_describe_long(pieces) else: raise ValueError("unknown style '%s'" % style) - return {"version": rendered, "full-revisionid": pieces["long"], - "dirty": pieces["dirty"], "error": None, - "date": pieces.get("date")} + return {'version': rendered, 'full-revisionid': pieces['long'], + 'dirty': pieces['dirty'], 'error': None, + 'date': pieces.get('date')} def get_versions(): @@ -498,10 +498,10 @@ def get_versions(): for i in cfg.versionfile_source.split('/'): root = os.path.dirname(root) except NameError: - return {"version": "0+unknown", "full-revisionid": None, - "dirty": None, - "error": "unable to find root of source tree", - "date": None} + return {'version': '0+unknown', 'full-revisionid': None, + 'dirty': None, + 'error': 'unable to find root of source tree', + 'date': None} try: pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) @@ -515,6 +515,6 @@ def get_versions(): except NotThisMethod: pass - return {"version": "0+unknown", "full-revisionid": None, - "dirty": None, - "error": "unable to compute version", "date": None} + return {'version': '0+unknown', 'full-revisionid': None, + 'dirty': None, + 'error': 'unable to compute version', 'date': None} diff --git a/jmopenorders/api/cleanoutputdir.py b/jmopenorders/api/cleanoutputdir.py index b832c09d..53e7a09e 100644 --- a/jmopenorders/api/cleanoutputdir.py +++ b/jmopenorders/api/cleanoutputdir.py @@ -61,6 +61,6 @@ def clean(self): """Before write the new excel files, remove the old ones.""" files = os.listdir(self.out_dir) for file in files: - if ".xlsx" in file: + if '.xlsx' in file: os.remove(file) logger.debug(file) diff --git a/jmopenorders/api/generateorders.py b/jmopenorders/api/generateorders.py index 24e17fc7..f5f61721 100644 --- a/jmopenorders/api/generateorders.py +++ b/jmopenorders/api/generateorders.py @@ -75,7 +75,7 @@ class GenerateOrders: def __init__(self, destdir): """Init the GenerateOrders Class.""" - self.dest_name = "" + self.dest_name = '' self.dest_dir = destdir def create(self, actual_name, actual_content): @@ -86,28 +86,28 @@ def create(self, actual_name, actual_content): # Create a workbook and add a worksheet. if self.dest_dir: self.dest_name = os.path.join( - os.path.abspath(self.dest_dir), actual_name + ".xlsx" + os.path.abspath(self.dest_dir), actual_name + '.xlsx' ) else: - self.dest_name = actual_name + ".xlsx" + self.dest_name = actual_name + '.xlsx' workbook = Workbook() sheet = workbook.active sheet.title = actual_name - sheet.sheet_properties.tabColor = "1072BA" + sheet.sheet_properties.tabColor = '1072BA' line_count = 0 for print_line in actual_content: logger.debug(print_line) - if "Auftrag Nr." in print_line[0]: + if 'Auftrag Nr.' in print_line[0]: # Write Header for item in print_line: - logger.debug("Header: " + item) + logger.debug('Header: ' + item) cell = sheet.cell(row=row_num, column=col_num) cell.value = item - cell.font = Font(name="Courier", size=12) - cell.style = "Title" - cell.number_format = "text" + cell.font = Font(name='Courier', size=12) + cell.style = 'Title' + cell.number_format = 'text' col_num += 1 row_num += 1 @@ -118,32 +118,32 @@ def create(self, actual_name, actual_content): line_count += 1 for item in print_line: logger.debug( - "Name: " + 'Name: ' + actual_name - + " Data: " + + ' Data: ' + item - + " Count: " + + ' Count: ' + str(line_count) ) logger.debug( - "row_num: " + str(row_num) + " col_num: " + str(col_num) + 'row_num: ' + str(row_num) + ' col_num: ' + str(col_num) ) # Tage offen ist eine ganze Zahl if col_num == 3: cell = sheet.cell(row=row_num, column=col_num) cell.value = item - cell.number_format = "dd.mm.yyyy" + cell.number_format = 'dd.mm.yyyy' # Tage offen ist eine ganze Zahl elif col_num == 4: cell = sheet.cell(row=row_num, column=col_num) cell.value = float(item) - cell.number_format = "#,##0.00" + cell.number_format = '#,##0.00' # Alles was nach Deb-Name ist, ist eine reale Zahl elif col_num > 7: cell = sheet.cell(row=row_num, column=col_num) cell.value = float(item) - cell.number_format = "#,##0.00_€" + cell.number_format = '#,##0.00_€' else: sheet.cell(row=row_num, column=col_num).value = item diff --git a/jmopenorders/api/getdata.py b/jmopenorders/api/getdata.py index 273b85d1..961bd08d 100644 --- a/jmopenorders/api/getdata.py +++ b/jmopenorders/api/getdata.py @@ -72,8 +72,8 @@ def get(self) -> list: """Get the data from the csv-file.""" # global orders_file try: - with open(self.file_name, "r") as orders_file: - orders = csv.reader(orders_file, delimiter=";", quotechar='"') + with open(self.file_name, 'r') as orders_file: + orders = csv.reader(orders_file, delimiter=';', quotechar='"') data = list(orders) return data diff --git a/jmopenorders/api/getserviceperson.py b/jmopenorders/api/getserviceperson.py index 9fde2d8c..ef29800e 100644 --- a/jmopenorders/api/getserviceperson.py +++ b/jmopenorders/api/getserviceperson.py @@ -60,18 +60,18 @@ def get(self) -> list: """ service_person = [] try: - with open(self.file_name, "r") as berater_file: + with open(self.file_name, 'r') as berater_file: self.berater = csv.DictReader( - berater_file, delimiter=";", quotechar='"' + berater_file, delimiter=';', quotechar='"' ) for row in self.berater: - service_person.append(row["Name"]) + service_person.append(row['Name']) return service_person except IOError: logger.debug( - "The File for the service persons %s does not exists", self.file_name + 'The File for the service persons %s does not exists', self.file_name ) diff --git a/jmopenorders/api/hello.py b/jmopenorders/api/hello.py index 0daf4707..82ec897d 100644 --- a/jmopenorders/api/hello.py +++ b/jmopenorders/api/hello.py @@ -1,7 +1,7 @@ from ..core.logger import logger -def hello(name="World") -> str: - logger.debug("executing hello command") +def hello(name='World') -> str: + logger.debug('executing hello command') - return "Hello, {:s}!".format(name) # TODO: use f-string fr python 3.6+ + return 'Hello, {:s}!'.format(name) # TODO: use f-string fr python 3.6+ diff --git a/jmopenorders/api/report.py b/jmopenorders/api/report.py index 53e49272..a58af2c3 100644 --- a/jmopenorders/api/report.py +++ b/jmopenorders/api/report.py @@ -9,15 +9,15 @@ def report( - personfile="names.csv", datafile="data.csv", inputpath="home", outputpath="out" + personfile='names.csv', datafile='data.csv', inputpath='home', outputpath='out' ) -> str: - logger.debug("executing report command") + logger.debug('executing report command') # combine the inputpath with the personfile name persondata_file = os.path.join(os.path.abspath(inputpath), personfile) - logger.debug("Personfile= %s", persondata_file) + logger.debug('Personfile= %s', persondata_file) # Get the names of the persons to an arrary names = getserviceperson.GetServicePerson(persondata_file) @@ -32,12 +32,12 @@ def report( if type(berater) is list: for actual_berater in berater: - logger.debug("actual_berater: " + actual_berater) + logger.debug('actual_berater: ' + actual_berater) berater_name = actual_berater - logger.debug("Berater Name: " + berater_name) + logger.debug('Berater Name: ' + berater_name) create_table = generateorders.GenerateOrders(outputpath) create_table.create(actual_name=berater_name, actual_content=orders) else: - logger.critical("Berater file is empty or not exist") + logger.critical('Berater file is empty or not exist') - return "Hello, {:s}!".format(personfile) + return 'Hello, {:s}!'.format(personfile) diff --git a/jmopenorders/cli.py b/jmopenorders/cli.py index e2db9514..9a500c81 100644 --- a/jmopenorders/cli.py +++ b/jmopenorders/cli.py @@ -61,8 +61,8 @@ def main(argv=None): :return: exit status """ args = _args(argv) - logger.start(args.warn or "DEBUG") # can't use default from config yet - logger.debug("starting execution") + logger.start(args.warn or 'DEBUG') # can't use default from config yet + logger.debug('starting execution') config.load(args.config) config.core.config = args.config if args.warn: @@ -80,7 +80,7 @@ def main(argv=None): except RuntimeError as err: logger.critical(err) return 1 - logger.debug("sucessful completion") + logger.debug('sucessful completion') return 0 @@ -92,33 +92,33 @@ def _args(argv): """ parser = ArgumentParser() parser.add_argument( - "-c", "--config", action="append", help="config file [etc/config.yml]" + '-c', '--config', action='append', help='config file [etc/config.yml]' ) parser.add_argument( - "-v", - "--version", - action="version", - version="jmopenorders {:s}".format(__version__), - help="print version and exit", + '-v', + '--version', + action='version', + version='jmopenorders {:s}'.format(__version__), + help='print version and exit', ) parser.add_argument( - "-w", "--warn", default="WARN", help="logger warning level [WARN]" + '-w', '--warn', default='WARN', help='logger warning level [WARN]' ) - parser.add_argument("-i", "--inputpath", type=str, help="inputpath for data") + parser.add_argument('-i', '--inputpath', type=str, help='inputpath for data') parser.add_argument( - "-o", "--outputpath", type=str, help="outputpath to write files" + '-o', '--outputpath', type=str, help='outputpath to write files' ) - parser.add_argument("-p", "--personfile", type=str, help="the names to report") - parser.add_argument("-d", "--datafile", type=str, help="the datafile") + parser.add_argument('-p', '--personfile', type=str, help='the names to report') + parser.add_argument('-d', '--datafile', type=str, help='the datafile') common = ArgumentParser(add_help=False) # common subcommand arguments - common.add_argument("-n", "--name", default="World", help="greeting name") - subparsers = parser.add_subparsers(title="subcommand") + common.add_argument('-n', '--name', default='World', help='greeting name') + subparsers = parser.add_subparsers(title='subcommand') _report(subparsers, common) args = parser.parse_args(argv) if not args.config: # Don't specify this as an argument default or else it will always be # included it the list. - args.config = "etc/config.yml" + args.config = 'etc/config.yml' return args @@ -130,7 +130,7 @@ def _hello(subparsers, common): :param common: parser for common subcommand arguments """ - parser = subparsers.add_parser("hello", parents=[common]) + parser = subparsers.add_parser('hello', parents=[common]) parser.set_defaults(commands=hello) return @@ -142,17 +142,17 @@ def _report(subparsers, common): :param common: parser for common subcommand arguments """ - parser = subparsers.add_parser("report", parents=[common]) + parser = subparsers.add_parser('report', parents=[common]) parser.set_defaults(commands=report) return # Make the module executable. -if __name__ == "__main__": +if __name__ == '__main__': try: status = main() except Exception: - logger.critical("shutting down due to fatal error") + logger.critical('shutting down due to fatal error') raise # print stack trace else: raise SystemExit(status) diff --git a/jmopenorders/core/config.py b/jmopenorders/core/config.py index 1f78435a..b53acc93 100644 --- a/jmopenorders/core/config.py +++ b/jmopenorders/core/config.py @@ -10,7 +10,7 @@ from .logger import logger -__all__ = "config", "YamlConfig" +__all__ = 'config', 'YamlConfig' class _AttrDict(dict): @@ -90,11 +90,11 @@ def replace(match): # This allows for multi-pattern substitution in a single pass. return macros[match.group(0)] - macros = {r"%{:s};".format(key): val for (key, val) in + macros = {r'%{:s};'.format(key): val for (key, val) in macros.items()} if macros else {} - regex = compile("|".join(macros) or r"^(?!)") + regex = compile('|'.join(macros) or r'^(?!)') for path in [path] if isinstance(path, str) else path: - with open(path, "r") as stream: + with open(path, 'r') as stream: # Global text substitution is used for macro replacement. Two # drawbacks of this are 1) the entire config file has to be # read into memory first; 2) it might be nice if comments were @@ -110,7 +110,7 @@ def replace(match): else: self.update(data) except TypeError: # data is None - logger.warning("config file {:s} is empty".format(path)) + logger.warning('config file {:s} is empty'.format(path)) return diff --git a/jmopenorders/core/logger.py b/jmopenorders/core/logger.py index 3d018a20..786d8037 100644 --- a/jmopenorders/core/logger.py +++ b/jmopenorders/core/logger.py @@ -10,7 +10,7 @@ from logging import StreamHandler -__all__ = "logger", "Logger" +__all__ = 'logger', 'Logger' class Logger(_Logger): @@ -18,7 +18,7 @@ class Logger(_Logger): """ - LOGFMT = "%(asctime)s;%(levelname)s;%(name)s;%(message)s" + LOGFMT = '%(asctime)s;%(levelname)s;%(name)s;%(message)s' def __init__(self, name=None): """ Initialize this logger. @@ -33,11 +33,11 @@ def __init__(self, name=None): # to whether the logger has been started yet. The standard Logger API # may be used to add and remove additional handlers, but the # NullHandler should always be left in place. - super(Logger, self).__init__(name or __name__.split(".")[0]) + super(Logger, self).__init__(name or __name__.split('.')[0]) self.addHandler(NullHandler()) # default to no output return - def start(self, level="WARN", stream=None): + def start(self, level='WARN', stream=None): """ Start logging to a stream. Until the logger is started, no messages will be emitted. This applies diff --git a/junit.xml b/junit.xml index 4860b614..dde36d0d 100644 --- a/junit.xml +++ b/junit.xml @@ -1,21 +1,21 @@ -ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_api.py'. +ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_api.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/test_api.py:11: in <module> from jmopenorders.api.hello import hello # tests __all__ -E ImportError: No module named jmopenorders.api.helloImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_cli.py'. +E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_cli.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/test_cli.py:15: in <module> from jmopenorders.cli import main -E ImportError: No module named jmopenorders.cliImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_config.py'. +E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_config.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/core/test_config.py:14: in <module> from jmopenorders.core.config import YamlConfig -E ImportError: No module named jmopenorders.core.configImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_logger.py'. +E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_logger.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/core/test_logger.py:15: in <module> from jmopenorders.core.logger import Logger -E ImportError: No module named jmopenorders.core.logger \ No newline at end of file +E ModuleNotFoundError: No module named 'jmopenorders' \ No newline at end of file diff --git a/resources/icons/app.svg b/resources/icons/app.svg old mode 100755 new mode 100644 diff --git a/resources/icons/demo.svg b/resources/icons/demo.svg old mode 100755 new mode 100644 diff --git a/setup.py b/setup.py index 8319e713..751316a1 100644 --- a/setup.py +++ b/setup.py @@ -54,49 +54,49 @@ def get_long_description() -> str: - readme_rst = os.path.join(CURRENT_DIR, "README.rst") + readme_rst = os.path.join(CURRENT_DIR, 'README.rst') - with io.open(readme_rst, "rt", encoding="utf8") as f: + with io.open(readme_rst, 'rt', encoding='utf8') as f: readme = f.read() -MIN_PY_VERSION = "3.6" -PROJECT_NAME = "JM OpenOrders" +MIN_PY_VERSION = '3.6' +PROJECT_NAME = 'JM OpenOrders' PROJECT_DESCRIPTION = ( - "jmopenorders is a generator to generate infos for the affected persons" + 'jmopenorders is a generator to generate infos for the affected persons' ) -PROJECT_PACKAGE_NAME = "jmopenorders" -PROJECT_LICENSE = "EUPL-1.2 " -PROJECT_AUTHOR = "Jürgen Mülbert" -PROJECT_COPYRIGHT = " 2018-{}, {}".format(dt.now().year, PROJECT_AUTHOR) -PROJECT_URL = "https://jmopenorders.github.io/" -PROJECT_EMAIL = "juergen.muelbert@gmail.com" +PROJECT_PACKAGE_NAME = 'jmopenorders' +PROJECT_LICENSE = 'EUPL-1.2 ' +PROJECT_AUTHOR = 'Jürgen Mülbert' +PROJECT_COPYRIGHT = ' 2018-{}, {}'.format(dt.now().year, PROJECT_AUTHOR) +PROJECT_URL = 'https://jmopenorders.github.io/' +PROJECT_EMAIL = 'juergen.muelbert@gmail.com' -PROJECT_GITHUB_USERNAME = "jmuelbert" -PROJECT_GITHUB_REPOSITORY = "jmopenorders" +PROJECT_GITHUB_USERNAME = 'jmuelbert' +PROJECT_GITHUB_REPOSITORY = 'jmopenorders' -PYPI_URL = "https://pypi.python.org/pypi/{}".format(PROJECT_PACKAGE_NAME) -GITHUB_PATH = "{}/{}".format(PROJECT_GITHUB_USERNAME, PROJECT_GITHUB_REPOSITORY) -GITHUB_URL = "https://github.com/{}".format(GITHUB_PATH) +PYPI_URL = 'https://pypi.python.org/pypi/{}'.format(PROJECT_PACKAGE_NAME) +GITHUB_PATH = '{}/{}'.format(PROJECT_GITHUB_USERNAME, PROJECT_GITHUB_REPOSITORY) +GITHUB_URL = 'https://github.com/{}'.format(GITHUB_PATH) -DOWNLOAD_URL = "{}/archive/{}.zip".format(GITHUB_URL, versioneer.get_version()) +DOWNLOAD_URL = '{}/archive/{}.zip'.format(GITHUB_URL, versioneer.get_version()) PROJECT_URLS = { - "Source Code": "{GITHUB_URL}", - "Bug Reports": "{}/issues".format(GITHUB_URL), - "Documentation": "https://readthedocs.org/projects/{}".format(PROJECT_PACKAGE_NAME), + 'Source Code': '{GITHUB_URL}', + 'Bug Reports': '{}/issues'.format(GITHUB_URL), + 'Documentation': 'https://readthedocs.org/projects/{}'.format(PROJECT_PACKAGE_NAME), } # 'setup.py publish' shortcut. -if sys.argv[-1] == "publish": - os.system("python setup.py sdist bdist_wheel") - os.system("twine upload dist/*") +if sys.argv[-1] == 'publish': + os.system('python setup.py sdist bdist_wheel') + os.system('twine upload dist/*') sys.exit() -PACKAGES = find_packages(exclude=["tests", "tests.*"]) +PACKAGES = find_packages(exclude=['tests', 'tests.*']) -REQUIREMENTS = ["pexpect", "openpyxl", "python-slugify"] +REQUIREMENTS = ['pexpect', 'openpyxl', 'python-slugify'] -test_requirements = ["tox"] +test_requirements = ['tox'] extras_require = {} @@ -104,7 +104,7 @@ def get_long_description() -> str: name=PROJECT_PACKAGE_NAME, description=PROJECT_DESCRIPTION, long_description=get_long_description(), - long_description_content_type="text/markdown", + long_description_content_type='text/markdown', url=PROJECT_URL, download_url=DOWNLOAD_URL, project_urls=PROJECT_URLS, @@ -114,10 +114,10 @@ def get_long_description() -> str: include_package_data=True, zip_safe=False, install_requires=REQUIREMENTS, - python_requires=">={}".format(MIN_PY_VERSION), - test_suite="tests", + python_requires='>={}'.format(MIN_PY_VERSION), + test_suite='tests', tests_require=test_requirements, - entry_points={"console_scripts": ["jmopenorders=jmopenorders.cli:main"]}, + entry_points={'console_scripts': ['jmopenorders=jmopenorders.cli:main']}, version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), ) diff --git a/tests/core/test_config.py b/tests/core/test_config.py index b99be65c..7b55541a 100644 --- a/tests/core/test_config.py +++ b/tests/core/test_config.py @@ -26,9 +26,9 @@ def files(cls, tmpdir): """ configs = ( - (tmpdir.join("empty.yml"), None), - (tmpdir.join("conf1.yml"), {"global": "%x1;", "%x1;": "%x1;"}), - (tmpdir.join("conf2.yml"), {"global": "%x2;", "%x2;": "%x2;"}), + (tmpdir.join('empty.yml'), None), + (tmpdir.join('conf1.yml'), {'global': '%x1;', '%x1;': '%x1;'}), + (tmpdir.join('conf2.yml'), {'global': '%x2;', '%x2;': '%x2;'}), ) for pathobj, values in configs: pathobj.write(dump(values)) @@ -39,9 +39,9 @@ def test_item(self): """ config = YamlConfig() - config["root"] = {} - config["root"]["key"] = "value" - assert config["root"]["key"] == "value" + config['root'] = {} + config['root']['key'] = 'value' + assert config['root']['key'] == 'value' return def test_attr(self): @@ -50,17 +50,17 @@ def test_attr(self): """ config = YamlConfig() config.root = {} - config.root.key = "value" - assert config.root.key == "value" + config.root.key = 'value' + assert config.root.key == 'value' return - @pytest.mark.parametrize("root", (None, "root")) + @pytest.mark.parametrize('root', (None, 'root')) def test_init(self, files, root): """ Test the __init__() method for loading a file. """ - merged = {"global": "conf2", "conf1": "conf1", "conf2": "conf2"} - macros = {"x1": "conf1", "x2": "conf2"} + merged = {'global': 'conf2', 'conf1': 'conf1', 'conf2': 'conf2'} + macros = {'x1': 'conf1', 'x2': 'conf2'} config = YamlConfig(files, root, macros) if root: assert config == {root: merged} @@ -68,13 +68,13 @@ def test_init(self, files, root): assert config == merged return - @pytest.mark.parametrize("root", (None, "root")) + @pytest.mark.parametrize('root', (None, 'root')) def test_load(self, files, root): """ Test the load() method. """ - merged = {"global": "conf2", "conf1": "conf1", "conf2": "conf2"} - macros = {"x1": "conf1", "x2": "conf2"} + merged = {'global': 'conf2', 'conf1': 'conf1', 'conf2': 'conf2'} + macros = {'x1': 'conf1', 'x2': 'conf2'} config = YamlConfig() config.load(files, root, macros) if root: @@ -86,5 +86,5 @@ def test_load(self, files, root): # Make the module executable. -if __name__ == "__main__": +if __name__ == '__main__': raise SystemExit(pytest.main([__file__])) diff --git a/tests/core/test_logger.py b/tests/core/test_logger.py index 34842342..491ce4ae 100644 --- a/tests/core/test_logger.py +++ b/tests/core/test_logger.py @@ -24,9 +24,9 @@ def test_start(self, capsys): """ Test the start method. """ - message = "test message" + message = 'test message' logger = Logger() - logger.start("debug") + logger.start('debug') logger.debug(message) _, stderr = capsys.readouterr() assert logger.level == DEBUG @@ -38,9 +38,9 @@ def test_stop(self, capsys): """ logger = Logger() - logger.start("debug") + logger.start('debug') logger.stop() - logger.critical("test") + logger.critical('test') _, stderr = capsys.readouterr() assert not stderr return @@ -49,10 +49,10 @@ def test_stream(self): """ Test output to an alternate stream. """ - message = "test message" + message = 'test message' stream = StringIO() logger = Logger() - logger.start("debug", stream) + logger.start('debug', stream) logger.debug(message) assert message in stream.getvalue() return @@ -60,5 +60,5 @@ def test_stream(self): # Make the module executable. -if __name__ == "__main__": +if __name__ == '__main__': raise SystemExit(pytest.main([__file__])) diff --git a/tests/generate_test_data.py b/tests/generate_test_data.py index 61021620..16ef01da 100644 --- a/tests/generate_test_data.py +++ b/tests/generate_test_data.py @@ -59,8 +59,8 @@ def __init__(self, myDataPath, l18n): self.workshop_count = 0 self.part_count = 0 - if l18n == "": - l18n = "de_DE" + if l18n == '': + l18n = 'de_DE' self.fake = Factory.create(l18n) @@ -68,44 +68,44 @@ def generate_part_person(self, count): """Generate random names for parts-person.""" for _ in range(0, count): self.part_person.append( - self.fake.first_name() + " " + self.fake.last_name() + self.fake.first_name() + ' ' + self.fake.last_name() ) def generate_service_person(self, count): """Generate random names for service persons.""" for _ in range(0, count): self.service_person.append( - self.fake.last_name() + ", " + self.fake.first_name() + self.fake.last_name() + ', ' + self.fake.first_name() ) def generate_header(self): """Generate Headers.""" - line = ["", "", "", "", "", "", "OFFENE AUFTRÄGE"] + line = ['', '', '', '', '', '', 'OFFENE AUFTRÄGE'] self.order_list.append(line) - line = ["MANDANT", ""] + line = ['MANDANT', ''] self.order_list.append(line) - line = ["Filiale", "", self.fake.random_int(1, 10)] + line = ['Filiale', '', self.fake.random_int(1, 10)] self.order_list.append(line) - line = ["BENUTZER-ID", ""] + line = ['BENUTZER-ID', ''] self.order_list.append(line) - line = ["Bereich", "Wekstatt & Teile"] + line = ['Bereich', 'Wekstatt & Teile'] self.order_list.append(line) - self.order_list.append("") + self.order_list.append('') line = [ - "", - "Auftrag Nr.", - "Hauptbereich", - "Auftragsdatum", - "Tage offen", - "Deb.-Nr.", - "Deb.-Name", - "Verkäufer Serviceberater", - "Arbeitswert", - "Teile", - "Fremdleistung", - "Andere", - "Gesamt", - "Auftragswert bereits geliefert", + '', + 'Auftrag Nr.', + 'Hauptbereich', + 'Auftragsdatum', + 'Tage offen', + 'Deb.-Nr.', + 'Deb.-Name', + 'Verkäufer Serviceberater', + 'Arbeitswert', + 'Teile', + 'Fremdleistung', + 'Andere', + 'Gesamt', + 'Auftragswert bereits geliefert', ] self.order_list.append(line) @@ -115,16 +115,16 @@ def generate_orders(self, count=20, workshop=True): for _ in range(0, count): if workshop is True: self.workshop_count = count - line = ["", "WK" + self.fake.numerify(text="######"), "Werkstatt"] + line = ['', 'WK' + self.fake.numerify(text='######'), 'Werkstatt'] else: self.part_count = count - line = ["", "ET" + self.fake.numerify(text="######"), "Teile"] - fake_date = self.fake.date_between(start_date="-2y", end_date="+1y") - line.append(fake_date.strftime("%d.%m.%Y")) + line = ['', 'ET' + self.fake.numerify(text='######'), 'Teile'] + fake_date = self.fake.date_between(start_date='-2y', end_date='+1y') + line.append(fake_date.strftime('%d.%m.%Y')) date_now = date.today() delta = date_now - fake_date line.append(delta.days) - line.append(self.fake.numerify(text="######")) + line.append(self.fake.numerify(text='######')) line.append(self.fake.name()) if workshop is True: line.append( @@ -137,43 +137,43 @@ def generate_orders(self, count=20, workshop=True): self.part_person[self.fake.random_int(0, len(self.part_person) - 1)] ) if workshop is True: - line.append(self.fake.numerify(text="####,##")) + line.append(self.fake.numerify(text='####,##')) else: - line.append("0,00") - line.append(self.fake.numerify(text="####,##")) + line.append('0,00') + line.append(self.fake.numerify(text='####,##')) if workshop is True: - line.append(self.fake.numerify(text="####,##")) - line.append(self.fake.numerify(text="####,##")) + line.append(self.fake.numerify(text='####,##')) + line.append(self.fake.numerify(text='####,##')) else: - line.append("0,00") - line.append("0,00") - line.append(self.fake.numerify(text="####,##")) - line.append(self.fake.numerify(text="####,##")) + line.append('0,00') + line.append('0,00') + line.append(self.fake.numerify(text='####,##')) + line.append(self.fake.numerify(text='####,##')) self.order_list.append(line) def generate_splitter(self, workshop=True): """Generate a sub header.""" - self.order_list.append("") + self.order_list.append('') if workshop is True: - line = ["Gesamt Werkstatt", self.workshop_count] + line = ['Gesamt Werkstatt', self.workshop_count] else: - line = ["Gesamt Teile", self.part_count] + line = ['Gesamt Teile', self.part_count] self.order_list.append(line) if workshop is True: line = [ - "Durchschnitt Werkstatt", + 'Durchschnitt Werkstatt', self.fake.random_int(1, self.workshop_count), ] else: - line = ["Durchschnitt Werkstatt", self.fake.random_int(1, self.part_count)] + line = ['Durchschnitt Werkstatt', self.fake.random_int(1, self.part_count)] self.order_list.append(line) - self.order_list.append("") + self.order_list.append('') def csv_output(self, name): """Write the data to a csv-file.""" - with open(os.path.join(self.data_path, name), "w", newline="") as csvfile: - orderswriter = csv.writer(csvfile, delimiter=";") + with open(os.path.join(self.data_path, name), 'w', newline='') as csvfile: + orderswriter = csv.writer(csvfile, delimiter=';') for row in self.order_list: orderswriter.writerow(row) @@ -196,7 +196,7 @@ def xlsx_output(self, name): def main(): """Entrypoint to generate test data.""" - orders = CreateFakeOrders(".", "de_DE") + orders = CreateFakeOrders('.', 'de_DE') orders.generate_part_person(20) orders.generate_service_person(50) orders.generate_header() @@ -204,9 +204,9 @@ def main(): orders.generate_splitter(workshop=True) orders.generate_orders(count=200, workshop=False) orders.generate_splitter(workshop=False) - orders.csv_output("orders.csv") - orders.xlsx_output("orders.xlsx") + orders.csv_output('orders.csv') + orders.xlsx_output('orders.xlsx') -if __name__ == "__main__": +if __name__ == '__main__': main() diff --git a/tests/test_api.py b/tests/test_api.py index 71e7292e..47fcdd19 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -16,7 +16,7 @@ def test_hello(): """ Test the hello() function. """ - assert hello() == "Hello, World!" + assert hello() == 'Hello, World!' return @@ -24,7 +24,7 @@ def test_hello_name(): """ Test the hello() function with a name. """ - assert hello("foo") == "Hello, foo!" + assert hello('foo') == 'Hello, foo!' return @@ -32,7 +32,7 @@ def test_report(): """ Test the report() function. """ - assert report() == "Hello, names.csv!" + assert report() == 'Hello, names.csv!' return @@ -40,11 +40,11 @@ def test_report_name(): """ Test the report() function with a name. """ - assert report("foo") == "Hello, foo!" + assert report('foo') == 'Hello, foo!' return # Make the script executable. -if __name__ == "__main__": +if __name__ == '__main__': raise SystemExit(pytest.main([__file__])) diff --git a/tests/test_cli.py b/tests/test_cli.py index f794725a..1d343807 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -15,7 +15,7 @@ from jmopenorders.cli import main -@pytest.fixture(params=("report",)) +@pytest.fixture(params=('report',)) def command(request): """ Return the command to run. @@ -29,7 +29,7 @@ def test_main(command): """ # Call with the --help option as a basic sanity check. with pytest.raises(SystemExit) as exinfo: - main(("{:s}".format(command), "--help")) + main(('{:s}'.format(command), '--help')) assert 0 == exinfo.value.code return @@ -38,7 +38,7 @@ def test_script(command): """ Test command line execution. """ # Call with the --help option as a basic sanity check. - cmdl = "{:s} -m jmopenorders.cli {:s} --help".format(executable, command) + cmdl = '{:s} -m jmopenorders.cli {:s} --help'.format(executable, command) assert 0 == call(cmdl.split()) return @@ -46,5 +46,5 @@ def test_script(command): # Make the script executable. -if __name__ == "__main__": +if __name__ == '__main__': raise SystemExit(pytest.main([__file__])) diff --git a/versioneer.py b/versioneer.py index 64fea1c8..60cead8f 100644 --- a/versioneer.py +++ b/versioneer.py @@ -300,18 +300,18 @@ def get_root(): directory that contains setup.py, setup.cfg, and versioneer.py . """ root = os.path.realpath(os.path.abspath(os.getcwd())) - setup_py = os.path.join(root, "setup.py") - versioneer_py = os.path.join(root, "versioneer.py") + setup_py = os.path.join(root, 'setup.py') + versioneer_py = os.path.join(root, 'versioneer.py') if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)): # allow 'python path/to/setup.py COMMAND' root = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0]))) - setup_py = os.path.join(root, "setup.py") - versioneer_py = os.path.join(root, "versioneer.py") + setup_py = os.path.join(root, 'setup.py') + versioneer_py = os.path.join(root, 'versioneer.py') if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)): - err = ("Versioneer was unable to run the project root directory. " - "Versioneer requires setup.py to be executed from " + err = ('Versioneer was unable to run the project root directory. ' + 'Versioneer requires setup.py to be executed from ' "its immediate directory (like 'python setup.py COMMAND'), " - "or in a way that lets it use sys.argv[0] to find the root " + 'or in a way that lets it use sys.argv[0] to find the root ' "(like 'python path/to/setup.py COMMAND').") raise VersioneerBadRootError(err) try: @@ -325,7 +325,7 @@ def get_root(): me_dir = os.path.normcase(os.path.splitext(me)[0]) vsr_dir = os.path.normcase(os.path.splitext(versioneer_py)[0]) if me_dir != vsr_dir: - print("Warning: build in %s is using versioneer.py from %s" + print('Warning: build in %s is using versioneer.py from %s' % (os.path.dirname(me), versioneer_py)) except NameError: pass @@ -338,26 +338,26 @@ def get_config_from_root(root): # configparser.NoSectionError (if it lacks a [versioneer] section), or # configparser.NoOptionError (if it lacks "VCS="). See the docstring at # the top of versioneer.py for instructions on writing your setup.cfg . - setup_cfg = os.path.join(root, "setup.cfg") + setup_cfg = os.path.join(root, 'setup.cfg') parser = configparser.SafeConfigParser() - with open(setup_cfg, "r") as f: + with open(setup_cfg, 'r') as f: parser.readfp(f) - VCS = parser.get("versioneer", "VCS") # mandatory + VCS = parser.get('versioneer', 'VCS') # mandatory def get(parser, name): - if parser.has_option("versioneer", name): - return parser.get("versioneer", name) + if parser.has_option('versioneer', name): + return parser.get('versioneer', name) return None cfg = VersioneerConfig() cfg.VCS = VCS - cfg.style = get(parser, "style") or "" - cfg.versionfile_source = get(parser, "versionfile_source") - cfg.versionfile_build = get(parser, "versionfile_build") - cfg.tag_prefix = get(parser, "tag_prefix") + cfg.style = get(parser, 'style') or '' + cfg.versionfile_source = get(parser, 'versionfile_source') + cfg.versionfile_build = get(parser, 'versionfile_build') + cfg.tag_prefix = get(parser, 'tag_prefix') if cfg.tag_prefix in ("''", '""'): - cfg.tag_prefix = "" - cfg.parentdir_prefix = get(parser, "parentdir_prefix") - cfg.verbose = get(parser, "verbose") + cfg.tag_prefix = '' + cfg.parentdir_prefix = get(parser, 'parentdir_prefix') + cfg.verbose = get(parser, 'verbose') return cfg @@ -400,20 +400,20 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, if e.errno == errno.ENOENT: continue if verbose: - print("unable to run %s" % dispcmd) + print('unable to run %s' % dispcmd) print(e) return None, None else: if verbose: - print("unable to find command, tried %s" % (commands,)) + print('unable to find command, tried %s' % (commands,)) return None, None stdout = p.communicate()[0].strip() if sys.version_info[0] >= 3: stdout = stdout.decode() if p.returncode != 0: if verbose: - print("unable to run %s (error)" % dispcmd) - print("stdout was %s" % stdout) + print('unable to run %s (error)' % dispcmd) + print('stdout was %s' % stdout) return None, p.returncode return stdout, p.returncode @@ -941,7 +941,7 @@ def get_versions(): ''' -@register_vcs_handler("git", "get_keywords") +@register_vcs_handler('git', 'get_keywords') def git_get_keywords(versionfile_abs): """Extract version information from the given file.""" # the code embedded in _version.py can just fetch the value of these @@ -950,32 +950,32 @@ def git_get_keywords(versionfile_abs): # _version.py. keywords = {} try: - f = open(versionfile_abs, "r") + f = open(versionfile_abs, 'r') for line in f.readlines(): - if line.strip().startswith("git_refnames ="): + if line.strip().startswith('git_refnames ='): mo = re.search(r'=\s*"(.*)"', line) if mo: - keywords["refnames"] = mo.group(1) - if line.strip().startswith("git_full ="): + keywords['refnames'] = mo.group(1) + if line.strip().startswith('git_full ='): mo = re.search(r'=\s*"(.*)"', line) if mo: - keywords["full"] = mo.group(1) - if line.strip().startswith("git_date ="): + keywords['full'] = mo.group(1) + if line.strip().startswith('git_date ='): mo = re.search(r'=\s*"(.*)"', line) if mo: - keywords["date"] = mo.group(1) + keywords['date'] = mo.group(1) f.close() except EnvironmentError: pass return keywords -@register_vcs_handler("git", "keywords") +@register_vcs_handler('git', 'keywords') def git_versions_from_keywords(keywords, tag_prefix, verbose): """Get version information from git keywords.""" if not keywords: - raise NotThisMethod("no keywords at all, weird") - date = keywords.get("date") + raise NotThisMethod('no keywords at all, weird') + date = keywords.get('date') if date is not None: # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 @@ -983,16 +983,16 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): # it's been around since git-1.5.3, and it's too difficult to # discover which version we're using, or to work around using an # older one. - date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) - refnames = keywords["refnames"].strip() - if refnames.startswith("$Format"): + date = date.strip().replace(' ', 'T', 1).replace(' ', '', 1) + refnames = keywords['refnames'].strip() + if refnames.startswith('$Format'): if verbose: - print("keywords are unexpanded, not using") - raise NotThisMethod("unexpanded keywords, not a git-archive tarball") - refs = set([r.strip() for r in refnames.strip("()").split(",")]) + print('keywords are unexpanded, not using') + raise NotThisMethod('unexpanded keywords, not a git-archive tarball') + refs = set([r.strip() for r in refnames.strip('()').split(',')]) # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of # just "foo-1.0". If we see a "tag: " prefix, prefer those. - TAG = "tag: " + TAG = 'tag: ' tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) if not tags: # Either we're using git < 1.8.3, or there really are no tags. We use @@ -1004,28 +1004,28 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): # "stabilization", as well as "HEAD" and "master". tags = set([r for r in refs if re.search(r'\d', r)]) if verbose: - print("discarding '%s', no digits" % ",".join(refs - tags)) + print("discarding '%s', no digits" % ','.join(refs - tags)) if verbose: - print("likely tags: %s" % ",".join(sorted(tags))) + print('likely tags: %s' % ','.join(sorted(tags))) for ref in sorted(tags): # sorting will prefer e.g. "2.0" over "2.0rc1" if ref.startswith(tag_prefix): r = ref[len(tag_prefix):] if verbose: - print("picking %s" % r) - return {"version": r, - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": None, - "date": date} + print('picking %s' % r) + return {'version': r, + 'full-revisionid': keywords['full'].strip(), + 'dirty': False, 'error': None, + 'date': date} # no suitable tags, so version is "0+unknown", but full hex is still there if verbose: - print("no suitable tags, using unknown + full revision id") - return {"version": "0+unknown", - "full-revisionid": keywords["full"].strip(), - "dirty": False, "error": "no suitable tags", "date": None} + print('no suitable tags, using unknown + full revision id') + return {'version': '0+unknown', + 'full-revisionid': keywords['full'].strip(), + 'dirty': False, 'error': 'no suitable tags', 'date': None} -@register_vcs_handler("git", "pieces_from_vcs") +@register_vcs_handler('git', 'pieces_from_vcs') def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): """Get version from 'git describe' in the root of the source tree. @@ -1033,55 +1033,55 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): expanded, and _version.py hasn't already been rewritten with a short version string, meaning we're inside a checked out source tree. """ - GITS = ["git"] - if sys.platform == "win32": - GITS = ["git.cmd", "git.exe"] + GITS = ['git'] + if sys.platform == 'win32': + GITS = ['git.cmd', 'git.exe'] - out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, + out, rc = run_command(GITS, ['rev-parse', '--git-dir'], cwd=root, hide_stderr=True) if rc != 0: if verbose: - print("Directory %s not under git control" % root) + print('Directory %s not under git control' % root) raise NotThisMethod("'git rev-parse --git-dir' returned error") # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] # if there isn't one, this yields HEX[-dirty] (no NUM) - describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", - "--always", "--long", - "--match", "%s*" % tag_prefix], + describe_out, rc = run_command(GITS, ['describe', '--tags', '--dirty', + '--always', '--long', + '--match', '%s*' % tag_prefix], cwd=root) # --long was added in git-1.5.5 if describe_out is None: raise NotThisMethod("'git describe' failed") describe_out = describe_out.strip() - full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) + full_out, rc = run_command(GITS, ['rev-parse', 'HEAD'], cwd=root) if full_out is None: raise NotThisMethod("'git rev-parse' failed") full_out = full_out.strip() pieces = {} - pieces["long"] = full_out - pieces["short"] = full_out[:7] # maybe improved later - pieces["error"] = None + pieces['long'] = full_out + pieces['short'] = full_out[:7] # maybe improved later + pieces['error'] = None # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] # TAG might have hyphens. git_describe = describe_out # look for -dirty suffix - dirty = git_describe.endswith("-dirty") - pieces["dirty"] = dirty + dirty = git_describe.endswith('-dirty') + pieces['dirty'] = dirty if dirty: - git_describe = git_describe[:git_describe.rindex("-dirty")] + git_describe = git_describe[:git_describe.rindex('-dirty')] # now we have TAG-NUM-gHEX or HEX - if "-" in git_describe: + if '-' in git_describe: # TAG-NUM-gHEX mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) if not mo: # unparseable. Maybe git-describe is misbehaving? - pieces["error"] = ("unable to parse git-describe output: '%s'" + pieces['error'] = ("unable to parse git-describe output: '%s'" % describe_out) return pieces @@ -1091,28 +1091,28 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): if verbose: fmt = "tag '%s' doesn't start with prefix '%s'" print(fmt % (full_tag, tag_prefix)) - pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" + pieces['error'] = ("tag '%s' doesn't start with prefix '%s'" % (full_tag, tag_prefix)) return pieces - pieces["closest-tag"] = full_tag[len(tag_prefix):] + pieces['closest-tag'] = full_tag[len(tag_prefix):] # distance: number of commits since tag - pieces["distance"] = int(mo.group(2)) + pieces['distance'] = int(mo.group(2)) # commit: short hex revision ID - pieces["short"] = mo.group(3) + pieces['short'] = mo.group(3) else: # HEX: no tags - pieces["closest-tag"] = None - count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], + pieces['closest-tag'] = None + count_out, rc = run_command(GITS, ['rev-list', 'HEAD', '--count'], cwd=root) - pieces["distance"] = int(count_out) # total number of commits + pieces['distance'] = int(count_out) # total number of commits # commit date: see ISO-8601 comment in git_versions_from_keywords() - date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], + date = run_command(GITS, ['show', '-s', '--format=%ci', 'HEAD'], cwd=root)[0].strip() - pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + pieces['date'] = date.strip().replace(' ', 'T', 1).replace(' ', '', 1) return pieces @@ -1123,36 +1123,36 @@ def do_vcs_install(manifest_in, versionfile_source, ipy): For Git, this means creating/changing .gitattributes to mark _version.py for export-subst keyword substitution. """ - GITS = ["git"] - if sys.platform == "win32": - GITS = ["git.cmd", "git.exe"] + GITS = ['git'] + if sys.platform == 'win32': + GITS = ['git.cmd', 'git.exe'] files = [manifest_in, versionfile_source] if ipy: files.append(ipy) try: me = __file__ - if me.endswith(".pyc") or me.endswith(".pyo"): - me = os.path.splitext(me)[0] + ".py" + if me.endswith('.pyc') or me.endswith('.pyo'): + me = os.path.splitext(me)[0] + '.py' versioneer_file = os.path.relpath(me) except NameError: - versioneer_file = "versioneer.py" + versioneer_file = 'versioneer.py' files.append(versioneer_file) present = False try: - f = open(".gitattributes", "r") + f = open('.gitattributes', 'r') for line in f.readlines(): if line.strip().startswith(versionfile_source): - if "export-subst" in line.strip().split()[1:]: + if 'export-subst' in line.strip().split()[1:]: present = True f.close() except EnvironmentError: pass if not present: - f = open(".gitattributes", "a+") - f.write("%s export-subst\n" % versionfile_source) + f = open('.gitattributes', 'a+') + f.write('%s export-subst\n' % versionfile_source) f.close() - files.append(".gitattributes") - run_command(GITS, ["add", "--"] + files) + files.append('.gitattributes') + run_command(GITS, ['add', '--'] + files) def versions_from_parentdir(parentdir_prefix, root, verbose): @@ -1167,15 +1167,15 @@ def versions_from_parentdir(parentdir_prefix, root, verbose): for i in range(3): dirname = os.path.basename(root) if dirname.startswith(parentdir_prefix): - return {"version": dirname[len(parentdir_prefix):], - "full-revisionid": None, - "dirty": False, "error": None, "date": None} + return {'version': dirname[len(parentdir_prefix):], + 'full-revisionid': None, + 'dirty': False, 'error': None, 'date': None} else: rootdirs.append(root) root = os.path.dirname(root) # up a level if verbose: - print("Tried directories %s but none started with prefix %s" % + print('Tried directories %s but none started with prefix %s' % (str(rootdirs), parentdir_prefix)) raise NotThisMethod("rootdir doesn't start with parentdir_prefix") @@ -1204,14 +1204,14 @@ def versions_from_file(filename): with open(filename) as f: contents = f.read() except EnvironmentError: - raise NotThisMethod("unable to read _version.py") + raise NotThisMethod('unable to read _version.py') mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", contents, re.M | re.S) if not mo: mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON", contents, re.M | re.S) if not mo: - raise NotThisMethod("no version_json in _version.py") + raise NotThisMethod('no version_json in _version.py') return json.loads(mo.group(1)) @@ -1219,18 +1219,18 @@ def write_to_version_file(filename, versions): """Write the given version number to the given _version.py file.""" os.unlink(filename) contents = json.dumps(versions, sort_keys=True, - indent=1, separators=(",", ": ")) - with open(filename, "w") as f: + indent=1, separators=(',', ': ')) + with open(filename, 'w') as f: f.write(SHORT_VERSION_PY % contents) - print("set %s to '%s'" % (filename, versions["version"])) + print("set %s to '%s'" % (filename, versions['version'])) def plus_or_dot(pieces): """Return a + if we don't already have one, else return a .""" - if "+" in pieces.get("closest-tag", ""): - return "." - return "+" + if '+' in pieces.get('closest-tag', ''): + return '.' + return '+' def render_pep440(pieces): @@ -1242,19 +1242,19 @@ def render_pep440(pieces): Exceptions: 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: + if pieces['closest-tag']: + rendered = pieces['closest-tag'] + if pieces['distance'] or pieces['dirty']: rendered += plus_or_dot(pieces) - rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) - if pieces["dirty"]: - rendered += ".dirty" + rendered += '%d.g%s' % (pieces['distance'], pieces['short']) + if pieces['dirty']: + rendered += '.dirty' else: # exception #1 - rendered = "0+untagged.%d.g%s" % (pieces["distance"], - pieces["short"]) - if pieces["dirty"]: - rendered += ".dirty" + rendered = '0+untagged.%d.g%s' % (pieces['distance'], + pieces['short']) + if pieces['dirty']: + rendered += '.dirty' return rendered @@ -1264,13 +1264,13 @@ def render_pep440_pre(pieces): Exceptions: 1: no tags. 0.post.devDISTANCE """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"]: - rendered += ".post.dev%d" % pieces["distance"] + if pieces['closest-tag']: + rendered = pieces['closest-tag'] + if pieces['distance']: + rendered += '.post.dev%d' % pieces['distance'] else: # exception #1 - rendered = "0.post.dev%d" % pieces["distance"] + rendered = '0.post.dev%d' % pieces['distance'] return rendered @@ -1284,20 +1284,20 @@ def render_pep440_post(pieces): Exceptions: 1: no tags. 0.postDISTANCE[.dev0] """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: - rendered += ".post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" + if pieces['closest-tag']: + rendered = pieces['closest-tag'] + if pieces['distance'] or pieces['dirty']: + rendered += '.post%d' % pieces['distance'] + if pieces['dirty']: + rendered += '.dev0' rendered += plus_or_dot(pieces) - rendered += "g%s" % pieces["short"] + rendered += 'g%s' % pieces['short'] else: # exception #1 - rendered = "0.post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" - rendered += "+g%s" % pieces["short"] + rendered = '0.post%d' % pieces['distance'] + if pieces['dirty']: + rendered += '.dev0' + rendered += '+g%s' % pieces['short'] return rendered @@ -1309,17 +1309,17 @@ def render_pep440_old(pieces): Eexceptions: 1: no tags. 0.postDISTANCE[.dev0] """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"] or pieces["dirty"]: - rendered += ".post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" + if pieces['closest-tag']: + rendered = pieces['closest-tag'] + if pieces['distance'] or pieces['dirty']: + rendered += '.post%d' % pieces['distance'] + if pieces['dirty']: + rendered += '.dev0' else: # exception #1 - rendered = "0.post%d" % pieces["distance"] - if pieces["dirty"]: - rendered += ".dev0" + rendered = '0.post%d' % pieces['distance'] + if pieces['dirty']: + rendered += '.dev0' return rendered @@ -1331,15 +1331,15 @@ def render_git_describe(pieces): Exceptions: 1: no tags. HEX[-dirty] (note: no 'g' prefix) """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - if pieces["distance"]: - rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + if pieces['closest-tag']: + rendered = pieces['closest-tag'] + if pieces['distance']: + rendered += '-%d-g%s' % (pieces['distance'], pieces['short']) else: # exception #1 - rendered = pieces["short"] - if pieces["dirty"]: - rendered += "-dirty" + rendered = pieces['short'] + if pieces['dirty']: + rendered += '-dirty' return rendered @@ -1352,47 +1352,47 @@ def render_git_describe_long(pieces): Exceptions: 1: no tags. HEX[-dirty] (note: no 'g' prefix) """ - if pieces["closest-tag"]: - rendered = pieces["closest-tag"] - rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + if pieces['closest-tag']: + rendered = pieces['closest-tag'] + rendered += '-%d-g%s' % (pieces['distance'], pieces['short']) else: # exception #1 - rendered = pieces["short"] - if pieces["dirty"]: - rendered += "-dirty" + rendered = pieces['short'] + if pieces['dirty']: + rendered += '-dirty' return rendered def render(pieces, style): """Render the given version pieces into the requested style.""" - if pieces["error"]: - return {"version": "unknown", - "full-revisionid": pieces.get("long"), - "dirty": None, - "error": pieces["error"], - "date": None} + if pieces['error']: + return {'version': 'unknown', + 'full-revisionid': pieces.get('long'), + 'dirty': None, + 'error': pieces['error'], + 'date': None} - if not style or style == "default": - style = "pep440" # the default + if not style or style == 'default': + style = 'pep440' # the default - if style == "pep440": + if style == 'pep440': rendered = render_pep440(pieces) - elif style == "pep440-pre": + elif style == 'pep440-pre': rendered = render_pep440_pre(pieces) - elif style == "pep440-post": + elif style == 'pep440-post': rendered = render_pep440_post(pieces) - elif style == "pep440-old": + elif style == 'pep440-old': rendered = render_pep440_old(pieces) - elif style == "git-describe": + elif style == 'git-describe': rendered = render_git_describe(pieces) - elif style == "git-describe-long": + elif style == 'git-describe-long': rendered = render_git_describe_long(pieces) else: raise ValueError("unknown style '%s'" % style) - return {"version": rendered, "full-revisionid": pieces["long"], - "dirty": pieces["dirty"], "error": None, - "date": pieces.get("date")} + return {'version': rendered, 'full-revisionid': pieces['long'], + 'dirty': pieces['dirty'], 'error': None, + 'date': pieces.get('date')} class VersioneerBadRootError(Exception): @@ -1404,20 +1404,20 @@ def get_versions(verbose=False): Returns dict with two keys: 'version' and 'full'. """ - if "versioneer" in sys.modules: + if 'versioneer' in sys.modules: # see the discussion in cmdclass.py:get_cmdclass() - del sys.modules["versioneer"] + del sys.modules['versioneer'] root = get_root() cfg = get_config_from_root(root) - assert cfg.VCS is not None, "please set [versioneer]VCS= in setup.cfg" + assert cfg.VCS is not None, 'please set [versioneer]VCS= in setup.cfg' handlers = HANDLERS.get(cfg.VCS) assert handlers, "unrecognized VCS '%s'" % cfg.VCS verbose = verbose or cfg.verbose assert cfg.versionfile_source is not None, \ - "please set versioneer.versionfile_source" - assert cfg.tag_prefix is not None, "please set versioneer.tag_prefix" + 'please set versioneer.versionfile_source' + assert cfg.tag_prefix is not None, 'please set versioneer.tag_prefix' versionfile_abs = os.path.join(root, cfg.versionfile_source) @@ -1427,14 +1427,14 @@ def get_versions(verbose=False): # and for users of a tarball/zipball created by 'git archive' or github's # download-from-tag feature or the equivalent in other VCSes. - get_keywords_f = handlers.get("get_keywords") - from_keywords_f = handlers.get("keywords") + get_keywords_f = handlers.get('get_keywords') + from_keywords_f = handlers.get('keywords') if get_keywords_f and from_keywords_f: try: keywords = get_keywords_f(versionfile_abs) ver = from_keywords_f(keywords, cfg.tag_prefix, verbose) if verbose: - print("got version from expanded keyword %s" % ver) + print('got version from expanded keyword %s' % ver) return ver except NotThisMethod: pass @@ -1442,18 +1442,18 @@ def get_versions(verbose=False): try: ver = versions_from_file(versionfile_abs) if verbose: - print("got version from file %s %s" % (versionfile_abs, ver)) + print('got version from file %s %s' % (versionfile_abs, ver)) return ver except NotThisMethod: pass - from_vcs_f = handlers.get("pieces_from_vcs") + from_vcs_f = handlers.get('pieces_from_vcs') if from_vcs_f: try: pieces = from_vcs_f(cfg.tag_prefix, root, verbose) ver = render(pieces, cfg.style) if verbose: - print("got version from VCS %s" % ver) + print('got version from VCS %s' % ver) return ver except NotThisMethod: pass @@ -1462,28 +1462,28 @@ def get_versions(verbose=False): if cfg.parentdir_prefix: ver = versions_from_parentdir(cfg.parentdir_prefix, root, verbose) if verbose: - print("got version from parentdir %s" % ver) + print('got version from parentdir %s' % ver) return ver except NotThisMethod: pass if verbose: - print("unable to compute version") + print('unable to compute version') - return {"version": "0+unknown", "full-revisionid": None, - "dirty": None, "error": "unable to compute version", - "date": None} + return {'version': '0+unknown', 'full-revisionid': None, + 'dirty': None, 'error': 'unable to compute version', + 'date': None} def get_version(): """Get the short version string for this project.""" - return get_versions()["version"] + return get_versions()['version'] def get_cmdclass(): """Get the custom setuptools/distutils subclasses used by Versioneer.""" - if "versioneer" in sys.modules: - del sys.modules["versioneer"] + if 'versioneer' in sys.modules: + del sys.modules['versioneer'] # this fixes the "python setup.py develop" case (also 'install' and # 'easy_install .'), in which subdependencies of the main project are # built (using setup.py bdist_egg) in the same python process. Assume @@ -1503,7 +1503,7 @@ def get_cmdclass(): from distutils.core import Command class cmd_version(Command): - description = "report generated version string" + description = 'report generated version string' user_options = [] boolean_options = [] @@ -1515,13 +1515,13 @@ def finalize_options(self): def run(self): vers = get_versions(verbose=True) - print("Version: %s" % vers["version"]) - print(" full-revisionid: %s" % vers.get("full-revisionid")) - print(" dirty: %s" % vers.get("dirty")) - print(" date: %s" % vers.get("date")) - if vers["error"]: - print(" error: %s" % vers["error"]) - cmds["version"] = cmd_version + print('Version: %s' % vers['version']) + print(' full-revisionid: %s' % vers.get('full-revisionid')) + print(' dirty: %s' % vers.get('dirty')) + print(' date: %s' % vers.get('date')) + if vers['error']: + print(' error: %s' % vers['error']) + cmds['version'] = cmd_version # we override "build_py" in both distutils and setuptools # @@ -1539,7 +1539,7 @@ def run(self): # setup.py egg_info -> ? # we override different "build_py" commands for both environments - if "setuptools" in sys.modules: + if 'setuptools' in sys.modules: from setuptools.command.build_py import build_py as _build_py else: from distutils.command.build_py import build_py as _build_py @@ -1555,11 +1555,11 @@ def run(self): if cfg.versionfile_build: target_versionfile = os.path.join(self.build_lib, cfg.versionfile_build) - print("UPDATING %s" % target_versionfile) + print('UPDATING %s' % target_versionfile) write_to_version_file(target_versionfile, versions) - cmds["build_py"] = cmd_build_py + cmds['build_py'] = cmd_build_py - if "cx_Freeze" in sys.modules: # cx_freeze enabled? + if 'cx_Freeze' in sys.modules: # cx_freeze enabled? from cx_Freeze.dist import build_exe as _build_exe # nczeczulin reports that py2exe won't like the pep440-style string # as FILEVERSION, but it can be used for PRODUCTVERSION, e.g. @@ -1574,22 +1574,22 @@ def run(self): cfg = get_config_from_root(root) versions = get_versions() target_versionfile = cfg.versionfile_source - print("UPDATING %s" % target_versionfile) + print('UPDATING %s' % target_versionfile) write_to_version_file(target_versionfile, versions) _build_exe.run(self) os.unlink(target_versionfile) - with open(cfg.versionfile_source, "w") as f: + with open(cfg.versionfile_source, 'w') as f: LONG = LONG_VERSION_PY[cfg.VCS] f.write(LONG % - {"DOLLAR": "$", - "STYLE": cfg.style, - "TAG_PREFIX": cfg.tag_prefix, - "PARENTDIR_PREFIX": cfg.parentdir_prefix, - "VERSIONFILE_SOURCE": cfg.versionfile_source, + {'DOLLAR': '$', + 'STYLE': cfg.style, + 'TAG_PREFIX': cfg.tag_prefix, + 'PARENTDIR_PREFIX': cfg.parentdir_prefix, + 'VERSIONFILE_SOURCE': cfg.versionfile_source, }) - cmds["build_exe"] = cmd_build_exe - del cmds["build_py"] + cmds['build_exe'] = cmd_build_exe + del cmds['build_py'] if 'py2exe' in sys.modules: # py2exe enabled? try: @@ -1603,24 +1603,24 @@ def run(self): cfg = get_config_from_root(root) versions = get_versions() target_versionfile = cfg.versionfile_source - print("UPDATING %s" % target_versionfile) + print('UPDATING %s' % target_versionfile) write_to_version_file(target_versionfile, versions) _py2exe.run(self) os.unlink(target_versionfile) - with open(cfg.versionfile_source, "w") as f: + with open(cfg.versionfile_source, 'w') as f: LONG = LONG_VERSION_PY[cfg.VCS] f.write(LONG % - {"DOLLAR": "$", - "STYLE": cfg.style, - "TAG_PREFIX": cfg.tag_prefix, - "PARENTDIR_PREFIX": cfg.parentdir_prefix, - "VERSIONFILE_SOURCE": cfg.versionfile_source, + {'DOLLAR': '$', + 'STYLE': cfg.style, + 'TAG_PREFIX': cfg.tag_prefix, + 'PARENTDIR_PREFIX': cfg.parentdir_prefix, + 'VERSIONFILE_SOURCE': cfg.versionfile_source, }) - cmds["py2exe"] = cmd_py2exe + cmds['py2exe'] = cmd_py2exe # we override different "sdist" commands for both environments - if "setuptools" in sys.modules: + if 'setuptools' in sys.modules: from setuptools.command.sdist import sdist as _sdist else: from distutils.command.sdist import sdist as _sdist @@ -1631,7 +1631,7 @@ def run(self): self._versioneer_generated_versions = versions # unless we update this, the command will keep using the old # version - self.distribution.metadata.version = versions["version"] + self.distribution.metadata.version = versions['version'] return _sdist.run(self) def make_release_tree(self, base_dir, files): @@ -1642,10 +1642,10 @@ def make_release_tree(self, base_dir, files): # (remembering that it may be a hardlink) and replace it with an # updated value target_versionfile = os.path.join(base_dir, cfg.versionfile_source) - print("UPDATING %s" % target_versionfile) + print('UPDATING %s' % target_versionfile) write_to_version_file(target_versionfile, self._versioneer_generated_versions) - cmds["sdist"] = cmd_sdist + cmds['sdist'] = cmd_sdist return cmds @@ -1702,37 +1702,37 @@ def do_setup(): except (EnvironmentError, configparser.NoSectionError, configparser.NoOptionError) as e: if isinstance(e, (EnvironmentError, configparser.NoSectionError)): - print("Adding sample versioneer config to setup.cfg", + print('Adding sample versioneer config to setup.cfg', file=sys.stderr) - with open(os.path.join(root, "setup.cfg"), "a") as f: + with open(os.path.join(root, 'setup.cfg'), 'a') as f: f.write(SAMPLE_CONFIG) print(CONFIG_ERROR, file=sys.stderr) return 1 - print(" creating %s" % cfg.versionfile_source) - with open(cfg.versionfile_source, "w") as f: + print(' creating %s' % cfg.versionfile_source) + with open(cfg.versionfile_source, 'w') as f: LONG = LONG_VERSION_PY[cfg.VCS] - f.write(LONG % {"DOLLAR": "$", - "STYLE": cfg.style, - "TAG_PREFIX": cfg.tag_prefix, - "PARENTDIR_PREFIX": cfg.parentdir_prefix, - "VERSIONFILE_SOURCE": cfg.versionfile_source, + f.write(LONG % {'DOLLAR': '$', + 'STYLE': cfg.style, + 'TAG_PREFIX': cfg.tag_prefix, + 'PARENTDIR_PREFIX': cfg.parentdir_prefix, + 'VERSIONFILE_SOURCE': cfg.versionfile_source, }) ipy = os.path.join(os.path.dirname(cfg.versionfile_source), - "__init__.py") + '__init__.py') if os.path.exists(ipy): try: - with open(ipy, "r") as f: + with open(ipy, 'r') as f: old = f.read() except EnvironmentError: - old = "" + old = '' if INIT_PY_SNIPPET not in old: - print(" appending to %s" % ipy) - with open(ipy, "a") as f: + print(' appending to %s' % ipy) + with open(ipy, 'a') as f: f.write(INIT_PY_SNIPPET) else: - print(" %s unmodified" % ipy) + print(' %s unmodified' % ipy) else: print(" %s doesn't exist, ok" % ipy) ipy = None @@ -1741,12 +1741,12 @@ def do_setup(): # (PKG/_version.py, used by runtime code) are in MANIFEST.in, so # they'll be copied into source distributions. Pip won't be able to # install the package without this. - manifest_in = os.path.join(root, "MANIFEST.in") + manifest_in = os.path.join(root, 'MANIFEST.in') simple_includes = set() try: - with open(manifest_in, "r") as f: + with open(manifest_in, 'r') as f: for line in f: - if line.startswith("include "): + if line.startswith('include '): for include in line.split()[1:]: simple_includes.add(include) except EnvironmentError: @@ -1755,19 +1755,19 @@ def do_setup(): # (http://docs.python.org/2/distutils/sourcedist.html#commands), so # it might give some false negatives. Appending redundant 'include' # lines is safe, though. - if "versioneer.py" not in simple_includes: + if 'versioneer.py' not in simple_includes: print(" appending 'versioneer.py' to MANIFEST.in") - with open(manifest_in, "a") as f: - f.write("include versioneer.py\n") + with open(manifest_in, 'a') as f: + f.write('include versioneer.py\n') else: print(" 'versioneer.py' already in MANIFEST.in") if cfg.versionfile_source not in simple_includes: print(" appending versionfile_source ('%s') to MANIFEST.in" % cfg.versionfile_source) - with open(manifest_in, "a") as f: - f.write("include %s\n" % cfg.versionfile_source) + with open(manifest_in, 'a') as f: + f.write('include %s\n' % cfg.versionfile_source) else: - print(" versionfile_source already in MANIFEST.in") + print(' versionfile_source already in MANIFEST.in') # Make VCS-specific changes. For git, this means creating/changing # .gitattributes to mark _version.py for export-subst keyword @@ -1781,41 +1781,41 @@ def scan_setup_py(): found = set() setters = False errors = 0 - with open("setup.py", "r") as f: + with open('setup.py', 'r') as f: for line in f.readlines(): - if "import versioneer" in line: - found.add("import") - if "versioneer.get_cmdclass()" in line: - found.add("cmdclass") - if "versioneer.get_version()" in line: - found.add("get_version") - if "versioneer.VCS" in line: + if 'import versioneer' in line: + found.add('import') + if 'versioneer.get_cmdclass()' in line: + found.add('cmdclass') + if 'versioneer.get_version()' in line: + found.add('get_version') + if 'versioneer.VCS' in line: setters = True - if "versioneer.versionfile_source" in line: + if 'versioneer.versionfile_source' in line: setters = True if len(found) != 3: - print("") - print("Your setup.py appears to be missing some important items") - print("(but I might be wrong). Please make sure it has something") - print("roughly like the following:") - print("") - print(" import versioneer") - print(" setup( version=versioneer.get_version(),") - print(" cmdclass=versioneer.get_cmdclass(), ...)") - print("") + print('') + print('Your setup.py appears to be missing some important items') + print('(but I might be wrong). Please make sure it has something') + print('roughly like the following:') + print('') + print(' import versioneer') + print(' setup( version=versioneer.get_version(),') + print(' cmdclass=versioneer.get_cmdclass(), ...)') + print('') errors += 1 if setters: print("You should remove lines like 'versioneer.VCS = ' and") print("'versioneer.versionfile_source = ' . This configuration") - print("now lives in setup.cfg, and should be removed from setup.py") - print("") + print('now lives in setup.cfg, and should be removed from setup.py') + print('') errors += 1 return errors -if __name__ == "__main__": +if __name__ == '__main__': cmd = sys.argv[1] - if cmd == "setup": + if cmd == 'setup': errors = do_setup() errors += scan_setup_py() if errors: From 094ff1af8c9c7a58c1a275d936c282e46ac40c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 11:10:07 +0200 Subject: [PATCH 04/19] add encoding pragma to py files. --- .pre-commit-config.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ab7983c9..9745a018 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,3 +18,12 @@ repos: - id: debug-statements - id: detect-private-key - id: double-quote-string-fixer + - id: end-of-file-fixer + - id: fix-encoding-pragma + - id: forbid-new-submodules + - id: mixed-line-ending + - id: name-tests-test + - id: pretty-format-json + - id: requirements-txt-fixer + - id: trailing-whitespace + exclude: ^tests/fixtures/diffs/ From b84ca8b33183fb94e5840dc673fa662a03ca9107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 11:31:35 +0200 Subject: [PATCH 05/19] add encoding pragma to py files. --- .pre-commit-config.yaml | 2 +- .pyup.yml | 2 +- .travis.yml | 31 ++++++++++++------- CONTRIBUTORS | 2 +- Dockerfile | 2 +- LICENSE.DE | 2 +- app.spec | 2 +- docker-compose.yml | 2 +- docs/requirements.txt | 2 +- docs/source/_ext/edit_on_github.py | 1 + docs/source/install_windows.rst | 2 +- docs/source/upgrade.rst | 1 - jmopenorders/__init__.py | 1 + jmopenorders/__main__.py | 1 + jmopenorders/_version.py | 1 + jmopenorders/api/__init__.py | 1 + jmopenorders/api/cleanoutputdir.py | 1 + jmopenorders/api/getdata.py | 1 + jmopenorders/api/getserviceperson.py | 1 + jmopenorders/api/hello.py | 1 + jmopenorders/api/report.py | 1 + jmopenorders/core/__init__.py | 1 + jmopenorders/core/config.py | 1 + jmopenorders/core/logger.py | 1 + junit.xml | 21 ------------- requirements.txt | 4 +-- requirements_test.txt | 6 ++-- resources/icons/demo.svg | 2 +- tests/{test_api.py => api_test.py} | 1 + tests/{test_cli.py => cli_test.py} | 1 + tests/core/{test_config.py => config_test.py} | 1 + tests/core/{test_logger.py => logger_test.py} | 1 + ...ate_test_data.py => generate_data_test.py} | 1 + versioneer.py | 1 + 34 files changed, 53 insertions(+), 49 deletions(-) delete mode 100644 junit.xml rename tests/{test_api.py => api_test.py} (97%) rename tests/{test_cli.py => cli_test.py} (98%) rename tests/core/{test_config.py => config_test.py} (99%) rename tests/core/{test_logger.py => logger_test.py} (98%) rename tests/{generate_test_data.py => generate_data_test.py} (99%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9745a018..7c47960e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,7 @@ repos: - id: forbid-new-submodules - id: mixed-line-ending - id: name-tests-test - - id: pretty-format-json + # - id: pretty-format-json - id: requirements-txt-fixer - id: trailing-whitespace exclude: ^tests/fixtures/diffs/ diff --git a/.pyup.yml b/.pyup.yml index c53a5802..8a2871c0 100644 --- a/.pyup.yml +++ b/.pyup.yml @@ -43,4 +43,4 @@ pr_prefix: "PyUp" # allow to close stale PRs # default: True -close_prs: True \ No newline at end of file +close_prs: True diff --git a/.travis.yml b/.travis.yml index 15be9fab..b8a090d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,18 +18,22 @@ env: matrix: include: - - os: linux - env: PYTHON_VERSION="3.5" - - os: linux - env: PYTHON_VERSION="3.6" - - os: linux - env: PYTHON_VERSION="3.7" - - os: osx - osx_image: xcode9.4 - - os: osx - osx_image: xcode10 - - os: osx - osx_image: xcode11 + - name: "Python 3.7.1 on Xenial Linux" + python: 3.7 # this works for Linux but is ignored on macOS or Windows + - name: "Python 3.7.4 on macOS" + os: osx + osx_image: xcode11 # Python 3.7.4 running on macOS 10.14.4 + language: shell # 'language: python' is an error on Travis CI macOS + before_install: + - brew install miniconda + - name: "Python 3.7.4 on Windows" + os: windows # Windows 10.0.17134 N/A Build 17134 + language: shell # 'language: python' is an error on Travis CI Windows + before_install: + - choco install python + - python -m pip install --upgrade pip + - choco install miniconda + env: PATH=/c/Python37:/c/Python37/Scripts:$PATH cache: directories: @@ -58,6 +62,9 @@ before_install: install: - export GIT_FULL_HASH=`git rev-parse HEAD` + - pip3 install --upgrade pip # all three OSes agree about 'pip3' + # 'python' points to Python 2.7 on macOS but points to Python 3.7 on Linux and Windows + # 'python3' is a 'command not found' error on Windows but 'py' works on Windows only - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - conda list # for debug reasons diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a44d2a9a..aeefb2c6 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1,2 +1,2 @@ CONTRIBUTORS -jmuelbert - https://github.com/jmuelbert \ No newline at end of file +jmuelbert - https://github.com/jmuelbert diff --git a/Dockerfile b/Dockerfile index 3326fc24..bda557cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,4 +22,4 @@ ENV PYTHONDONTWRITEBYTECODE = 1 # prevent *.pyc files WORKDIR /code COPY . . -CMD tox \ No newline at end of file +CMD tox diff --git a/LICENSE.DE b/LICENSE.DE index 978e68f1..31bc11b5 100644 --- a/LICENSE.DE +++ b/LICENSE.DE @@ -98,4 +98,4 @@ Anlage — European Union Public Licence (EUPL) v. 1.1, v. 1.2 — Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) oder Strong Reciprocity (LiLiQ-R+) Die Europäische Kommission kann diesen Anhang aktualisieren, um neuere Fassungen der obigen Lizenzen aufzunehmen, ohne hierfür eine neue Fassung der EUPL auszuarbeiten, solange diese Lizenzen die in Artikel 2 gewährten Rechte gewährleisten und den erfassten Quellcode vor ausschließlicher Aneignung schützen. -Alle sonstigen Änderungen oder Ergänzungen dieses Anhangs bedürfen der Ausarbeitung einer neuen Version der EUPL. +Alle sonstigen Änderungen oder Ergänzungen dieses Anhangs bedürfen der Ausarbeitung einer neuen Version der EUPL. diff --git a/app.spec b/app.spec index 1633d4de..45576ba2 100644 --- a/app.spec +++ b/app.spec @@ -35,4 +35,4 @@ coll = COLLECT(exe, app = BUNDLE(coll, name='jmopenorders.app', icon='resources/icons/app.icns', - bundle_identifier=None) \ No newline at end of file + bundle_identifier=None) diff --git a/docker-compose.yml b/docker-compose.yml index 12dfd79e..11b465f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,4 +3,4 @@ services: test: build: - context: . \ No newline at end of file + context: . diff --git a/docs/requirements.txt b/docs/requirements.txt index be0e6177..b6e02293 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,3 @@ Sphinx==2.2.0 -sphinx-autodoc-typehints==1.7.0 sphinx-autodoc-annotation==1.0.post1 +sphinx-autodoc-typehints==1.7.0 diff --git a/docs/source/_ext/edit_on_github.py b/docs/source/_ext/edit_on_github.py index c643946a..c0fe218e 100644 --- a/docs/source/_ext/edit_on_github.py +++ b/docs/source/_ext/edit_on_github.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Sphinx extension to add ReadTheDocs-style "Edit on GitHub" links to the sidebar. diff --git a/docs/source/install_windows.rst b/docs/source/install_windows.rst index 68f50d4d..e7cdd3ee 100644 --- a/docs/source/install_windows.rst +++ b/docs/source/install_windows.rst @@ -27,4 +27,4 @@ Now using the pip command shipped with python we can install dependencies easy. Get jmopenorders code ----------------- -To get jmopenorders download the zip file from https://github.com/jmuelbert/jmbdeopenorders/archive/master.zip and unzip whatever you want. To run doble click over the main script jmopenorders.py. \ No newline at end of file +To get jmopenorders download the zip file from https://github.com/jmuelbert/jmbdeopenorders/archive/master.zip and unzip whatever you want. To run doble click over the main script jmopenorders.py. diff --git a/docs/source/upgrade.rst b/docs/source/upgrade.rst index 836480c4..6a981430 100644 --- a/docs/source/upgrade.rst +++ b/docs/source/upgrade.rst @@ -28,4 +28,3 @@ Installation:: # Replace the x by the latest patch version Migration:: - diff --git a/jmopenorders/__init__.py b/jmopenorders/__init__.py index fe164fdc..a8edd523 100644 --- a/jmopenorders/__init__.py +++ b/jmopenorders/__init__.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Put the version to the __version__ variable. diff --git a/jmopenorders/__main__.py b/jmopenorders/__main__.py index dad54be7..94eba42c 100644 --- a/jmopenorders/__main__.py +++ b/jmopenorders/__main__.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Main application entry point. diff --git a/jmopenorders/_version.py b/jmopenorders/_version.py index 1fa673eb..1c847a42 100644 --- a/jmopenorders/_version.py +++ b/jmopenorders/_version.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag diff --git a/jmopenorders/api/__init__.py b/jmopenorders/api/__init__.py index 192e779c..7f2e9075 100644 --- a/jmopenorders/api/__init__.py +++ b/jmopenorders/api/__init__.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """JM OpenOrders Library.""" # -*- coding: utf-8 -*- diff --git a/jmopenorders/api/cleanoutputdir.py b/jmopenorders/api/cleanoutputdir.py index 53e7a09e..4c3294f2 100644 --- a/jmopenorders/api/cleanoutputdir.py +++ b/jmopenorders/api/cleanoutputdir.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Clean the Directory. diff --git a/jmopenorders/api/getdata.py b/jmopenorders/api/getdata.py index 961bd08d..1c57e917 100644 --- a/jmopenorders/api/getdata.py +++ b/jmopenorders/api/getdata.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Get the Data from csv-file to generate to output.""" # -*- coding: utf-8 -*- diff --git a/jmopenorders/api/getserviceperson.py b/jmopenorders/api/getserviceperson.py index ef29800e..69fee8ba 100644 --- a/jmopenorders/api/getserviceperson.py +++ b/jmopenorders/api/getserviceperson.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Get the service persion from csv-file.""" # -*- coding: utf-8 -*- diff --git a/jmopenorders/api/hello.py b/jmopenorders/api/hello.py index 82ec897d..3c7112fe 100644 --- a/jmopenorders/api/hello.py +++ b/jmopenorders/api/hello.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from ..core.logger import logger diff --git a/jmopenorders/api/report.py b/jmopenorders/api/report.py index a58af2c3..9826ab62 100644 --- a/jmopenorders/api/report.py +++ b/jmopenorders/api/report.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import os from jmopenorders.core.logger import logger diff --git a/jmopenorders/core/__init__.py b/jmopenorders/core/__init__.py index a6e61251..bb59c250 100644 --- a/jmopenorders/core/__init__.py +++ b/jmopenorders/core/__init__.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Core implementation package. """ diff --git a/jmopenorders/core/config.py b/jmopenorders/core/config.py index b53acc93..1007c720 100644 --- a/jmopenorders/core/config.py +++ b/jmopenorders/core/config.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Global application configuration. This module defines a global configuration object. Other modules should use diff --git a/jmopenorders/core/logger.py b/jmopenorders/core/logger.py index 786d8037..07fcaf3e 100644 --- a/jmopenorders/core/logger.py +++ b/jmopenorders/core/logger.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Global application logging. All modules use the same global logging object. No messages will be emitted diff --git a/junit.xml b/junit.xml deleted file mode 100644 index dde36d0d..00000000 --- a/junit.xml +++ /dev/null @@ -1,21 +0,0 @@ -ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_api.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/test_api.py:11: in <module> - from jmopenorders.api.hello import hello # tests __all__ -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_cli.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/test_cli.py:15: in <module> - from jmopenorders.cli import main -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_config.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/core/test_config.py:14: in <module> - from jmopenorders.core.config import YamlConfig -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_logger.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/core/test_logger.py:15: in <module> - from jmopenorders.core.logger import Logger -E ModuleNotFoundError: No module named 'jmopenorders' \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 372afe4d..5edfa491 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -pip==19.2.3 -pexpect==4.7.0 openpyxl==2.6.3 +pexpect==4.7.0 +pip==19.2.3 diff --git a/requirements_test.txt b/requirements_test.txt index 2ebeb918..8266e8b7 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -8,17 +8,17 @@ asynctest==0.13.0 black==19.3b0 codecov==2.0.15 -flake8-docstrings==1.4.0 flake8==3.7.8 +flake8-docstrings==1.4.0 mock-open==1.3.1 mypy==0.720 pre-commit==1.18.3 -pydocstyle==4.0.1 pycodestyle==2.5.0 +pydocstyle==4.0.1 +pytest==5.1.2 pytest-cov==2.7.1 pytest-sugar==0.9.2 pytest-timeout==1.3.3 -pytest==5.1.2 requests_mock==1.7.0 rstcheck==3.3.1 versioneer==0.18 diff --git a/resources/icons/demo.svg b/resources/icons/demo.svg index f082df17..69260628 100644 --- a/resources/icons/demo.svg +++ b/resources/icons/demo.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/tests/test_api.py b/tests/api_test.py similarity index 97% rename from tests/test_api.py rename to tests/api_test.py index 47fcdd19..76f0dbcb 100644 --- a/tests/test_api.py +++ b/tests/api_test.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Test suite for the api module. The script can be executed on its own or incorporated into a larger test suite. diff --git a/tests/test_cli.py b/tests/cli_test.py similarity index 98% rename from tests/test_cli.py rename to tests/cli_test.py index 1d343807..3d204fa2 100644 --- a/tests/test_cli.py +++ b/tests/cli_test.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Test suite for the cli module. The script can be executed on its own or incorporated into a larger test suite. diff --git a/tests/core/test_config.py b/tests/core/config_test.py similarity index 99% rename from tests/core/test_config.py rename to tests/core/config_test.py index 7b55541a..a1bf7856 100644 --- a/tests/core/test_config.py +++ b/tests/core/config_test.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Test suite for the core._config module. The script can be executed on its own or incorporated into a larger test suite. diff --git a/tests/core/test_logger.py b/tests/core/logger_test.py similarity index 98% rename from tests/core/test_logger.py rename to tests/core/logger_test.py index 491ce4ae..a9bb53df 100644 --- a/tests/core/test_logger.py +++ b/tests/core/logger_test.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ Test suite for the core._logger module. The script can be executed on its own or incorporated into a larger test suite. diff --git a/tests/generate_test_data.py b/tests/generate_data_test.py similarity index 99% rename from tests/generate_test_data.py rename to tests/generate_data_test.py index 16ef01da..b7651027 100644 --- a/tests/generate_test_data.py +++ b/tests/generate_data_test.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Generator for fake data for testing.""" # -*- coding: utf-8 -*- diff --git a/versioneer.py b/versioneer.py index 60cead8f..0a94756a 100644 --- a/versioneer.py +++ b/versioneer.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Version: 0.18 From a9516a255b1eff978182dcd68923f4e6d862f834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 12:13:26 +0200 Subject: [PATCH 06/19] add windows to travis.yml --- .travis.yml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index b8a090d6..86d24af3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,12 +20,26 @@ matrix: include: - name: "Python 3.7.1 on Xenial Linux" python: 3.7 # this works for Linux but is ignored on macOS or Windows + before_install: + - wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda + - export PATH="$HOME/miniconda/bin:$PATH" + - hash -r + + - activate + + install: + - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} + - conda list # for debug reasons + - name: "Python 3.7.4 on macOS" os: osx osx_image: xcode11 # Python 3.7.4 running on macOS 10.14.4 language: shell # 'language: python' is an error on Travis CI macOS before_install: - brew install miniconda + install: + - name: "Python 3.7.4 on Windows" os: windows # Windows 10.0.17134 N/A Build 17134 language: shell # 'language: python' is an error on Travis CI Windows @@ -34,6 +48,11 @@ matrix: - python -m pip install --upgrade pip - choco install miniconda env: PATH=/c/Python37:/c/Python37/Scripts:$PATH + install: + - activate + - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} + - conda list # for debug reasons + - activate cache: directories: @@ -44,11 +63,6 @@ services: - xvfb before_install: - - wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - - bash miniconda.sh -b -p $HOME/miniconda - - export PATH="$HOME/miniconda/bin:$PATH" - - hash -r - - conda config --set always_yes yes --set changeps1 no - conda config --add channels conda-forge - conda update -q conda --yes @@ -65,8 +79,6 @@ install: - pip3 install --upgrade pip # all three OSes agree about 'pip3' # 'python' points to Python 2.7 on macOS but points to Python 3.7 on Linux and Windows # 'python3' is a 'command not found' error on Windows but 'py' works on Windows only - - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - - conda list # for debug reasons before_script: # We need to create a (fake) display on Travis, let's use a funny resolution From 07c60d84489e828535ee665cc58b30275bfdf5c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 12:29:51 +0200 Subject: [PATCH 07/19] integrate windows, osx and linux int travis. --- .travis.yml | 19 ++++++++++++------- appveyor.yml | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 86d24af3..86e9c56b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,20 +25,27 @@ matrix: - bash miniconda.sh -b -p $HOME/miniconda - export PATH="$HOME/miniconda/bin:$PATH" - hash -r - + - ls "$HOME/miniconda/bin" - activate install: - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} + - conda activate /home/travis/build/jmuelbert/jmopenorders/conda-env - conda list # for debug reasons + services: + - xvfb + - name: "Python 3.7.4 on macOS" os: osx osx_image: xcode11 # Python 3.7.4 running on macOS 10.14.4 language: shell # 'language: python' is an error on Travis CI macOS before_install: - - brew install miniconda + - brew cask install miniconda install: + - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} + - conda activate /home/travis/build/jmuelbert/jmopenorders/conda-env + - conda list # for debug reasons - name: "Python 3.7.4 on Windows" os: windows # Windows 10.0.17134 N/A Build 17134 @@ -49,20 +56,18 @@ matrix: - choco install miniconda env: PATH=/c/Python37:/c/Python37/Scripts:$PATH install: - - activate - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - conda list # for debug reasons - - activate + - conda activate /home/travis/build/jmuelbert/jmopenorders/conda-env + - conda list # for debug reasons cache: directories: - $HOME/.cache/pip - $HOME/download -services: - - xvfb - before_install: + - conda update -n base -c defaults conda - conda config --set always_yes yes --set changeps1 no - conda config --add channels conda-forge - conda update -q conda --yes diff --git a/appveyor.yml b/appveyor.yml index 0d95d384..da5a4ba4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -60,7 +60,7 @@ install: build: false test_script: - - tox -e ${PYTHON} + - tox -e ${PYTHON_VERSION} - tox -e docs on_success: From ce76d5ed7f0f51643588d4d844e6e94116489b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 12:47:47 +0200 Subject: [PATCH 08/19] search errors on travis. --- .travis.yml | 5 ++++- junit.xml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 junit.xml diff --git a/.travis.yml b/.travis.yml index 86e9c56b..8a7957d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,7 @@ matrix: - activate install: + - conda init bash - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - conda activate /home/travis/build/jmuelbert/jmopenorders/conda-env - conda list # for debug reasons @@ -43,6 +44,7 @@ matrix: before_install: - brew cask install miniconda install: + - conda init bash - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - conda activate /home/travis/build/jmuelbert/jmopenorders/conda-env - conda list # for debug reasons @@ -54,7 +56,8 @@ matrix: - choco install python - python -m pip install --upgrade pip - choco install miniconda - env: PATH=/c/Python37:/c/Python37/Scripts:$PATH + - dir /c/ + env: PATH=/c/Python37:/c/Python37/Scripts:/c/miniconda:/c/miniconda/scripts:$PATH install: - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - conda list # for debug reasons diff --git a/junit.xml b/junit.xml new file mode 100644 index 00000000..d7fbd98f --- /dev/null +++ b/junit.xml @@ -0,0 +1,46 @@ +ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/api_test.py'. +Hint: make sure your test modules/packages have valid Python names. +Traceback: +tests/api_test.py:12: in <module> + from jmopenorders.api.hello import hello # tests __all__ +E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/cli_test.py'. +Hint: make sure your test modules/packages have valid Python names. +Traceback: +tests/cli_test.py:16: in <module> + from jmopenorders.cli import main +E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/generate_data_test.py'. +Hint: make sure your test modules/packages have valid Python names. +Traceback: +tests/generate_data_test.py:48: in <module> + from faker import Factory +E ModuleNotFoundError: No module named 'faker'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_api 3.py'. +Hint: make sure your test modules/packages have valid Python names. +Traceback: +tests/test_api 3.py:12: in <module> + from jmopenorders.api.hello import hello # tests __all__ +E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_cli 3.py'. +Hint: make sure your test modules/packages have valid Python names. +Traceback: +tests/test_cli 3.py:16: in <module> + from jmopenorders.cli import main +E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/config_test.py'. +Hint: make sure your test modules/packages have valid Python names. +Traceback: +tests/core/config_test.py:15: in <module> + from jmopenorders.core.config import YamlConfig +E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/logger_test.py'. +Hint: make sure your test modules/packages have valid Python names. +Traceback: +tests/core/logger_test.py:16: in <module> + from jmopenorders.core.logger import Logger +E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_config 3.py'. +Hint: make sure your test modules/packages have valid Python names. +Traceback: +tests/core/test_config 3.py:15: in <module> + from jmopenorders.core.config import YamlConfig +E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_logger 3.py'. +Hint: make sure your test modules/packages have valid Python names. +Traceback: +tests/core/test_logger 3.py:16: in <module> + from jmopenorders.core.logger import Logger +E ModuleNotFoundError: No module named 'jmopenorders' From 16fc679d2cebdf31c0af5476d8f5b378b962eaa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 13:14:59 +0200 Subject: [PATCH 09/19] update linux and macos config on travis.yml --- .travis.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a7957d8..dea9bf02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,14 +23,15 @@ matrix: before_install: - wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - bash miniconda.sh -b -p $HOME/miniconda - - export PATH="$HOME/miniconda/bin:$PATH" + - source "$HOME/miniconda/etc/profile.d/conda.sh" - hash -r - - ls "$HOME/miniconda/bin" - - activate + - conda config --set always_yes yes --set changeps1 no + - conda update -q conda + # Useful for debugging any issues with conda + - conda info -a install: - - conda init bash - - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} + - conda env create -f environment.yml -p conda-env python=${PYTHON} - conda activate /home/travis/build/jmuelbert/jmopenorders/conda-env - conda list # for debug reasons @@ -42,11 +43,13 @@ matrix: osx_image: xcode11 # Python 3.7.4 running on macOS 10.14.4 language: shell # 'language: python' is an error on Travis CI macOS before_install: - - brew cask install miniconda + - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O ~/miniconda.sh + - bash ~/miniconda.sh -b -p $HOME/miniconda + - export PATH="$HOME/miniconda/bin:$PATH" + - source "$HOME/miniconda/etc/profile.d/conda.sh" install: - - conda init bash - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - - conda activate /home/travis/build/jmuelbert/jmopenorders/conda-env + - conda activate /Users/travis/build/jmopenorders/conda-env - conda list # for debug reasons - name: "Python 3.7.4 on Windows" @@ -59,9 +62,9 @@ matrix: - dir /c/ env: PATH=/c/Python37:/c/Python37/Scripts:/c/miniconda:/c/miniconda/scripts:$PATH install: - - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} + - conda-env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - conda list # for debug reasons - - conda activate /home/travis/build/jmuelbert/jmopenorders/conda-env + - activate /home/travis/build/jmuelbert/jmopenorders/conda-env - conda list # for debug reasons cache: From 353a49d285271f44b8af36e8ef9c44ce05be16e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 13:31:11 +0200 Subject: [PATCH 10/19] dont use brew on mac. serach windws errors on travis.yml --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index dea9bf02..c52fcf74 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,7 +49,7 @@ matrix: - source "$HOME/miniconda/etc/profile.d/conda.sh" install: - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - - conda activate /Users/travis/build/jmopenorders/conda-env + - conda activate /Users/travis/build/jmuelbert/jmopenorders/conda-env - conda list # for debug reasons - name: "Python 3.7.4 on Windows" @@ -60,6 +60,9 @@ matrix: - python -m pip install --upgrade pip - choco install miniconda - dir /c/ + - dir /c/tools + - dir /c/tools/miniconda + - dir /c/tools/miniconda env: PATH=/c/Python37:/c/Python37/Scripts:/c/miniconda:/c/miniconda/scripts:$PATH install: - conda-env create -f environment.yml -p conda-env python=${PYTHON_VERSION} @@ -144,7 +147,7 @@ before_script: script: - source conda-env/bin/activate - - tox -e ${PYTHON} + - tox -e p37 - tox -e docs after_success: From b705c5d3f56a27fa11c9abcbdc7fce91813c76c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 14:11:02 +0200 Subject: [PATCH 11/19] update appveyor and travis. searching for errors --- .travis.yml | 20 +++++++++----------- appveyor.yml | 8 ++++---- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index c52fcf74..2a23c934 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,11 @@ matrix: - conda activate /home/travis/build/jmuelbert/jmopenorders/conda-env - conda list # for debug reasons + before_script: + # We need to create a (fake) display on Travis, let's use a funny resolution + - export DISPLAY=:99.0 + - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render + services: - xvfb @@ -59,15 +64,13 @@ matrix: - choco install python - python -m pip install --upgrade pip - choco install miniconda - - dir /c/ - - dir /c/tools - - dir /c/tools/miniconda - - dir /c/tools/miniconda + - dir /c/ProgramData/Miniconda3 + - dir /c/ProgramData/Miniconda3/bin env: PATH=/c/Python37:/c/Python37/Scripts:/c/miniconda:/c/miniconda/scripts:$PATH install: - conda-env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - conda list # for debug reasons - - activate /home/travis/build/jmuelbert/jmopenorders/conda-env + - activate /c/users/travis/build/jmuelbert/jmopenorders/conda-env - conda list # for debug reasons cache: @@ -95,10 +98,6 @@ install: # 'python3' is a 'command not found' error on Windows but 'py' works on Windows only before_script: - # We need to create a (fake) display on Travis, let's use a funny resolution - - export DISPLAY=:99.0 - - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render - # Make sure everyone uses the correct python (this is handled by conda) - which python - python --version @@ -146,8 +145,7 @@ before_script: fi; script: - - source conda-env/bin/activate - - tox -e p37 + - tox -e py37 - tox -e docs after_success: diff --git a/appveyor.yml b/appveyor.yml index da5a4ba4..4d042d30 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,12 +36,12 @@ install: - sh: sudo apt -y --force-yes install libglu1-mesa xvfb libgl1-mesa-dri mesa-common-dev libglu1-mesa-dev - sh: wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh - sh: bash miniconda.sh -b -p $HOME/miniconda + - sh: source "$HOME/miniconda/etc/profile.d/conda.sh" # Windows - Miniconda is in Image - cmd: set "PATH="C:\Miniconda3-x64;C:\Miniconda3-x64\Scripts;%PATH%" - sh: export PATH="$HOME/miniconda/bin;$PATH" - - sh: ls "$HOME/miniconda" - - sh: ls "$HOME/miniconda/bin" + # - conda activate base - conda config --set always_yes yes --set changeps1 no - conda config --add channels conda-forge @@ -49,8 +49,8 @@ install: - conda config --set auto_update_conda no - conda info -a # for debug reasons - conda env create -fcon environment.yml -p conda-env python=${PYTHON_VERSION} - - cmd: conda-env/bin/activate.bat - - sh: source conda-env/bin/activate + - cmd: activate %APPVEYOR_BUILD_FOLDER%\jmuelbert\jmopenorders\conda-env + - sh: conda activate "$APPVEYOR_BUILD_FOLDER/jmuelbet/jmopenorders/conda-env" - conda list - pip install -e . - pip install pytest-xvfb pytest-mock pytest-cov pytest-repeat codecov pyvirtualdisplay==0.2.1 From 352dd7d600f762d7913ad887ab6fa8267375a4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 14:29:32 +0200 Subject: [PATCH 12/19] add the missed faker package --- .travis.yml | 6 +++--- appveyor.yml | 2 +- junit.xml | 46 ------------------------------------------- requirements_test.txt | 1 + 4 files changed, 5 insertions(+), 50 deletions(-) delete mode 100644 junit.xml diff --git a/.travis.yml b/.travis.yml index 2a23c934..fe64e097 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,12 +63,12 @@ matrix: before_install: - choco install python - python -m pip install --upgrade pip - - choco install miniconda + - choco install miniconda3 - dir /c/ProgramData/Miniconda3 - dir /c/ProgramData/Miniconda3/bin - env: PATH=/c/Python37:/c/Python37/Scripts:/c/miniconda:/c/miniconda/scripts:$PATH + env: PATH=/c/Python37:/c/Python37/Scripts:$PATH install: - - conda-env create -f environment.yml -p conda-env python=${PYTHON_VERSION} + - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - conda list # for debug reasons - activate /c/users/travis/build/jmuelbert/jmopenorders/conda-env - conda list # for debug reasons diff --git a/appveyor.yml b/appveyor.yml index 4d042d30..492e332e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -48,7 +48,7 @@ install: - conda update -q conda --yes - conda config --set auto_update_conda no - conda info -a # for debug reasons - - conda env create -fcon environment.yml -p conda-env python=${PYTHON_VERSION} + - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - cmd: activate %APPVEYOR_BUILD_FOLDER%\jmuelbert\jmopenorders\conda-env - sh: conda activate "$APPVEYOR_BUILD_FOLDER/jmuelbet/jmopenorders/conda-env" - conda list diff --git a/junit.xml b/junit.xml deleted file mode 100644 index d7fbd98f..00000000 --- a/junit.xml +++ /dev/null @@ -1,46 +0,0 @@ -ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/api_test.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/api_test.py:12: in <module> - from jmopenorders.api.hello import hello # tests __all__ -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/cli_test.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/cli_test.py:16: in <module> - from jmopenorders.cli import main -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/generate_data_test.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/generate_data_test.py:48: in <module> - from faker import Factory -E ModuleNotFoundError: No module named 'faker'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_api 3.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/test_api 3.py:12: in <module> - from jmopenorders.api.hello import hello # tests __all__ -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/test_cli 3.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/test_cli 3.py:16: in <module> - from jmopenorders.cli import main -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/config_test.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/core/config_test.py:15: in <module> - from jmopenorders.core.config import YamlConfig -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/logger_test.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/core/logger_test.py:16: in <module> - from jmopenorders.core.logger import Logger -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_config 3.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/core/test_config 3.py:15: in <module> - from jmopenorders.core.config import YamlConfig -E ModuleNotFoundError: No module named 'jmopenorders'ImportError while importing test module '/Users/juergen/Documents/Projects/GitHub/openorders-py/master/tests/core/test_logger 3.py'. -Hint: make sure your test modules/packages have valid Python names. -Traceback: -tests/core/test_logger 3.py:16: in <module> - from jmopenorders.core.logger import Logger -E ModuleNotFoundError: No module named 'jmopenorders' diff --git a/requirements_test.txt b/requirements_test.txt index 8266e8b7..e30643bc 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -8,6 +8,7 @@ asynctest==0.13.0 black==19.3b0 codecov==2.0.15 +faker==2.0.2 flake8==3.7.8 flake8-docstrings==1.4.0 mock-open==1.3.1 From e24299cb47604fab14bbd8bde92121bd25808c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 14:41:23 +0200 Subject: [PATCH 13/19] add the missing package coveralls. correct some paths. --- .travis.yml | 2 +- appveyor.yml | 4 ++-- environment.yml | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index fe64e097..3b2f5551 100644 --- a/.travis.yml +++ b/.travis.yml @@ -151,7 +151,7 @@ script: after_success: - codecov - coveralls - - conda build conda.recipe --no-test + - conda build recipe --no-test - conda install --use-local jmopenorders - conda info -a diff --git a/appveyor.yml b/appveyor.yml index 492e332e..9bf91357 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -49,8 +49,8 @@ install: - conda config --set auto_update_conda no - conda info -a # for debug reasons - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - - cmd: activate %APPVEYOR_BUILD_FOLDER%\jmuelbert\jmopenorders\conda-env - - sh: conda activate "$APPVEYOR_BUILD_FOLDER/jmuelbet/jmopenorders/conda-env" + - cmd: activate %APPVEYOR_BUILD_FOLDER%\jmopenorders/conda-env + - sh: conda activate "$APPVEYOR_BUILD_FOLDER/jmopenorders/conda-env" - conda list - pip install -e . - pip install pytest-xvfb pytest-mock pytest-cov pytest-repeat codecov pyvirtualdisplay==0.2.1 diff --git a/environment.yml b/environment.yml index c40f98e6..d3c01060 100644 --- a/environment.yml +++ b/environment.yml @@ -21,6 +21,7 @@ dependencies: - conda - conda-build - conda-package-handling + - coveralls - coverage - cryptography - decorator From 5a62ab407fea437d016fca9d08fe201d02e24785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 15:26:29 +0200 Subject: [PATCH 14/19] remove errors from appveyor and travis --- .travis.yml | 3 +-- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3b2f5551..2d823637 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,8 +64,7 @@ matrix: - choco install python - python -m pip install --upgrade pip - choco install miniconda3 - - dir /c/ProgramData/Miniconda3 - - dir /c/ProgramData/Miniconda3/bin + - dir /c/tools env: PATH=/c/Python37:/c/Python37/Scripts:$PATH install: - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} diff --git a/appveyor.yml b/appveyor.yml index 9bf91357..e2e8c8b6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -50,7 +50,7 @@ install: - conda info -a # for debug reasons - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - cmd: activate %APPVEYOR_BUILD_FOLDER%\jmopenorders/conda-env - - sh: conda activate "$APPVEYOR_BUILD_FOLDER/jmopenorders/conda-env" + - sh: conda activate "$APPVEYOR_BUILD_FOLDER/conda-env" - conda list - pip install -e . - pip install pytest-xvfb pytest-mock pytest-cov pytest-repeat codecov pyvirtualdisplay==0.2.1 From 2a0c6d40ec738d1c00bb1e45b34d6e0c150a2284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 15:37:13 +0200 Subject: [PATCH 15/19] update envs in tox.ini --- .travis.yml | 3 ++- tox.ini | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2d823637..a57b42f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,8 @@ matrix: - choco install python - python -m pip install --upgrade pip - choco install miniconda3 - - dir /c/tools + - dir /c/tools/miniconda3 + - dir /c/tools/miniconda3/bin env: PATH=/c/Python37:/c/Python37/Scripts:$PATH install: - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} diff --git a/tox.ini b/tox.ini index a9ff6e49..3c433e8f 100644 --- a/tox.ini +++ b/tox.ini @@ -14,9 +14,14 @@ ignore_basepython_conflict=True # defaults for the others. basepython = py35: python3.5 + py35: 3.5 py36: python3.6 + py36: 3.6 py37: python3.7 + py37: 3.7 pypy: pypy + py38: python3.8 + py38: 3.8 pypy3: pypy3 py3: python3.7 From 3e9b7f79cfb60b0d0c23a388e8dab00f1f1680d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 15:46:27 +0200 Subject: [PATCH 16/19] update miniconda path for win in travis.yml --- .travis.yml | 7 ++++--- appveyor.yml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index a57b42f8..685a1305 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,8 +65,9 @@ matrix: - python -m pip install --upgrade pip - choco install miniconda3 - dir /c/tools/miniconda3 - - dir /c/tools/miniconda3/bin - env: PATH=/c/Python37:/c/Python37/Scripts:$PATH + - dir /c/tools/miniconda3/Scripts + - dir /c/tools/miniconda3/etc + env: PATH=/c/Python37:/c/Python37/Scripts:/c/tools/miniconda3/Scripts/$PATH install: - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - conda list # for debug reasons @@ -145,7 +146,7 @@ before_script: fi; script: - - tox -e py37 + - tox -e py37 # Must update - tox -e docs after_success: diff --git a/appveyor.yml b/appveyor.yml index e2e8c8b6..2ab94a72 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -60,7 +60,7 @@ install: build: false test_script: - - tox -e ${PYTHON_VERSION} + - tox -e py37 # Must update - tox -e docs on_success: From 4b7e3f1c702313310dcb55e94b79cf3cb39055b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 15:56:02 +0200 Subject: [PATCH 17/19] update miniconda path for win in travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 685a1305..8f7057ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,7 +67,7 @@ matrix: - dir /c/tools/miniconda3 - dir /c/tools/miniconda3/Scripts - dir /c/tools/miniconda3/etc - env: PATH=/c/Python37:/c/Python37/Scripts:/c/tools/miniconda3/Scripts/$PATH + env: PATH=/c/Python37:/c/Python37/Scripts:/c/tools/miniconda3/Scripts/:$PATH install: - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - conda list # for debug reasons From 42b7d685973bf3e4b368d190aaaa767f2893f320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 16:17:27 +0200 Subject: [PATCH 18/19] Update gitignore, environment, travis and appveyor. --- .gitignore | 1 + .travis.yml | 2 +- appveyor.yml | 6 +++++- environment.yml | 1 - 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 455e1cfb..c69bdf9d 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,7 @@ nosetests.xml coverage.xml *.cover .hypothesis/ +junit.xml # Translations *.mo diff --git a/.travis.yml b/.travis.yml index 8f7057ad..26c84eb7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,7 +67,7 @@ matrix: - dir /c/tools/miniconda3 - dir /c/tools/miniconda3/Scripts - dir /c/tools/miniconda3/etc - env: PATH=/c/Python37:/c/Python37/Scripts:/c/tools/miniconda3/Scripts/:$PATH + env: PATH=/c/Python37:/c/Python37/Scripts:/c/tools/miniconda3/Scripts:$PATH install: - conda env create -f environment.yml -p conda-env python=${PYTHON_VERSION} - conda list # for debug reasons diff --git a/appveyor.yml b/appveyor.yml index 2ab94a72..4b0645dd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -40,6 +40,10 @@ install: # Windows - Miniconda is in Image - cmd: set "PATH="C:\Miniconda3-x64;C:\Miniconda3-x64\Scripts;%PATH%" + - cmd: dir c:\Miniconda3-x64 + - cmd: dir c:\Miniconda3-x64\Scripts + - cmd: dir c:\Miniconda3-x64\Tools + - cmd: dir c:\Miniconda3-x64\etc - sh: export PATH="$HOME/miniconda/bin;$PATH" # - conda activate base @@ -60,7 +64,7 @@ install: build: false test_script: - - tox -e py37 # Must update + - tox -e py37 # Must update - tox -e docs on_success: diff --git a/environment.yml b/environment.yml index d3c01060..8c1f9f2d 100644 --- a/environment.yml +++ b/environment.yml @@ -70,7 +70,6 @@ dependencies: - pysocks - pytest - pytest-cov - - python>=3.4 - python-dateutil - python-libarchive-c - pytz From c0daba5a6324732e16a088a2a38544a4952c603b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ju=CC=88rgen=20Mu=CC=88lbert?= Date: Sun, 6 Oct 2019 16:59:23 +0200 Subject: [PATCH 19/19] Update remove a wrong char from appveyor.yml --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4b0645dd..e045fd7d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -39,7 +39,7 @@ install: - sh: source "$HOME/miniconda/etc/profile.d/conda.sh" # Windows - Miniconda is in Image - - cmd: set "PATH="C:\Miniconda3-x64;C:\Miniconda3-x64\Scripts;%PATH%" + - cmd: set PATH="C:\Miniconda3-x64;C:\Miniconda3-x64\Scripts;%PATH%" - cmd: dir c:\Miniconda3-x64 - cmd: dir c:\Miniconda3-x64\Scripts - cmd: dir c:\Miniconda3-x64\Tools