From eec67688e3151d8e0d1284351ff6df37e817c4f4 Mon Sep 17 00:00:00 2001 From: Maeva Pourpoint <maeva@passcal.nmt.edu> Date: Thu, 23 Apr 2020 10:05:20 -0600 Subject: [PATCH] Updated and tested data2passcal to work with Python 2 and 3 --- CONTRIBUTING.rst | 2 +- HISTORY.rst | 15 ++++++++++++++ MANIFEST.in | 4 +--- conda.recipe/build.bat | 4 ++++ conda.recipe/build.sh | 3 +++ conda.recipe/conda_build_config.yaml | 4 ++++ conda.recipe/meta.yaml | 31 ++++++++++++++++++++-------- data2passcal/__init__.py | 2 +- data2passcal/data2passcal.py | 4 ++-- setup.cfg | 2 +- setup.py | 4 ++-- tests/test_data2passcal.py | 2 +- 12 files changed, 57 insertions(+), 20 deletions(-) create mode 100644 conda.recipe/build.bat create mode 100644 conda.recipe/build.sh create mode 100644 conda.recipe/conda_build_config.yaml diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index b262255..16719df 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -100,7 +100,7 @@ Tips ---- To run a subset of tests:: - $ python -m unittest tests.test_data2passcal + $ python -m pytest tests/test_data2passcal.py Deploying --------- diff --git a/HISTORY.rst b/HISTORY.rst index d35c92d..6880f30 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -25,3 +25,18 @@ History * Updated list of platform specific dependencies to be installed when installing data2passcal (see setup.py) * Installed and tested data2passcal against Python2.7 and Python3.6 using tox * Formatted Python code to conform to the PEP8 style guide (exception: E722, E712, E501) + +2020.114 (2020-04-23) +------------------ +* Created conda packages for "data2passcal" that can run on Python2.7 and Python3.6 +=> To create package: + - clone the "data2passcal" repo + - "cd" in "data2passcal" directory + - run "conda-build ." +=> To install locally with dependencies: + - run "conda install -c ${CONDA_PREFIX}/conda-bld/ data2passcal" +=> To install on user's computer from tarball with all dependencies: + - download tarball and "cd" to directory where tarball was downloaded + - run "conda install ./data2passcal-2020.114-py*_0.tar.bz2" + (choose appropriate python version for your platform) + - run "conda update data2passcal" diff --git a/MANIFEST.in b/MANIFEST.in index 965b2dd..ced9d12 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,7 +5,5 @@ include LICENSE include README.rst recursive-include tests * -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] -recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif +recursive-include docs *.rst conf.py Makefile make.bat diff --git a/conda.recipe/build.bat b/conda.recipe/build.bat new file mode 100644 index 0000000..ae8549e --- /dev/null +++ b/conda.recipe/build.bat @@ -0,0 +1,4 @@ +"%PYTHON%" data2passcal\config.py +move config.ini data2passcal +"%PYTHON%" setup.py install --single-version-externally-managed --record=record.txt +if errorlevel 1 exit 1 diff --git a/conda.recipe/build.sh b/conda.recipe/build.sh new file mode 100644 index 0000000..e871f87 --- /dev/null +++ b/conda.recipe/build.sh @@ -0,0 +1,3 @@ +$PYTHON data2passcal/config.py +mv config.ini data2passcal +$PYTHON setup.py install --single-version-externally-managed --record=record.txt diff --git a/conda.recipe/conda_build_config.yaml b/conda.recipe/conda_build_config.yaml new file mode 100644 index 0000000..b0e3e77 --- /dev/null +++ b/conda.recipe/conda_build_config.yaml @@ -0,0 +1,4 @@ +python: + - 2.7 + - 3.6 +target_platform: osx-64 diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 2604327..dd0ca97 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -1,24 +1,37 @@ package: name: data2passcal - version: 2014.125 + version: 2020.114 source: - path: .. + path: ../ build: - # If the installation is complex, or different between Unix and Windows, use - # separate bld.bat and build.sh files instead of this key. Add the line - # "skip: True # [py<35]" (for example) to limit to Python 3.5 and newer, or - # "skip: True # [not win]" to limit to Windows. - script: python setup.py install --single-version-externally-managed --record=record.txt + number: 0 + entry_points: + - data2passcal = data2passcal.data2passcal:main requirements: - build: + host: - python - setuptools + - configparser # [py<32] run: - python + - configparser # [py<32] + +test: + requires: + - mock # [py<33] + - pytest + source_files: + - data2passcal/config.ini + - tests + commands: + - python -c "import data2passcal.data2passcal; print(data2passcal.__version__)" + - pytest about: home: https://git.passcal.nmt.edu/passoft/data2passcal - summary: Prepare SEED data for shipment to PASSCAL. + license: GPLv3 + license_file: LICENSE + summary: Send MSEED files ready for archival at the DMC to PASSCAL's QC system diff --git a/data2passcal/__init__.py b/data2passcal/__init__.py index 8f21cef..3a08473 100644 --- a/data2passcal/__init__.py +++ b/data2passcal/__init__.py @@ -4,4 +4,4 @@ __author__ = """IRIS PASSCAL""" __email__ = 'software-support@passcal.nmt.edu' -__version__ = '2020.107' +__version__ = '2020.114' diff --git a/data2passcal/data2passcal.py b/data2passcal/data2passcal.py index 7cb8551..c2fcf3b 100644 --- a/data2passcal/data2passcal.py +++ b/data2passcal/data2passcal.py @@ -19,7 +19,7 @@ import struct import sys from time import sleep, time -VERSION = '2020.107' +VERSION = '2020.114' # Cache the ftplib.FTP class so it will be available to test_FTP(FTP) when calling isinstance assert @@ -27,7 +27,7 @@ FTPCache = ftplib.FTP # Parse configuration file config = configparser.ConfigParser() -print(config.read('data2passcal/config.ini')) +config.read(os.path.dirname(os.path.realpath(__file__)) + '/config.ini') # TEST related diff --git a/setup.cfg b/setup.cfg index a6afa20..379997a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2020.107 +current_version = 2020.114 commit = True tag = True diff --git a/setup.py b/setup.py index 9f29d0f..f546a42 100644 --- a/setup.py +++ b/setup.py @@ -51,11 +51,11 @@ setup( license="GNU General Public License v3", long_description=readme + '\n\n' + history, include_package_data=True, + package_data={'data2passcal': ['config.ini']}, keywords='data2passcal', name='data2passcal', packages=find_packages(include=['data2passcal']), - test_suite='tests', url='https://git.passcal.nmt.edu/passoft/data2passcal', - version='2020.107', + version='2020.114', zip_safe=False, ) diff --git a/tests/test_data2passcal.py b/tests/test_data2passcal.py index 02d5c33..fbef0be 100644 --- a/tests/test_data2passcal.py +++ b/tests/test_data2passcal.py @@ -12,7 +12,7 @@ import unittest from data2passcal.data2passcal import get_FTP, ismseed, scan_dir, send2passcal -VERSION = '2020.107' +VERSION = '2020.114' try: -- GitLab