From d0943837bee1d4d2b7ce8ec1163dd8cead5b75c5 Mon Sep 17 00:00:00 2001
From: Sven Augustin <sven.augustin@psi.ch>
Date: Thu, 1 Oct 2020 19:01:35 +0200
Subject: [PATCH] added files for packaging: setuptools, travis, conda

---
 .conda-recipe/bld.bat   |  2 ++
 .conda-recipe/build.sh  |  2 ++
 .conda-recipe/meta.yaml | 30 ++++++++++++++++++++++++++++++
 .travis.yml             | 38 ++++++++++++++++++++++++++++++++++++++
 setup.py                | 13 +++++++++++++
 5 files changed, 85 insertions(+)
 create mode 100644 .conda-recipe/bld.bat
 create mode 100644 .conda-recipe/build.sh
 create mode 100644 .conda-recipe/meta.yaml
 create mode 100644 .travis.yml
 create mode 100644 setup.py

diff --git a/.conda-recipe/bld.bat b/.conda-recipe/bld.bat
new file mode 100644
index 0000000..c40a9bb
--- /dev/null
+++ b/.conda-recipe/bld.bat
@@ -0,0 +1,2 @@
+"%PYTHON%" setup.py install
+if errorlevel 1 exit 1
diff --git a/.conda-recipe/build.sh b/.conda-recipe/build.sh
new file mode 100644
index 0000000..05bdbc0
--- /dev/null
+++ b/.conda-recipe/build.sh
@@ -0,0 +1,2 @@
+$PYTHON setup.py install
+
diff --git a/.conda-recipe/meta.yaml b/.conda-recipe/meta.yaml
new file mode 100644
index 0000000..2b46037
--- /dev/null
+++ b/.conda-recipe/meta.yaml
@@ -0,0 +1,30 @@
+{% set data = load_setup_py_data() %}
+
+package:
+    name: sanipy
+    version: {{ data["version"] }}
+
+about:
+   home: {{ data["url"] }}
+   summary: {{ data["description"] }}
+
+source:
+    path: ..
+
+build:
+  noarch: python
+  entry_points:
+    - sanipy = sani:main
+
+requirements:
+    build:
+        - python >=3.6
+        - setuptools
+    run:
+        - python >=3.6
+        - pyepics
+        - colorama
+        - numpy
+        - pandas
+
+
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..0e683c1
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,38 @@
+language: python
+
+python:
+  - 3.6
+
+# Build only tagged commits
+if: tag IS present
+
+before_install:
+  - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
+  - bash miniconda.sh -b -p $HOME/miniconda
+  - rm miniconda.sh # clean up here, so no warning is triggered during the final clean-up
+  - export PATH=$HOME/miniconda/bin:$PATH # if `source $HOME/miniconda/etc/profile.d/conda.sh` instead, anaconda is not found in deploy
+  - conda config --set always_yes yes
+  - conda config --set changeps1 no
+  - conda config --set anaconda_upload no
+  - conda config --append channels conda-forge
+  - conda config --append channels paulscherrerinstitute
+
+install:
+  - conda update -q conda
+  - conda install -q python=$TRAVIS_PYTHON_VERSION conda-build conda-verify anaconda-client
+  - conda info -a
+
+script:
+  - conda build .conda-recipe
+
+deploy:
+  provider: script
+  script: anaconda -t $ANACONDA_TOKEN upload $HOME/miniconda/conda-bld/**/sanipy-*.tar.bz2
+  on:
+    branch: master
+    tags: true
+
+notifications:
+  email: false
+
+
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..c093a5c
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,13 @@
+from setuptools import setup, find_packages
+
+setup(
+    name="sanipy",
+    version="0.0.1",
+    url="https://github.com/augustin_s/sanipy",
+    description="A command-line tool for epics connection testing",
+    author="Paul Scherrer Institute",
+    packages=find_packages(),
+    py_modules=["sani", "commands"]
+)
+
+
-- 
GitLab