From 5cb39ac01d3783823381c085f62e93ed82930aca Mon Sep 17 00:00:00 2001
From: Maeva Pourpoint <maeva@passcal.nmt.edu>
Date: Tue, 28 Apr 2020 17:55:15 -0600
Subject: [PATCH] Conda packages for Python 3.[5,6,7,8]

---
 .gitlab-ci.yml                       | 36 +++++++++++++++++++++++-----
 HISTORY.rst                          |  6 +++++
 conda.recipe/bld.bat                 |  2 --
 conda.recipe/build.sh                |  1 -
 conda.recipe/conda_build_config.yaml |  4 +++-
 conda.recipe/meta.yaml               |  3 ++-
 data2passcal/__init__.py             |  2 +-
 data2passcal/data2passcal.py         |  2 +-
 setup.cfg                            |  2 +-
 setup.py                             | 12 ++++------
 tests/test_data2passcal.py           |  6 ++---
 tox.ini                              |  7 ++++--
 12 files changed, 55 insertions(+), 28 deletions(-)
 delete mode 100644 conda.recipe/bld.bat
 delete mode 100644 conda.recipe/build.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6524a3f..e64f627 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,22 +15,46 @@ cache:
     - .cache/pip
 
 stages:
+- static analysis
 - test
 
 before_script:
 - pip install -e .[dev]
 
+flake8:
+  image: python:3.6
+  tags: passoft
+  stage: static analysis
+  script:
+  - flake8 --ignore=E722,E712,E501 data2passcal
+  - flake8 --ignore=E722,E712,E501 tests
 
-python2:
+python2.7:
   image: python:2.7
-  tags:
-  - passoft
+  tags: passoft
   stage: test
   script: tox -e py27
 
-python3:
+python3.5:
+  image: python:3.5
+  tags: passoft
+  stage: test
+  script: tox -e py35
+
+python3.6:
   image: python:3.6
-  tags:
-  - passoft
+  tags: passoft
   stage: test
   script: tox -e py36
+
+python3.7:
+  image: python:3.7
+  tags: passoft
+  stage: test
+  script: tox -e py37
+
+python3.8:
+  image: python:3.8
+  tags: passoft
+  stage: test
+  script: tox -e py38
diff --git a/HISTORY.rst b/HISTORY.rst
index 5c319c5..1f0b042 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -40,3 +40,9 @@ History
    - run "conda install ./data2passcal-2020.114-py*_0.tar.bz2"
     (choose appropriate python version for your platform)
    - run "conda update data2passcal"
+
+2020.119 (2020-04-28)
+------------------
+* Created conda packages for "data2passcal" that can run on Python3.[5,7,8]
+* Tested data2passcal against Python3.[5,7,8] using tox
+* Updated .gitlab-ci.yml to run a linter and unit tests for Python2 and Python3.[5,6,7,8] in GitLab CI pipeline
diff --git a/conda.recipe/bld.bat b/conda.recipe/bld.bat
deleted file mode 100644
index b9cd616..0000000
--- a/conda.recipe/bld.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-"%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
deleted file mode 100644
index a660906..0000000
--- a/conda.recipe/build.sh
+++ /dev/null
@@ -1 +0,0 @@
-$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
index b0e3e77..e1f365a 100644
--- a/conda.recipe/conda_build_config.yaml
+++ b/conda.recipe/conda_build_config.yaml
@@ -1,4 +1,6 @@
 python:
-  - 2.7
+  - 3.5
   - 3.6
+  - 3.7
+  - 3.8
 target_platform: osx-64
diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml
index 43ddd10..def8043 100644
--- a/conda.recipe/meta.yaml
+++ b/conda.recipe/meta.yaml
@@ -1,12 +1,13 @@
 package:
   name: data2passcal
-  version: 2020.114
+  version: 2020.119
 
 source:
   path: ../
 
 build:
   number: 0
+  script: python setup.py install --single-version-externally-managed --record=record.txt
   entry_points:
     - data2passcal = data2passcal.data2passcal:main
 
