From 752695071a73bb67ec94d054a57bac04e8ad0592 Mon Sep 17 00:00:00 2001
From: Jan Caron <j.caron@fz-juelich.de>
Date: Wed, 12 Jul 2017 12:51:00 +0200
Subject: [PATCH] Using setup.py develop for the installation of required
 packages! And deleted/ignored pyramid.egg-info

---
 .gitignore                            |  6 ++--
 .gitlab-ci.yml                        | 38 +++++++++++--------------
 pyramid.egg-info/PKG-INFO             | 19 -------------
 pyramid.egg-info/SOURCES.txt          | 41 ---------------------------
 pyramid.egg-info/dependency_links.txt |  1 -
 pyramid.egg-info/top_level.txt        |  1 -
 setup.py                              | 16 ++++++++---
 7 files changed, 32 insertions(+), 90 deletions(-)
 delete mode 100644 pyramid.egg-info/PKG-INFO
 delete mode 100644 pyramid.egg-info/SOURCES.txt
 delete mode 100644 pyramid.egg-info/dependency_links.txt
 delete mode 100644 pyramid.egg-info/top_level.txt

diff --git a/.gitignore b/.gitignore
index 997af0e..ff052d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,9 @@
-.idea
-
 desktop.ini
 
 *.pyc
 
-.DS_Store
+.idea
 
+*.egg-info
 
+.DS_Store
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3f77ab2..7bfd626 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,40 +3,36 @@ image: "python:3.5"
 before_script:
   # Check and print Python version
   - python --version
-
-  # Install required packages:
-  # TODO: Use requirements.txt? Separate jobs for optional stuff (hyperspy, plotting)?
-  # TODO: After split of Pyramid comment out and see what really is used (scipy?)!
-  - pip install numpy scipy nose h5py matplotlib Pillow scikit-image cmocean hyperspy
-
-  # List installed stuff:
-  #- apt list --installed
-
-
-
-  # Create SSH configuration directory if necessary (mode: read/write/execute):
+  # Create SSH configuration directory if necessary (also parents with -p, mode: read/write/exec):
   - mkdir -p --mode=700 ~/.ssh/
   # Add SSH key for jutil:
-  - echo "$SSH_KEY_JUTIL" > ~/.ssh/jutil_key
-  # Provide read access to owner (octal value code: 400) with chmod to the key:
-  - chmod 400 ~/.ssh/jutil_key
+  - echo "ID_RSA_JUTIL" > ~/.ssh/id_rsa_jutil
+  # Provide read access to owner (octal value code: 400) to the key with chmod:
+  - chmod 400 ~/.ssh/id_rsa_jutil
   # Configure SSH to use ~/.ssh/jutil_key for iffgit.fz-juelich.de (-e allows \n):
-  - echo -e "Host iffgit.fz-juelich.de\n\tIdentityFile ~/.ssh/jutil_key\n\n" > ~/.ssh/config
+  - echo -e "Host iffgit.fz-juelich.de\n\tIdentityFile ~/.ssh/id_rsa_jutil\n" > ~/.ssh/config
+  - cat ~/.ssh/config
+  - ssh-keyscan -H 'iffgit.fz-juelich.de'
+  - echo ssh-keyscan -H 'iffgit.fz-juelich.de' >> ~.ssh/known_hosts
   # For Docker builds disable host key checking. Be aware that by adding that
   # you are suspectible to man-in-the-middle attacks.
   # WARNING: Use this only with the Docker executor, if you use it with shell
   # you will overwrite your user's SSH config.
-  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config'
+  # - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config'
+  # >> appends instead of overwriting
+  - echo -e "iffgit.fz-juelich.de $ID_RSA_JUTIL_PUB" >> ~/.ssh/known_hosts
+  - cat ~/.ssh/known_hosts
+  # Install jutil via secure ssh connection:
   - pip install git+ssh://gitlab@iffgit.fz-juelich.de/unger/jutil.git
 
-
-  ####- pip install hyperspy tqdm cmocean nose
-
-
 stages:
   - test
 
 test:
   stage: test
   script:
+    # TODO: Different jobs with custom develop arguments? extra_requires (hyperspy, plotting)?
+    # TODO: Use pip install -e .[hyperspy], etc.
+    # Install requirements (-e: editable, like python setup.py develop, but pip, not easy_install):
+    - pip install -e .  # TODO: belongs here or before_script?
     - python setup.py test
