Add setup tools support
authorGiorgos Verigakis <verigak@gmail.com>
Thu, 19 Jan 2012 11:04:42 +0000 (13:04 +0200)
committerGiorgos Verigakis <verigak@gmail.com>
Thu, 19 Jan 2012 11:04:42 +0000 (13:04 +0200)
.gitignore
MANIFEST.in [new file with mode: 0644]
README.rst [moved from README with 100% similarity]
build [deleted file]
setup.py [new file with mode: 0755]

index e097e6e..1d86ff8 100644 (file)
@@ -1,4 +1,3 @@
 *.pyc
-.DS_Store
-bin/
+*.egg-info
 _build
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644 (file)
index 0000000..9561fb1
--- /dev/null
@@ -0,0 +1 @@
+include README.rst
similarity index 100%
rename from README
rename to README.rst
diff --git a/build b/build
deleted file mode 100755 (executable)
index 10bb580..0000000
--- a/build
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import shutil
-import stat
-
-from os.path import exists, join
-
-
-SRCDIR = 'kamaki'
-DSTDIR = 'bin'
-DST = 'kamaki'
-
-FILES = ('config.py', 'utils.py', 'client.py', 'cli.py')
-
-
-def cat(path, dst, skipheader=True):
-    dst.write('\n')
-    
-    in_header = True
-    for line in open(path):
-        if in_header and line.strip() and not line.startswith('#'):
-            in_header = False
-        
-        if line.startswith('from kamaki.'):
-            continue    # Skip local imports
-        
-        if skipheader and in_header:
-            continue
-        
-        dst.write(line)
-
-
-def main():
-    if not exists(DSTDIR):
-        os.makedirs(DSTDIR)
-    dstpath = join(DSTDIR, DST)
-    
-    dst = open(dstpath, 'w')
-    
-    dst.write('#!/usr/bin/env python\n')
-    
-    cat(join(SRCDIR, '__init__.py'), dst, skipheader=False)
-    
-    for file in FILES:
-        cat(join(SRCDIR, file), dst)
-    
-    dst.close()
-    
-    # Make file executable
-    mode = stat.S_IMODE(os.stat(dstpath).st_mode)
-    mode |= 0111
-    os.chmod(dstpath, mode)
-
-
-if __name__ == '__main__':
-    main()
diff --git a/setup.py b/setup.py
new file mode 100755 (executable)
index 0000000..661f135
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+# Copyright 2011 GRNET S.A. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or
+# without modification, are permitted provided that the following
+# conditions are met:
+#
+#   1. Redistributions of source code must retain the above
+#      copyright notice, this list of conditions and the following
+#      disclaimer.
+#
+#   2. Redistributions in binary form must reproduce the above
+#      copyright notice, this list of conditions and the following
+#      disclaimer in the documentation and/or other materials
+#      provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# The views and conclusions contained in the software and
+# documentation are those of the authors and should not be
+# interpreted as representing official policies, either expressed
+# or implied, of GRNET S.A.
+
+import kamaki
+
+from setuptools import setup
+
+
+setup(
+    name='kamaki',
+    version=kamaki.__version__,
+    description='A command-line tool for managing clouds',
+    long_description=open('README.rst').read(),
+    url='http://code.grnet.gr/projects/kamaki',
+    license='BSD',
+    packages=['kamaki'],
+    include_package_data=True,
+    entry_points={
+        'console_scripts': ['kamaki = kamaki.cli:main']
+    }
+)