You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by zs...@apache.org on 2018/03/27 07:09:32 UTC
ranger git commit: [RANGER-1951] Add whitespaces for be python3
compatible, fix the byte encoding issues,
and that the hash is generated from all the source files
Repository: ranger
Updated Branches:
refs/heads/master 59956846b -> b2295a5e2
[RANGER-1951] Add whitespaces for be python3 compatible, fix the byte encoding issues, and that the hash is generated from all the source files
Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/b2295a5e
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/b2295a5e
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/b2295a5e
Branch: refs/heads/master
Commit: b2295a5e2e8b4848c60e6ed9929147748f5d44cb
Parents: 5995684
Author: Zsombor Gegesy <zs...@apache.org>
Authored: Tue Mar 27 09:08:11 2018 +0200
Committer: Zsombor Gegesy <zs...@apache.org>
Committed: Tue Mar 27 09:08:11 2018 +0200
----------------------------------------------------------------------
ranger-util/pom.xml | 2 +-
ranger-util/src/scripts/saveVersion.py | 22 ++++++++++++----------
2 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ranger/blob/b2295a5e/ranger-util/pom.xml
----------------------------------------------------------------------
diff --git a/ranger-util/pom.xml b/ranger-util/pom.xml
index e11a2d9..1b965db 100644
--- a/ranger-util/pom.xml
+++ b/ranger-util/pom.xml
@@ -50,7 +50,7 @@
<arg value="${project.basedir}/src/scripts/saveVersion.py"/>
<arg value="${project.version}"/>
<arg value="${ranger.version.shortname}"/>
- <arg value="${project.basedir}/target"/>
+ <arg value="${project.basedir}"/>
</exec>
</target>
</configuration>
http://git-wip-us.apache.org/repos/asf/ranger/blob/b2295a5e/ranger-util/src/scripts/saveVersion.py
----------------------------------------------------------------------
diff --git a/ranger-util/src/scripts/saveVersion.py b/ranger-util/src/scripts/saveVersion.py
index 40c0267..acf82bf 100644
--- a/ranger-util/src/scripts/saveVersion.py
+++ b/ranger-util/src/scripts/saveVersion.py
@@ -34,12 +34,11 @@ from time import gmtime, strftime
import platform
def isWindowsSystem():
- return 'Windows' in platform.system()
+ return 'Windows' in platform.system()
def check_output(query):
- p = subprocess.Popen(query, stdout=subprocess.PIPE)
- output = p.communicate ()[0]
- return output
+ output = subprocess.check_output(query)
+ return output.decode("UTF-8")
def hashfile(afile, hasher, blocksize=65536):
buf = afile.read(blocksize)
@@ -61,8 +60,8 @@ def main():
dir = os.getcwd()
cwd = dir.strip('scripts')
cwd = os.path.join(cwd, "src")
- if isWindowsSystem():
- cwd = cwd.replace("\\", "/")
+ if isWindowsSystem():
+ cwd = cwd.replace("\\", "/")
if revision == "" :
query = (["git","rev-parse","HEAD"])
@@ -87,7 +86,9 @@ def main():
c = []
fileList = []
sortedList = []
- for (dir, _, files) in os.walk(src_dir):
+ parent_dir = os.path.join(src_dir, os.pardir)
+
+ for (dir, _, files) in os.walk(parent_dir):
for f in files:
path = os.path.join(dir, f)
if path.endswith(".java"):
@@ -102,9 +103,10 @@ def main():
f = m +" "+ val + "\n"
c.append(f);
- srcChecksum = hashlib.md5(''.join(c)).hexdigest()
+ srcChecksum = hashlib.md5(''.join(c).encode('UTF-8')).hexdigest()
+ print('hash of the ' + str(len(sortedList)) + '\n\t file from: ' + parent_dir + '\n\t is ' + srcChecksum)
- dir = os.path.join(src_dir,"gen","org","apache","ranger","common")
+ dir = os.path.join(src_dir,"target","gen","org","apache","ranger","common")
if not os.path.exists(dir):
os.makedirs(dir)
@@ -141,7 +143,7 @@ def main():
content = content.format(VERSION=version,SHORTVERSION=shortversion,USER=user,DATE=date,URL=url,REV=revision,BRANCH=branch,SRCCHECKSUM=srcChecksum)
des = os.path.join(dir, "package-info.java")
- f = open(des , 'wb')
+ f = open(des , 'w')
f.write(content)
f.close()