From ea4e5b37bca4ff577d8648c4b37ce5ae190740f3 Mon Sep 17 00:00:00 2001 From: pjkaufman Date: Fri, 8 Mar 2019 01:33:57 -0500 Subject: [PATCH] Updated the python script and refactored it, removed the python folder due to lack of python files, and --- README.md | 4 +- docs/allclasses-frame.html | 4 +- docs/allclasses-noframe.html | 4 +- docs/constant-values.html | 4 +- docs/dbdiffchecker/Column.html | 4 +- docs/dbdiffchecker/DBCompare.html | 4 +- docs/dbdiffchecker/DB_Diff_Checker_GUI.html | 4 +- docs/dbdiffchecker/Database.html | 4 +- .../DatabaseDiffernceCheckerException.html | 4 +- docs/dbdiffchecker/DbConn.html | 4 +- docs/dbdiffchecker/ErrorPopup.html | 4 +- docs/dbdiffchecker/FileHandler.html | 4 +- docs/dbdiffchecker/Index.html | 4 +- docs/dbdiffchecker/JFrameV2.html | 4 +- docs/dbdiffchecker/Result.html | 4 +- docs/dbdiffchecker/Schema.html | 4 +- docs/dbdiffchecker/StopWatch.html | 4 +- docs/dbdiffchecker/Table.html | 4 +- docs/dbdiffchecker/View.html | 4 +- docs/dbdiffchecker/package-frame.html | 4 +- docs/dbdiffchecker/package-summary.html | 4 +- docs/dbdiffchecker/package-tree.html | 4 +- docs/deprecated-list.html | 4 +- docs/help-doc.html | 4 +- docs/index-all.html | 4 +- docs/index.html | 2 +- docs/overview-tree.html | 4 +- docs/serialized-form.html | 4 +- python/routines.py => routines.py | 135 +++++++----------- 29 files changed, 108 insertions(+), 137 deletions(-) rename python/routines.py => routines.py (58%) diff --git a/README.md b/README.md index a516c79..91a378f 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ Make sure that Python and the jre paths have been added to your PATH variable.

Usage

