From 292f5909c8e1baccfc276b69d3c9f009e805a987 Mon Sep 17 00:00:00 2001
From: Dennis Ahrens <dennis.ahrens@hs-hannover.de>
Date: Wed, 24 Apr 2013 14:12:49 +0200
Subject: [PATCH] [FEATURE] #1114 setup.py for smooth install.

---
 .gitignore |  3 +++
 LICENSE    | 21 +++++++++++++++++++++
 README     | 45 +++++++++++++++++++++++++++++++++++++++++++++
 bin/hshetl |  9 ++++++---
 setup.py   | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 122 insertions(+), 3 deletions(-)
 create mode 100644 LICENSE
 create mode 100644 README
 create mode 100644 setup.py

diff --git a/.gitignore b/.gitignore
index 3fc678c..4106527 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
 *.pyc
 .project
 .pydevproject
+build/
+hshetl.egg-info/
+dist/
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..8395415
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2013 Hochschule Hannover
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file
diff --git a/README b/README
new file mode 100644
index 0000000..9f395ba
--- /dev/null
+++ b/README
@@ -0,0 +1,45 @@
+hshetl is a cli tool for extract transform load data between different sources.
+
+Currently supported sources are files, ldap, oracle and mysql.
+
+###############################################################################
+# Install on Debian
+###############################################################################
+
+Install the tool by using the setup.py script. It resolves all dependencies. Currently the setup was only tested
+on debian based linux distributions.
+
+You will need to following packages for the building process:
+ - python-dev
+ - python-setuptools
+ - libmysqlclient-dev
+ - libldap2-dev
+ - libsasl2-dev
+ - libssl-dev
+ - mercurial
+
+sudo apt-get install python-dev python-setuptools libmysqlclient-dev libldap2-dev libsasl2-dev libssl-dev mercurial
+
+You also need to run pip install -U distribute, because we need a higher
+version of it.
+
+###############################################################################
+# Virtualenv
+###############################################################################
+
+For testing purpose it is recommended to use python virtualenv. It is available
+in the package:
+ - python-virtualenv
+
+# create a virtualenv
+virtualenv --no-site-packages path/to/your/virtual/env
+# activate a virtualenv
+. path/to/your/virtual/env/bin/activate
+# deactivate a virtualenv
+deactivate
+
+###############################################################################
+# Tests
+###############################################################################
+We used nosetests to run the included unittests. Install it and run nosetests
+from inside the package directory ./hshetl
\ No newline at end of file
diff --git a/bin/hshetl b/bin/hshetl
index e335108..58f507f 100755
--- a/bin/hshetl
+++ b/bin/hshetl
@@ -1,4 +1,7 @@
-#!/bin/bash
+#!/usr/bin/env python
 
-BINPATH=`dirname $0`
-python "$BINPATH/../hshetl/cli.py" $@
\ No newline at end of file
+import sys
+from hshetl import cli
+
+if __name__ == "__main__":
+    cli.main(sys.argv[1:])
\ No newline at end of file
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..b32c013
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,47 @@
+from setuptools import setup
+
+# patch distutils if it can't cope with the 'classifiers' or 'download_url'
+# keywords (prior to python 2.3.0).
+from distutils.dist import DistributionMetadata
+if not hasattr(DistributionMetadata, 'classifiers'):
+    DistributionMetadata.classifiers = None
+if not hasattr(DistributionMetadata, 'download_url'):
+    DistributionMetadata.download_url = None
+
+setup(
+    name='hshetl',
+    version='0.1',
+    description='Extract Transform and Load (ETL) data from different sources into different sources.',
+    long_description=open('README').read(),
+    author='Dennis Ahrens, Philipp Schiffmann',
+    author_email='dennis.ahrens@hs-hannover.de, philipp.schiffmann@hs-hannover.de',
+    url='http://projects.it.hs-hannover.de/projects/hit-hshetl',
+    download_url='git://git.it.hs-hannover.de/hshetl.git',
+    license='MIT',
+    platforms=['Linux'],
+    keywords=['data', 'synchronization', 'transformation'],
+    classifiers=[
+        'Development Status :: 4 - Beta',
+        'Environment :: Other Environment',
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: MIT License',
+        'Operating System :: POSIX :: Linux',
+        'Programming Language :: Python',
+        'Topic :: Software Development :: Libraries :: Python Modules',
+    ],
+    scripts=['bin/hshetl'],
+    packages=['hshetl'],
+    setup_requires=['distribute >= 0.6.28'],
+    install_requires=[
+        'sqlalchemy>=0.7',
+        'argparse >= 1.1',
+        'PyYAML >= 3.10',
+        'cx_Oracle >= 5.1.2',
+        'python-ldap >= 2.3.13',
+        'mysql-python >= 1.2.3',
+        'mock'
+    ],
+    dependency_links=[
+        'hg+https://code.google.com/p/pyfakefs/'
+    ]
+)
-- 
GitLab