phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeffr...@apache.org
Subject git commit: phoenix-837: Phoenix python script should use os specific separators
Date Wed, 12 Mar 2014 00:54:22 GMT
Repository: incubator-phoenix
Updated Branches:
  refs/heads/4.0 5e3bac684 -> b0db92022


phoenix-837: Phoenix python script should use os specific separators


Project: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/commit/b0db9202
Tree: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/tree/b0db9202
Diff: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/diff/b0db9202

Branch: refs/heads/4.0
Commit: b0db92022f482f8f796aa471b4d7fa865c234b2b
Parents: 5e3bac6
Author: Jeffrey Zhong <jzhong@JZhongs-MacBook-Pro.local>
Authored: Tue Mar 11 17:56:12 2014 -0700
Committer: Jeffrey Zhong <jzhong@JZhongs-MacBook-Pro.local>
Committed: Tue Mar 11 17:56:12 2014 -0700

----------------------------------------------------------------------
 bin/csv-bulk-loader.py | 14 +++-----------
 bin/end2endTest.py     |  3 +--
 bin/performance.py     | 23 +++++------------------
 bin/phoenix_utils.py   | 41 +++++++++++++++++++++++++++++++++++++++++
 bin/psql.py            | 18 +++---------------
 bin/sqlline.py         | 18 +++---------------
 6 files changed, 56 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/b0db9202/bin/csv-bulk-loader.py
----------------------------------------------------------------------
diff --git a/bin/csv-bulk-loader.py b/bin/csv-bulk-loader.py
index 04028c8..385ef41 100755
--- a/bin/csv-bulk-loader.py
+++ b/bin/csv-bulk-loader.py
@@ -37,23 +37,15 @@
 
 import os
 import subprocess
-import fnmatch
 import sys
-
-
-def find(pattern, path):
-    for root, dirs, files in os.walk(path):
-        for name in files:
-            if fnmatch.fnmatch(name, pattern):
-                return os.path.join(root, name)
-    return ""
+import phoenix_utils
 
 current_dir = os.path.dirname(os.path.abspath(__file__))
 phoenix_jar_path = os.path.join(current_dir, "..", "phoenix-assembly",
                                 "target")
-phoenix_client_jar = find("phoenix-*-client.jar", phoenix_jar_path)
+phoenix_client_jar = phoenix_utils.find("phoenix-*-client.jar", phoenix_jar_path)
 
-java_cmd = 'java -cp ".:' + phoenix_client_jar +\
+java_cmd = 'java -cp ".' + os.pathsep + phoenix_client_jar +\
     '" org.apache.phoenix.map.reduce.CSVBulkLoader ' +\
     ' '.join(sys.argv[1:])
 

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/b0db9202/bin/end2endTest.py
----------------------------------------------------------------------
diff --git a/bin/end2endTest.py b/bin/end2endTest.py
index be7151b..f35cc21 100755
--- a/bin/end2endTest.py
+++ b/bin/end2endTest.py
@@ -21,7 +21,6 @@
 
 import os
 import subprocess
-import fnmatch
 import sys
 
 current_dir = os.path.dirname(os.path.abspath(__file__))
@@ -37,7 +36,7 @@ hbase_library_path = os.getenv('HBASE_LIBRARY_DIR', current_dir)
 print "Current ClassPath=%s:%s:%s" % (hbase_config_path, phoenix_jar_path,
                                       hbase_library_path)
 
-java_cmd = "java -cp " + hbase_config_path + ':' + phoenix_jar_path + ':' + \
+java_cmd = "java -cp " + hbase_config_path + os.pathsep + phoenix_jar_path + os.pathsep +
\
     hbase_library_path + " org.apache.phoenix.end2end.End2EndTestDriver " + \
     ' '.join(sys.argv[1:])
 

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/b0db9202/bin/performance.py
----------------------------------------------------------------------
diff --git a/bin/performance.py b/bin/performance.py
index 8361b05..f5d2d74 100755
--- a/bin/performance.py
+++ b/bin/performance.py
@@ -21,21 +21,8 @@
 
 import os
 import subprocess
-import fnmatch
 import sys
-
-
-def find(pattern, path):
-    # remove * if it's at the end of path
-    if ((path is not None) and (len(path) > 0) and (path[-1] == '*')) :
-        path = path[:-1]
-
-    for root, dirs, files in os.walk(path):
-        for name in files:
-            if fnmatch.fnmatch(name, pattern):
-                return os.path.join(root, name)
-    return ""
-
+import phoenix_utils
 
 def queryex(statments, description, statment):
     print "Query # %s - %s" % (description, statment)
@@ -77,21 +64,21 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
 phoenix_jar_path = os.getenv('PHOENIX_LIB_DIR',
                              os.path.join(current_dir, "..", "phoenix-assembly",
                                 "target"))
-phoenix_client_jar = find("phoenix-*-client.jar", phoenix_jar_path)
+phoenix_client_jar = phoenix_utils.find("phoenix-*-client.jar", phoenix_jar_path)
 phoenix_test_jar_path = os.getenv('PHOENIX_LIB_DIR',
                                 os.path.join(current_dir, "..", "phoenix-core",
                                      "target"))
