Browse Source

HADOOP-6454. Create setup.py for EC2 cloud scripts.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@893262 13f79535-47bb-0310-9956-ffa450edef68
Thomas White 15 years ago
parent
commit
0ebcb62515

+ 2 - 0
CHANGES.txt

@@ -76,6 +76,8 @@ Trunk (unreleased changes)
     HADOOP-6444. Support additional security group option in hadoop-ec2 script.
     (Paul Egan via tomwhite)
 
+    HADOOP-6454. Create setup.py for EC2 cloud scripts. (tomwhite)
+
   OPTIMIZATIONS
 
   BUG FIXES

+ 0 - 1
src/contrib/cloud/src/py/VERSION

@@ -1 +0,0 @@
-0.22.0

+ 0 - 0
src/contrib/cloud/src/py/hadoop-ec2


+ 2 - 1
src/contrib/cloud/src/py/hadoop/cloud/__init__.py

@@ -11,4 +11,5 @@
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
-# limitations under the License.
+# limitations under the License.
+VERSION="0.22.0"

+ 1 - 3
src/contrib/cloud/src/py/hadoop/cloud/cli.py

@@ -16,6 +16,7 @@
 from __future__ import with_statement
 
 import ConfigParser
+from hadoop.cloud import VERSION
 from hadoop.cloud.cluster import get_cluster
 from hadoop.cloud.service import InstanceTemplate
 from hadoop.cloud.service import HadoopService
@@ -32,9 +33,6 @@ from optparse import make_option
 import os
 import sys
 
-version_file = os.path.join(sys.path[0], "VERSION")
-VERSION = open(version_file, "r").read().strip()
-
 DEFAULT_CLOUD_PROVIDER = 'ec2'
 
 DEFAULT_CONFIG_DIR_NAME = '.hadoop-cloud'

+ 0 - 0
src/contrib/cloud/src/py/hadoop-ec2-init-remote.sh → src/contrib/cloud/src/py/hadoop/cloud/data/hadoop-ec2-init-remote.sh


+ 2 - 1
src/contrib/cloud/src/py/hadoop/cloud/service.py

@@ -247,7 +247,8 @@ echo Proxy pid %s;""" % (process.pid, process.pid)
   
 
   def _get_default_user_data_file_template(self):
-    return os.path.join(sys.path[0], 'hadoop-%s-init-remote.sh' %
+    data_path = os.path.join(os.path.dirname(__file__), 'data')
+    return os.path.join(data_path, 'hadoop-%s-init-remote.sh' %
                  self.cluster.get_provider_code())
   
   def _get_master(self):

+ 30 - 0
src/contrib/cloud/src/py/setup.py

@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from distutils.core import setup
+
+version = __import__('hadoop.cloud').cloud.VERSION
+
+setup(name='hadoop-cloud',
+      version=version,
+      description='Scripts for running Hadoop on cloud providers',
+      license = 'Apache License (2.0)',
+      url = 'http://hadoop.apache.org/common/',
+      packages=['hadoop', 'hadoop.cloud','hadoop.cloud.providers'],
+      package_data={'hadoop.cloud': ['data/*.sh']},
+      scripts=['hadoop-ec2'],
+      author = 'Apache Hadoop Contributors',
+      author_email = 'common-dev@hadoop.apache.org',
+)