From 0ebcb62515afc8e28709f2a6f384da669e3e776d Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 22 Dec 2009 18:33:48 +0000 Subject: [PATCH] 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 --- CHANGES.txt | 2 ++ src/contrib/cloud/src/py/VERSION | 1 - src/contrib/cloud/src/py/hadoop-ec2 | 0 .../cloud/src/py/hadoop/cloud/__init__.py | 3 +- src/contrib/cloud/src/py/hadoop/cloud/cli.py | 4 +-- .../cloud/data}/hadoop-ec2-init-remote.sh | 0 .../cloud/src/py/hadoop/cloud/service.py | 3 +- src/contrib/cloud/src/py/setup.py | 30 +++++++++++++++++++ 8 files changed, 37 insertions(+), 6 deletions(-) delete mode 100644 src/contrib/cloud/src/py/VERSION mode change 100644 => 100755 src/contrib/cloud/src/py/hadoop-ec2 rename src/contrib/cloud/src/py/{ => hadoop/cloud/data}/hadoop-ec2-init-remote.sh (100%) create mode 100644 src/contrib/cloud/src/py/setup.py diff --git a/CHANGES.txt b/CHANGES.txt index e6923ff4cf..5b8d1a7d75 100644 --- a/CHANGES.txt +++ b/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 diff --git a/src/contrib/cloud/src/py/VERSION b/src/contrib/cloud/src/py/VERSION deleted file mode 100644 index a7f3fc27a7..0000000000 --- a/src/contrib/cloud/src/py/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.22.0 \ No newline at end of file diff --git a/src/contrib/cloud/src/py/hadoop-ec2 b/src/contrib/cloud/src/py/hadoop-ec2 old mode 100644 new mode 100755 diff --git a/src/contrib/cloud/src/py/hadoop/cloud/__init__.py b/src/contrib/cloud/src/py/hadoop/cloud/__init__.py index 13878a13a7..1cae02393f 100644 --- a/src/contrib/cloud/src/py/hadoop/cloud/__init__.py +++ b/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. \ No newline at end of file +# limitations under the License. +VERSION="0.22.0" \ No newline at end of file diff --git a/src/contrib/cloud/src/py/hadoop/cloud/cli.py b/src/contrib/cloud/src/py/hadoop/cloud/cli.py index 2403e59256..3827ba40b8 100644 --- a/src/contrib/cloud/src/py/hadoop/cloud/cli.py +++ b/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 @@ 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' diff --git a/src/contrib/cloud/src/py/hadoop-ec2-init-remote.sh b/src/contrib/cloud/src/py/hadoop/cloud/data/hadoop-ec2-init-remote.sh similarity index 100% rename from src/contrib/cloud/src/py/hadoop-ec2-init-remote.sh rename to src/contrib/cloud/src/py/hadoop/cloud/data/hadoop-ec2-init-remote.sh diff --git a/src/contrib/cloud/src/py/hadoop/cloud/service.py b/src/contrib/cloud/src/py/hadoop/cloud/service.py index 84327fd19f..5be74d51e1 100644 --- a/src/contrib/cloud/src/py/hadoop/cloud/service.py +++ b/src/contrib/cloud/src/py/hadoop/cloud/service.py @@ -247,7 +247,8 @@ def _prompt(self, prompt): 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): diff --git a/src/contrib/cloud/src/py/setup.py b/src/contrib/cloud/src/py/setup.py new file mode 100644 index 0000000000..238b4a9c0f --- /dev/null +++ b/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', +)