diff --git a/data2passcal/__init__.py b/data2passcal/__init__.py
index 3a08473..fdf64fa 100644
--- a/data2passcal/__init__.py
+++ b/data2passcal/__init__.py
@@ -4,4 +4,4 @@
 
 __author__ = """IRIS PASSCAL"""
 __email__ = 'software-support@passcal.nmt.edu'
-__version__ = '2020.114'
+__version__ = '2020.119'
diff --git a/data2passcal/data2passcal.py b/data2passcal/data2passcal.py
index 554aad9..e9cb081 100644
--- a/data2passcal/data2passcal.py
+++ b/data2passcal/data2passcal.py
@@ -18,7 +18,7 @@ import struct
 import sys
 from time import sleep, time
 
-VERSION = '2020.114'
+VERSION = '2020.119'
 
 
 # Cache the ftplib.FTP class so it will be available to test_FTP(FTP) when calling isinstance assert
diff --git a/setup.cfg b/setup.cfg
index 379997a..8f25876 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 2020.114
+current_version = 2020.119
 commit = True
 tag = True
 
diff --git a/setup.py b/setup.py
index 40dc85e..d04d19d 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,10 @@ setup(
         'License :: OSI Approved ::  GNU General Public License v3 (GPLv3)',
         'Natural Language :: English',
         'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
+        'Programming Language :: Python :: 3.7',
+        'Programming Language :: Python :: 3.8',
     ],
     description="Prepare SEED data for shipment to PASSCAL.",
     entry_points={
@@ -33,15 +36,8 @@ setup(
     setup_requires=[],
     extras_require={
         'dev': [
-            'pip',
-            'bumpversion',
-            'wheel',
-            'watchdog',
             'flake8',
             'tox',
-            'coverage',
-            'Sphinx',
-            'twine',
             "mock;python_version<'3.3'"
         ]
     },
@@ -52,6 +48,6 @@ setup(
     name='data2passcal',
     packages=find_packages(include=['data2passcal']),
     url='https://git.passcal.nmt.edu/passoft/data2passcal',
-    version='2020.114',
+    version='2020.119',
     zip_safe=False,
 )
diff --git a/tests/test_data2passcal.py b/tests/test_data2passcal.py
index 4888784..98ed5c2 100644
--- a/tests/test_data2passcal.py
+++ b/tests/test_data2passcal.py
@@ -10,22 +10,20 @@ import os
 import unittest
 
 from data2passcal.data2passcal import get_FTP, ismseed, scan_dir, send2passcal
+from data2passcal.data2passcal import FTP_CONNECT_ATTEMPTS, FTP_SEND_ATTEMPTS
 
 try:
     from unittest.mock import patch
 except ImportError:
     from mock import patch
 
-VERSION = '2020.114'
+VERSION = '2020.119'
 
 FTP_HOST = 'qc.passcal.nmt.edu'
 FTP_USER = 'ftp'
 FTP_PASSWORD = 'data2passcal'
 FTP_DIR = 'AUTO/MSEED'
 FTP_TIMEOUT = 120
-FTP_RECONNECT_WAIT = 60
-FTP_CONNECT_ATTEMPTS = 60 * 60 * 24 * 7 / FTP_RECONNECT_WAIT
-FTP_SEND_ATTEMPTS = 3
 MOCK_TEST = True
 
 
diff --git a/tox.ini b/tox.ini
index d1ee218..c56ce3f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,10 +1,13 @@
 [tox]
-envlist = py27, py36, flake8
+envlist = py27, py35, py36, py37, py38, flake8
 
 [travis]
 python =
     2.7: py27
+    3.5: py35
     3.6: py36
+    3.7: py37
+    3.8: py38
 
 [testenv:flake8]
 basepython = python
@@ -17,5 +20,5 @@ changedir = tests
 deps = mock
 commands = python -m unittest test_data2passcal
 
-[testenv:py36]
+[testenv]
 commands = python -m unittest
-- 
GitLab