-Go to the python folder and run +Go to the base directory and run ``` python routines.py @@ -138,7 +138,7 @@ If there are no errors you will see the following GUI: ### Testing -After modifying any of the Java files in the repository, you can go to the python folder and run +After modifying any of the Java files in the repository, you can go to the base directory and run ``` python routines.py diff --git a/docs/allclasses-frame.html b/docs/allclasses-frame.html index d6e6437..8befea9 100644 --- a/docs/allclasses-frame.html +++ b/docs/allclasses-frame.html @@ -2,9 +2,9 @@ - + All Classes - + diff --git a/docs/allclasses-noframe.html b/docs/allclasses-noframe.html index 70b036b..fcda4be 100644 --- a/docs/allclasses-noframe.html +++ b/docs/allclasses-noframe.html @@ -2,9 +2,9 @@ - + All Classes - + diff --git a/docs/constant-values.html b/docs/constant-values.html index 73f6812..39dec5a 100644 --- a/docs/constant-values.html +++ b/docs/constant-values.html @@ -2,9 +2,9 @@ - + Constant Field Values - + diff --git a/docs/dbdiffchecker/Column.html b/docs/dbdiffchecker/Column.html index ba4c0d9..357a9df 100644 --- a/docs/dbdiffchecker/Column.html +++ b/docs/dbdiffchecker/Column.html @@ -2,9 +2,9 @@ - + Column - + diff --git a/docs/dbdiffchecker/DBCompare.html b/docs/dbdiffchecker/DBCompare.html index d5152d3..de10dbb 100644 --- a/docs/dbdiffchecker/DBCompare.html +++ b/docs/dbdiffchecker/DBCompare.html @@ -2,9 +2,9 @@ - + DBCompare - + diff --git a/docs/dbdiffchecker/DB_Diff_Checker_GUI.html b/docs/dbdiffchecker/DB_Diff_Checker_GUI.html index bdc475c..7d0ce2c 100644 --- a/docs/dbdiffchecker/DB_Diff_Checker_GUI.html +++ b/docs/dbdiffchecker/DB_Diff_Checker_GUI.html @@ -2,9 +2,9 @@ - + DB_Diff_Checker_GUI - + diff --git a/docs/dbdiffchecker/Database.html b/docs/dbdiffchecker/Database.html index c926c8f..4e25121 100644 --- a/docs/dbdiffchecker/Database.html +++ b/docs/dbdiffchecker/Database.html @@ -2,9 +2,9 @@ - + Database - + diff --git a/docs/dbdiffchecker/DatabaseDiffernceCheckerException.html b/docs/dbdiffchecker/DatabaseDiffernceCheckerException.html index adc7557..65a0c3e 100644 --- a/docs/dbdiffchecker/DatabaseDiffernceCheckerException.html +++ b/docs/dbdiffchecker/DatabaseDiffernceCheckerException.html @@ -2,9 +2,9 @@ - + DatabaseDiffernceCheckerException - + diff --git a/docs/dbdiffchecker/DbConn.html b/docs/dbdiffchecker/DbConn.html index 872fd45..de51a87 100644 --- a/docs/dbdiffchecker/DbConn.html +++ b/docs/dbdiffchecker/DbConn.html @@ -2,9 +2,9 @@ - + DbConn - + diff --git a/docs/dbdiffchecker/ErrorPopup.html b/docs/dbdiffchecker/ErrorPopup.html index 7b1cb2e..f08a87c 100644 --- a/docs/dbdiffchecker/ErrorPopup.html +++ b/docs/dbdiffchecker/ErrorPopup.html @@ -2,9 +2,9 @@ - + ErrorPopup - + diff --git a/docs/dbdiffchecker/FileHandler.html b/docs/dbdiffchecker/FileHandler.html index 2f3b709..3a6e5ce 100644 --- a/docs/dbdiffchecker/FileHandler.html +++ b/docs/dbdiffchecker/FileHandler.html @@ -2,9 +2,9 @@ - + FileHandler - + diff --git a/docs/dbdiffchecker/Index.html b/docs/dbdiffchecker/Index.html index 7c388fb..14be632 100644 --- a/docs/dbdiffchecker/Index.html +++ b/docs/dbdiffchecker/Index.html @@ -2,9 +2,9 @@ - + Index - + diff --git a/docs/dbdiffchecker/JFrameV2.html b/docs/dbdiffchecker/JFrameV2.html index c0bd8c3..2334bc3 100644 --- a/docs/dbdiffchecker/JFrameV2.html +++ b/docs/dbdiffchecker/JFrameV2.html @@ -2,9 +2,9 @@ - + JFrameV2 - + diff --git a/docs/dbdiffchecker/Result.html b/docs/dbdiffchecker/Result.html index 4ec2f43..46ff430 100644 --- a/docs/dbdiffchecker/Result.html +++ b/docs/dbdiffchecker/Result.html @@ -2,9 +2,9 @@ - + Result - + diff --git a/docs/dbdiffchecker/Schema.html b/docs/dbdiffchecker/Schema.html index ec08ceb..3d733f4 100644 --- a/docs/dbdiffchecker/Schema.html +++ b/docs/dbdiffchecker/Schema.html @@ -2,9 +2,9 @@ - + Schema - + diff --git a/docs/dbdiffchecker/StopWatch.html b/docs/dbdiffchecker/StopWatch.html index d1161d6..3f812c2 100644 --- a/docs/dbdiffchecker/StopWatch.html +++ b/docs/dbdiffchecker/StopWatch.html @@ -2,9 +2,9 @@ - + StopWatch - + diff --git a/docs/dbdiffchecker/Table.html b/docs/dbdiffchecker/Table.html index 285cac8..c030357 100644 --- a/docs/dbdiffchecker/Table.html +++ b/docs/dbdiffchecker/Table.html @@ -2,9 +2,9 @@ - + Table - + diff --git a/docs/dbdiffchecker/View.html b/docs/dbdiffchecker/View.html index e5641bf..d0b5050 100644 --- a/docs/dbdiffchecker/View.html +++ b/docs/dbdiffchecker/View.html @@ -2,9 +2,9 @@ - + View - + diff --git a/docs/dbdiffchecker/package-frame.html b/docs/dbdiffchecker/package-frame.html index 1e0f6f2..2189085 100644 --- a/docs/dbdiffchecker/package-frame.html +++ b/docs/dbdiffchecker/package-frame.html @@ -2,9 +2,9 @@ - + dbdiffchecker - + diff --git a/docs/dbdiffchecker/package-summary.html b/docs/dbdiffchecker/package-summary.html index 02df4f0..edab28c 100644 --- a/docs/dbdiffchecker/package-summary.html +++ b/docs/dbdiffchecker/package-summary.html @@ -2,9 +2,9 @@ - + dbdiffchecker - + diff --git a/docs/dbdiffchecker/package-tree.html b/docs/dbdiffchecker/package-tree.html index 87e62e8..001f5f3 100644 --- a/docs/dbdiffchecker/package-tree.html +++ b/docs/dbdiffchecker/package-tree.html @@ -2,9 +2,9 @@ - + dbdiffchecker Class Hierarchy - + diff --git a/docs/deprecated-list.html b/docs/deprecated-list.html index cbc8548..168a848 100644 --- a/docs/deprecated-list.html +++ b/docs/deprecated-list.html @@ -2,9 +2,9 @@ - + Deprecated List - + diff --git a/docs/help-doc.html b/docs/help-doc.html index c757e2c..acf79b0 100644 --- a/docs/help-doc.html +++ b/docs/help-doc.html @@ -2,9 +2,9 @@ - + API Help - + diff --git a/docs/index-all.html b/docs/index-all.html index 94779e3..e66cd5f 100644 --- a/docs/index-all.html +++ b/docs/index-all.html @@ -2,9 +2,9 @@ - + Index - + diff --git a/docs/index.html b/docs/index.html index ac995de..a37aee9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,7 +2,7 @@ - + Generated Documentation (Untitled) diff --git a/docs/serialized-form.html b/docs/serialized-form.html index e74b03b..a8fe62c 100644 --- a/docs/serialized-form.html +++ b/docs/serialized-form.html @@ -2,9 +2,9 @@ - + Serialized Form - + diff --git a/python/routines.py b/routines.py similarity index 58% rename from python/routines.py rename to routines.py index b73d7d8..f22dd04 100644 --- a/python/routines.py +++ b/routines.py @@ -1,12 +1,10 @@ import os -import platform from subprocess import call from subprocess import check_output -import shutil +from shutil import rmtree from shutil import copy class Routines: #instance variables - __OS = '' __debugDir = 'test' __distrDir = 'build' __jarDir = 'jarLibrary' @@ -19,22 +17,14 @@ class Routines: #__init__ is the constructor which initializes all instance variables def __init__(self): - self.__OS = platform.system() - #change directory to jar file location - self.chdir('..,' + self.getJarPath()) + #sets the class path for later use #get current jar list and add it to the Class-Path - filelist = [fi for fi in os.listdir(os.getcwd()) if fi.endswith('.jar')] + filelist = [fi for fi in os.listdir(os.path.join(os.getcwd(), self.getJarPath())) if fi.endswith('.jar')] for fi in filelist: - self.__javaCP += self.formatStr("\".;..," + self.getJarPath() + "," + fi + "\";") + self.__javaCP += "\".;" + os.path.join(self.getJarPath(), fi) + "\";" self.__javaCP = self.__javaCP[:-1] - #move back to the python directory - self.chdir('..,python') return None - #getOSName gets the OS variable - def getOSName(self): - return self.__OS - #getLogFileDirectory gets the name of the log file directory def getLogFileDirectory(self): return self.__logFileDir @@ -73,32 +63,7 @@ def shouldCreateBuild(self): #getClassPath is the classpath for java compilation def getClassPath(self): return self.__javaCP - - #formatStr takes a string and converts all ','s to either '\\' or '/' - #param: str is the string to have all commas replaced with either '\\' or '/' - def formatStr(self, str): - if(self.getOSName() == 'Windows'): - return str.replace(',', "\\") - else: - return str.replace(',', '/') - - #chdir takes a string which is converted to the right format and then changes to the specified directory - #param dirStr is a string which represents a directory change string (for example: "..,bin") - def chdir(self, dirStr): - #format and run the change directory string - os.chdir( self.formatStr(dirStr)) - return None - - #mkdir takes a string which is converted to the right format and then makes the specified directory - #param dirStr is a string which represents a directory change string (for example: "..,bin") - def mkdir(self, dirStr): - #format and make the directory - try: - os.mkdir( self.formatStr(dirStr)) - except OSError: - pass - return None - + #compile compiles java files and determines where to send the output #param: path is the path to where to send the class files #param: type is either True or False to determine whether or not to compile @@ -110,7 +75,7 @@ def compile(self, path, type): #compile the java files and make the jar file try: - check_output(self.formatStr(start + ' -cp ' + self.getClassPath() + ' ..,' + self.getPackageName() + ',*.java'), shell=True) + check_output(start + ' -cp ' + self.getClassPath() + ' ' + os.path.join(self.getPackageName(), '*.java'), shell=True) print 'Compiled files' except Exception as e: print str(e) @@ -121,52 +86,47 @@ def compile(self, path, type): #makeJar sets up the manifest and makes the JAR file def makeJar(self): self.updateManifest() + logDir = self.getLogFileDirectory() + buildDir = self.getDistrubutionPath() + packageName = self.getPackageName() #compile the java files and make the jar file - if(self.compile(self.formatStr('..,' + self.getPackageName()), False)): - call(self.formatStr('jar cvfm ..,' + self.getDistrubutionPath() + ',Db_Diff_Checker.jar ..,manifest.mf ..,' + self.getPackageName() + ', ..,Images ..,' + self.getJarPath() + ' ..,' + self.getDistrubutionPath() + ',' + self.getLogFileDirectory() + ','), shell=True) + if(self.compile(packageName, False)): + call('jar cvfm ' + os.path.join(buildDir, 'Db_Diff_Checker.jar') + ' manifest.mf ' + + packageName + ' Images ' + self.getJarPath() + ' ' + os.path.join(buildDir, logDir), shell=True) #remove unnecesssary directory - self.__removeDirectory('..,' + self.getDistrubutionPath() + ',' + self.getLogFileDirectory()) + self.__removeDirectory(os.path.join(buildDir, logDir)) #remove unnecesssary .class files - self.chdir('..,' + self.getPackageName()) - filelist = [f for f in os.listdir(os.getcwd()) if f.endswith('.class')] + filelist = [f for f in os.listdir(os.path.join(os.getcwd(), self.getPackageName())) if f.endswith('.class')] for f in filelist: - os.remove(os.path.join(os.getcwd(), f)) + os.remove(os.path.join(os.getcwd(), packageName, f)) - #move back to the python directory - self.chdir('..,python') return None #debug sets up a debugging environment for the current code base def debug(self): #create the test directory - if (self.shouldCreateTest()): + if (self.shouldCreateTest()): # currently an obsolete line self.createTest() + testDir = self.getDebugPath() #run compiled files with classPath - if (self.compile(self.formatStr('..,test'), True)): - #move to run directory - self.chdir('..,test') - call('java ' + self.getPackageName() + '.DB_Diff_Checker_GUI', shell=True) - #move back to the python directory - self.chdir('..,python') + if (self.compile(testDir, True)): + call('java -cp ;' + testDir + ' ' + self.getPackageName() + '.DB_Diff_Checker_GUI', shell=True) + return None #updateManifest writes to manifest.mf and sets it up for use in a JAR file def updateManifest(self): #make the manfest file - f = open(self.formatStr('..,manifest.mf'), 'w+') + f = open('manifest.mf', 'w+') #add the proper verion info f.write("Manifest-Version: 1.0\n") f.write("Ant-Version: Apache Ant 1.9.7\n") cP = 'Class-Path: ' mC = 'Main-Class: ' + self.getPackageName() + '.DB_Diff_Checker_GUI' - #change directory to jar file location - self.chdir('..,' + self.getJarPath()) #get current jar list and add it to the Class-Path - filelist = [fi for fi in os.listdir(os.getcwd()) if fi.endswith('.jar')] + filelist = [fi for fi in os.listdir(os.path.join(os.getcwd(), self.getJarPath())) if fi.endswith('.jar')] for fi in filelist: - cP += self.formatStr(self.getDistributionJarDirectory() + ',' + fi + ' ') - #move back to the python directory - self.chdir('..,python') + cP += os.path.join(self.getDistributionJarDirectory(), fi) + ' ' #Class-Path is added if a jar file was found if (cP != 'Class-Path: '): f.write(cP + "\n") @@ -176,14 +136,14 @@ def updateManifest(self): #clean deletes the test and build directories def clean(self): - self.__removeDirectory('..,build') - self.__removeDirectory('..,test') + self.__removeDirectory(self.getDebugPath()) + self.__removeDirectory(self.getDistrubutionPath()) #__removeDirectory takes in a directory and removes it if it exists #param: directory is the directory to remove def __removeDirectory(self, directory): try: - shutil.rmtree(self.formatStr(directory)) + rmtree(directory) except: pass return None @@ -193,11 +153,7 @@ def run(self): if (self.shouldCreateBuild()): self.createBuild() self.makeJar() - #move to run directory - self.chdir('..,' + self.getDistrubutionPath()) - call(self.formatStr('java -jar ..,' + self.getDistrubutionPath() +',Db_Diff_Checker.jar'), shell=True) - #move back to the python directory - self.chdir('..,python') + call('java -jar ' + os.path.join(self.getDistrubutionPath(), 'Db_Diff_Checker.jar'), shell=True) return None #push cleans, documents, and push the repo @@ -212,27 +168,42 @@ def push(self): #documnet documents the repo def document(self): - self.chdir('..') call('javadoc -d "docs" "' + self.getPackageName() + '"', shell=True) - self.chdir('python') return None #createTest creates the test directory and makes it ready for the user def createTest(self): - self.mkdir('..,test') - self.mkdir('..,test,' + self.getLogFileDirectory()) - self.mkdir('..,test,Images') - self.chdir('..') + debugFolder = self.getDebugPath() + try: + os.mkdir(debugFolder) + except: + pass + try: + os.mkdir(os.path.join(debugFolder, self.getLogFileDirectory())) + except: + pass + try: + os.mkdir(os.path.join(debugFolder, 'Images')) + except: + pass + #copy current image list to the Images folder in the test directory - filelist = [f for f in os.listdir(os.path.join(os.getcwd(), self.formatStr('Images,')))] + filelist = [f for f in os.listdir(os.path.join(os.getcwd(),'Images'))] for f in filelist: - copy(os.path.join(os.getcwd(), self.formatStr('Images,') + f), os.getcwd() + self.formatStr(',test,Images')) - self.chdir('python') + copy(os.path.join(os.getcwd(), 'Images', f), os.path.join(os.getcwd(), debugFolder, 'Images')) #createBuild makes the build directory def createBuild(self): - self.mkdir('..,build') - self.mkdir('..,build,' + self.getLogFileDirectory()) + buildFolder = self.getDistrubutionPath() + try: + os.mkdir(buildFolder) + except: + pass + try: + os.mkdir(os.path.join(buildFolder, self.getLogFileDirectory())) + except: + pass + self.__createBuild = False def main():