-testjar = find("phoenix-*-tests.jar", phoenix_test_jar_path)
+testjar = phoenix_utils.find("phoenix-*-tests.jar", phoenix_test_jar_path)
 
 
 # HBase configuration folder path (where hbase-site.xml reside) for
 # HBase/Phoenix client side property override
 hbase_config_path = os.getenv('HBASE_CONF_DIR', current_dir)
 
-execute = ('java -cp "%s:%s" -Dlog4j.configuration=file:' +
+execute = ('java -cp "%s%s%s" -Dlog4j.configuration=file:' +
            os.path.join(current_dir, "log4j.properties") +
            ' org.apache.phoenix.util.PhoenixRuntime -t %s %s ') % \
-    (hbase_config_path, phoenix_client_jar, table, zookeeper)
+    (hbase_config_path, os.pathsep, phoenix_client_jar, table, zookeeper)
 
 # Create Table DDL
 createtable = "CREATE TABLE IF NOT EXISTS %s (HOST CHAR(2) NOT NULL,\

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/b0db9202/bin/phoenix_utils.py
----------------------------------------------------------------------
diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
new file mode 100755
index 0000000..d48c4ff
--- /dev/null
+++ b/bin/phoenix_utils.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+############################################################################
+#
+# 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.
+#
+############################################################################
+
+import os
+import sys
+import fnmatch
+
+def find(pattern, classPaths):
+    paths = classPaths.split(os.pathsep)
+
+    # for each class path
+    for path in paths:
+        # remove * if it's at the end of path
+        if ((path is not None) and (len(path) > 0) and (path[-1] == '*')) :
+            path = path[:-1]
+    
+        for root, dirs, files in os.walk(path):
+            for name in files:
+                if fnmatch.fnmatch(name, pattern):
+                    return os.path.join(root, name)
+                
+    return ""
+

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/b0db9202/bin/psql.py
----------------------------------------------------------------------
diff --git a/bin/psql.py b/bin/psql.py
index b84e090..f4ea018 100755
--- a/bin/psql.py
+++ b/bin/psql.py
@@ -21,30 +21,18 @@
 
 import os
 import subprocess
-import fnmatch
 import sys
-
-
-def find(pattern, path):
-    # remove * if it's at the end of path
-    if ((path is not None) and (len(path) > 0) and (path[-1] == '*')) :
-        path = path[:-1]
-
-    for root, dirs, files in os.walk(path):
-        for name in files:
-            if fnmatch.fnmatch(name, pattern):
-                return os.path.join(root, name)
-    return ""
+import phoenix_utils
 
 current_dir = os.path.dirname(os.path.abspath(__file__))
 phoenix_jar_path = os.getenv('PHOENIX_LIB_DIR',
                              os.path.join(current_dir, "..", "phoenix-assembly",
                                 "target"))
-phoenix_client_jar = find("phoenix-*-client.jar", phoenix_jar_path)
+phoenix_client_jar = phoenix_utils.find("phoenix-*-client.jar", phoenix_jar_path)
 
 # HBase configuration folder path (where hbase-site.xml reside) for
 # HBase/Phoenix client side property override
-java_cmd = 'java -cp ".:' + current_dir + ":" + phoenix_client_jar + \
+java_cmd = 'java -cp ".' + os.pathsep + current_dir + os.pathsep + phoenix_client_jar + \
     '" -Dlog4j.configuration=file:' + \
     os.path.join(current_dir, "log4j.properties") + \
     " org.apache.phoenix.util.PhoenixRuntime " + ' '.join(sys.argv[1:])

http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/b0db9202/bin/sqlline.py
----------------------------------------------------------------------
diff --git a/bin/sqlline.py b/bin/sqlline.py
index 381595f..7e995fb 100755
--- a/bin/sqlline.py
+++ b/bin/sqlline.py
@@ -21,26 +21,14 @@
 
 import os
 import subprocess
-import fnmatch
 import sys
-
-
-def find(pattern, path):
-    # remove * if it's at the end of path
-    if ((path is not None) and (len(path) > 0) and (path[-1] == '*')) :
-        path = path[:-1]
-
-    for root, dirs, files in os.walk(path):
-        for name in files:
-            if fnmatch.fnmatch(name, pattern):
-                return os.path.join(root, name)
-    return ""
+import phoenix_utils
 
 current_dir = os.path.dirname(os.path.abspath(__file__))
 phoenix_jar_path = os.getenv('PHOENIX_LIB_DIR',
                              os.path.join(current_dir, "..", "phoenix-assembly",
                                 "target"))
-phoenix_client_jar = find("phoenix-*-client.jar", phoenix_jar_path)
+phoenix_client_jar = phoenix_utils.find("phoenix-*-client.jar", phoenix_jar_path)
 
 if len(sys.argv) < 2:
     print "Zookeeper not specified. \nUsage: sqlline.sh <zookeeper> \
@@ -53,7 +41,7 @@ sqlfile = ""
 if len(sys.argv) > 2:
     sqlfile = "--run=" + sys.argv[2]
 
-java_cmd = 'java -cp ".:' + phoenix_client_jar + \
+java_cmd = 'java -cp ".' + os.pathsep + phoenix_client_jar + \
     '" -Dlog4j.configuration=file:' + \
     os.path.join(current_dir, "log4j.properties") + \
     " sqlline.SqlLine -d org.apache.phoenix.jdbc.PhoenixDriver \


Mime
View raw message