Permalink
Browse files

Update description in setup.py, add script for migrating from the old…

… style (pre

0.5) paths.


git-svn-id: https://svn.apache.org/repos/asf/libcloud/trunk@1210186 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 38ca6ec commit c76eb77732bc25c0036fa835ecdac802b5a3ccb6 @Kami Kami committed Dec 4, 2011
Showing with 67 additions and 1 deletion.
  1. +65 −0 contrib/migrate_paths.sh
  2. +2 −1 setup.py
View
@@ -0,0 +1,65 @@
+#!/bin/bash
+# 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.
+#
+# Script for migrating from the old style libcloud paths (pre 0.5) to the new
+# ones.
+# THIS SCRIPT WILL MODIFY FILES IN PLACE. BE SURE TO BACKUP THEM BEFORE RUNNING
+# IT. LIBCLOUD TEAM CANNOT BE RESPONSIBLE FOR ANY DAMAGE CAUSED BY THIS SCRIPT.
+# Note: If you are on OS X / FreeBSD, you need to install GNU sed.
+
+DIRECTORY=$1
+
+SED=`which gsed gnused sed`
+
+for value in $SED
+do
+ SED=${value}
+ break
+done
+
+if [ ! $DIRECTORY ]; then
+ echo "Usage: ./migrate_paths.sh <directory with your code>"
+ exit 1
+fi
+
+OLD_PATHS[0]="libcloud.base"
+OLD_PATHS[1]="libcloud.deployment"
+OLD_PATHS[2]="libcloud.drivers"
+OLD_PATHS[3]="libcloud.ssh"
+OLD_PATHS[4]="libcloud.types"
+OLD_PATHS[5]="libcloud.providers"
+
+UPDATED_PATHS[0]="libcloud.compute.base"
+UPDATED_PATHS[1]="libcloud.compute.deployment"
+UPDATED_PATHS[2]="libcloud.compute.drivers"
+UPDATED_PATHS[3]="libcloud.compute.ssh"
+UPDATED_PATHS[4]="libcloud.compute.types"
+UPDATED_PATHS[5]="libcloud.compute.providers"
+
+for (( i = 0 ; i < ${#OLD_PATHS[@]} ; i++ ))
+do
+ old_path=${OLD_PATHS[$i]}
+ new_path=${UPDATED_PATHS[$i]}
+
+ cmd1="find ${DIRECTORY} -name '*.py' -type f -print0 | xargs -0 ${SED} -i -e 's/^from ${old_path} import/from ${new_path} import/g'"
+ cmd2="find ${DIRECTORY} -name '*.py' -type f -print0 | xargs -0 ${SED} -i -e 's/^import ${old_path}/import ${new_path}/g'"
+
+ echo "Migrating: ${old_path} -> ${new_path}"
+ eval "$cmd1"
+ eval "$cmd2"
+done
View
@@ -201,7 +201,8 @@ def run(self):
setup(
name='apache-libcloud',
version=read_version_string(),
- description='A unified interface into many cloud server providers',
+ description='A standard Python library that abstracts away differences' +
+ 'among multiple cloud provider APIs',
author='Apache Software Foundation',
author_email='dev@libcloud.apache.org',
requires=([], ['ssl', 'simplejson'],)[pre_python26],

0 comments on commit c76eb77

Please sign in to comment.