diff --git a/pyramid.egg-info/PKG-INFO b/pyramid.egg-info/PKG-INFO
deleted file mode 100644
index c791ee4..0000000
--- a/pyramid.egg-info/PKG-INFO
+++ /dev/null
@@ -1,19 +0,0 @@
-Metadata-Version: 1.1
-Name: pyramid
-Version: 0.1.0.dev0
-Summary: PYthon based Reconstruction Algorithm for MagnetIc Distributions
-Home-page: UNKNOWN
-Author: Jan Caron
-Author-email: j.caron@fz-juelich.de
-License: UNKNOWN
-Description: long description (TODO!)
-Platform: UNKNOWN
-Requires: numpy
-Requires: scipy
-Requires: matplotlib
-Requires: Pillow
-Requires: mayavi
-Requires: pyfftw
-Requires: hyperspy
-Requires: nose
-Requires: jutil
diff --git a/pyramid.egg-info/SOURCES.txt b/pyramid.egg-info/SOURCES.txt
deleted file mode 100644
index bc1c30f..0000000
--- a/pyramid.egg-info/SOURCES.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-setup.py
-pyramid/__init__.py
-pyramid/analytic.py
-pyramid/colors.py
-pyramid/costfunction.py
-pyramid/dataset.py
-pyramid/diagnostics.py
-pyramid/fft.py
-pyramid/fieldconverter.py
-pyramid/fielddata.py
-pyramid/forwardmodel.py
-pyramid/kernel.py
-pyramid/phasemap.py
-pyramid/phasemapper.py
-pyramid/plottools.py
-pyramid/projector.py
-pyramid/quaternion.py
-pyramid/ramp.py
-pyramid/reconstruction.py
-pyramid/regularisator.py
-pyramid/version.py
-pyramid.egg-info/PKG-INFO
-pyramid.egg-info/SOURCES.txt
-pyramid.egg-info/dependency_links.txt
-pyramid.egg-info/top_level.txt
-pyramid/file_io/__init__.py
-pyramid/file_io/io_dataset.py
-pyramid/file_io/io_phasemap.py
-pyramid/file_io/io_projector.py
-pyramid/file_io/io_scalardata.py
-pyramid/file_io/io_vectordata.py
-pyramid/magcreator/__init__.py
-pyramid/magcreator/examples.py
-pyramid/magcreator/magcreator.py
-pyramid/magcreator/shapes.py
-pyramid/utils/__init__.py
-pyramid/utils/mag_slicer.py
-pyramid/utils/phasemap_creator.py
-pyramid/utils/pm.py
-pyramid/utils/reconstruction_2d_from_phasemap.py
-pyramid/utils/reconstruction_3d_from_magdata.py
\ No newline at end of file
diff --git a/pyramid.egg-info/dependency_links.txt b/pyramid.egg-info/dependency_links.txt
deleted file mode 100644
index 8b13789..0000000
--- a/pyramid.egg-info/dependency_links.txt
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/pyramid.egg-info/top_level.txt b/pyramid.egg-info/top_level.txt
deleted file mode 100644
index d94f7c9..0000000
--- a/pyramid.egg-info/top_level.txt
+++ /dev/null
@@ -1 +0,0 @@
-pyramid
diff --git a/setup.py b/setup.py
index 83edb76..e571acf 100644
--- a/setup.py
+++ b/setup.py
@@ -70,7 +70,7 @@ def check_requirements():
                               % ((package_name,) + min_version))
 
 
-def hg_version():
+def hg_version():  # TODO: Replace with GIT! Also check build output on GitLab!
     """Get the Mercurial reference identifier.
 
     Returns
@@ -139,10 +139,18 @@ setup(name=DISTNAME,
       url=URL,
       download_url=URL,
       version=VERSION,
-      packages=find_packages(exclude=['tests']),
+      packages=find_packages(exclude=['tests', 'doc']),
       include_dirs=[numpy.get_include()],
-      requires=['numpy', 'scipy', 'matplotlib', 'Pillow',
-                'mayavi', 'pyfftw', 'hyperspy', 'nose', 'jutil'],
+      # TODO: Use requirements.txt? extras_require for optional stuff (hyperspy, plotting)?
+      # TODO: After split of Pyramid, comment out and see what really is used (is e.g. scipy?)!
+      # - pip install numpy scipy nose h5py matplotlib Pillow scikit-image cmocean hyperspy
+      setup_requires=['numpy>=1.6', 'pytest-runner', 'pytest'],
+      tests_require=['nose', 'pytest-cov', 'pytest-flake8', 'coverage'],
+      install_requires=['numpy>=1.6', 'tqdm', 'scipy', 'matplotlib', 'Pillow', 'h5py',
+                        'hyperspy', 'jutil', 'cmocean'],
+      # TODO: extra: 'pyfftw', 'mayavi' (not easy to install... find a way!)
+      # TODO: See https://stackoverflow.com/a/28842733 for extras_require...
+      # TODO: ...replace [dev] with [IO] (hyperspy) and [plotting] (separate plotting library)!
       test_suite='nose.collector',
       cmdclass={'build': build})
 print('-------------------------------------------------------------------------------\n')
-- 
GitLab