diff options
Diffstat (limited to 'src/ngspice_ghdl.py')
-rwxr-xr-x | src/ngspice_ghdl.py | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/src/ngspice_ghdl.py b/src/ngspice_ghdl.py index 9991793..e873555 100755 --- a/src/ngspice_ghdl.py +++ b/src/ngspice_ghdl.py @@ -91,7 +91,7 @@ class Mainwindow(QtGui.QWidget): def browseFile(self): print("Browse button clicked") self.filename = QtGui.QFileDialog.getOpenFileName( - self, 'Open File', '.') + self, 'Open File', '.') self.ledit.setText(self.filename) print("Vhdl file uploaded to process :", self.filename) @@ -140,7 +140,10 @@ class Mainwindow(QtGui.QWidget): ) if ret == QtGui.QMessageBox.Ok: print("Overwriting existing model " + self.modelname) - cmd = "rm -rf " + self.modelname + if os.name == 'nt': + cmd = "rmdir " + self.modelname + "/s /q" + else: + cmd = "rm -rf " + self.modelname # process = subprocess.Popen( # cmd, stdout=subprocess.PIPE, # stderr=subprocess.PIPE, shell=True @@ -215,18 +218,30 @@ class Mainwindow(QtGui.QWidget): shutil.copy(os.path.join(self.home, self.src_home) + "/src/ghdlserver/Vhpi_Package.vhdl", path + "/DUTghdl/") + if os.name == 'nt': + shutil.copy(os.path.join(self.home, self.src_home) + + "/src/ghdlserver/libws2_32.a", path + "/DUTghdl/") + for file in self.file_list: shutil.copy(str(file), path + "/DUTghdl/") os.chdir(path + "/DUTghdl") - subprocess.call("bash " + path + "/DUTghdl/compile.sh", shell=True) - subprocess.call("chmod a+x start_server.sh", shell=True) - subprocess.call("chmod a+x sock_pkg_create.sh", shell=True) + if os.name == 'nt': + # path to msys bin directory where bash is located + self.msys_bin = self.parser.get('COMPILER', 'MSYS_HOME') + subprocess.call(self.msys_bin+"/bash.exe " + + path + "/DUTghdl/compile.sh", shell=True) + subprocess.call(self.msys_bin+"/bash.exe -c " + + "'chmod a+x start_server.sh'", shell=True) + subprocess.call(self.msys_bin+"/bash.exe -c " + + "'chmod a+x sock_pkg_create.sh'", shell=True) + else: + subprocess.call("bash " + path + "/DUTghdl/compile.sh", shell=True) + subprocess.call("chmod a+x start_server.sh", shell=True) + subprocess.call("chmod a+x sock_pkg_create.sh", shell=True) + os.remove("compile.sh") os.remove("ghdlserver.c") - # os.remove("ghdlserver.h") - # os.remove("Utility_Package.vhdl") - # os.remove("Vhpi_Package.vhdl") # Slot to redirect stdout and stderr to window console @QtCore.pyqtSlot() @@ -242,10 +257,18 @@ class Mainwindow(QtGui.QWidget): def runMake(self): print("run Make Called") self.release_home = self.parser.get('NGSPICE', 'RELEASE') - os.chdir(self.release_home) + path_icm = os.path.join(self.release_home, "src/xspice/icm") + os.chdir(path_icm) + try: - cmd = " make" - print("Running Make command in " + self.release_home) + if os.name == 'nt': + # path to msys bin directory where make is located + self.msys_bin = self.parser.get('COMPILER', 'MSYS_HOME') + cmd = self.msys_bin+"\\make.exe" + else: + cmd = " make" + + print("Running Make command in " + path_icm) path = os.getcwd() # noqa self.process = QtCore.QProcess(self) self.process.start(cmd) @@ -257,7 +280,11 @@ class Mainwindow(QtGui.QWidget): def runMakeInstall(self): print("run Make Install Called") try: - cmd = " make install" + if os.name == 'nt': + self.msys_bin = self.parser.get('COMPILER', 'MSYS_HOME') + cmd = self.msys_bin+"\\make.exe install" + else: + cmd = " make install" print("Running Make Install") path = os.getcwd() # noqa try: |