Repository: ranger Updated Branches: refs/heads/ranger-1 4749f30f1 -> 4c54a4456
Revert "[RANGER-1951] Add whitespaces for be python3 compatible, fix the byte encoding issues, and that the hash is generated from all the source files" This reverts commit b2295a5e2e8b4848c60e6ed9929147748f5d44cb. (cherry picked from commit 1732536f1de4ac3f1699f660e089385487004261) Project: http://git-wip-us.apache.org/repos/asf/ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/4c54a445 Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/4c54a445 Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/4c54a445 Branch: refs/heads/ranger-1 Commit: 4c54a44568bf6eacf73229816dc797b8fb73a18c Parents: 4749f30 Author: Velmurugan Periasamy <[email protected]> Authored: Thu Jul 5 15:04:52 2018 -0400 Committer: Velmurugan Periasamy <[email protected]> Committed: Thu Jul 5 15:06:35 2018 -0400 ---------------------------------------------------------------------- ranger-util/pom.xml | 2 +- ranger-util/src/scripts/saveVersion.py | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ranger/blob/4c54a445/ranger-util/pom.xml ---------------------------------------------------------------------- diff --git a/ranger-util/pom.xml b/ranger-util/pom.xml index b5f5c8c..0ddd9d4 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}"/> + <arg value="${project.basedir}/target"/> </exec> </target> </configuration> http://git-wip-us.apache.org/repos/asf/ranger/blob/4c54a445/ranger-util/src/scripts/saveVersion.py ---------------------------------------------------------------------- diff --git a/ranger-util/src/scripts/saveVersion.py b/ranger-util/src/scripts/saveVersion.py index acf82bf..40c0267 100644 --- a/ranger-util/src/scripts/saveVersion.py +++ b/ranger-util/src/scripts/saveVersion.py @@ -34,11 +34,12 @@ from time import gmtime, strftime import platform def isWindowsSystem(): - return 'Windows' in platform.system() + return 'Windows' in platform.system() def check_output(query): - output = subprocess.check_output(query) - return output.decode("UTF-8") + p = subprocess.Popen(query, stdout=subprocess.PIPE) + output = p.communicate ()[0] + return output def hashfile(afile, hasher, blocksize=65536): buf = afile.read(blocksize) @@ -60,8 +61,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"]) @@ -86,9 +87,7 @@ def main(): c = [] fileList = [] sortedList = [] - parent_dir = os.path.join(src_dir, os.pardir) - - for (dir, _, files) in os.walk(parent_dir): + for (dir, _, files) in os.walk(src_dir): for f in files: path = os.path.join(dir, f) if path.endswith(".java"): @@ -103,10 +102,9 @@ def main(): f = m +" "+ val + "\n" c.append(f); - 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) + srcChecksum = hashlib.md5(''.join(c)).hexdigest() - dir = os.path.join(src_dir,"target","gen","org","apache","ranger","common") + dir = os.path.join(src_dir,"gen","org","apache","ranger","common") if not os.path.exists(dir): os.makedirs(dir) @@ -143,7 +141,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 , 'w') + f = open(des , 'wb') f.write(content) f.close()
