build: ensure we return to working directory after building
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 30 Nov 2015 12:33:39 +0000 (13:33 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 30 Nov 2015 12:33:39 +0000 (13:33 +0100)
litex/build/altera/quartus.py
litex/build/lattice/diamond.py
litex/build/xilinx/vivado.py

index d5eda886f48e1b6ad62e42cc3e896938ded65bdc..cdab36be32d7670740252501e91475ed0877fe22 100644 (file)
@@ -114,6 +114,7 @@ quartus_sta {build_name} -c {build_name}
 class AlteraQuartusToolchain:
     def build(self, platform, fragment, build_dir="build", build_name="top",
               toolchain_path="/opt/Altera", run=True):
+        cwd = os.getcwd()
         tools.mkdir_noerror(build_dir)
         os.chdir(build_dir)
 
@@ -135,7 +136,7 @@ class AlteraQuartusToolchain:
         if run:
             _run_quartus(build_name, toolchain_path)
 
-        os.chdir("..")
+        os.chdir(cwd)
 
         return v_output.ns
 
index cd169fdbcd159e924628c437e0774166c0e1605c..857fef02175b0a537fa8fcb263d92ddb58bae317 100644 (file)
@@ -78,6 +78,7 @@ class LatticeDiamondToolchain:
     def build(self, platform, fragment, build_dir="build", build_name="top",
               toolchain_path="/opt/Diamond", run=True):
         tools.mkdir_noerror(build_dir)
+        cwd = os.getcwd()
         os.chdir(build_dir)
 
         if not isinstance(fragment, _Fragment):
@@ -96,7 +97,7 @@ class LatticeDiamondToolchain:
         if run:
             _run_diamond(build_name, toolchain_path)
 
-        os.chdir("..")
+        os.chdir(cwd)
 
         return v_output.ns
 
index 18474d3d21ba1d6cecfc38edd1fcbcd2f9d65e21..557016e72da73d833bdaddd6db841e9d930fb59c 100644 (file)
@@ -114,6 +114,7 @@ class XilinxVivadoToolchain:
     def build(self, platform, fragment, build_dir="build", build_name="top",
             toolchain_path="/opt/Xilinx/Vivado", source=True, run=True):
         tools.mkdir_noerror(build_dir)
+        cwd = os.getcwd()
         os.chdir(build_dir)
 
         if not isinstance(fragment, _Fragment):
@@ -129,7 +130,7 @@ class XilinxVivadoToolchain:
         if run:
             _run_vivado(build_name, toolchain_path, source)
 
-        os.chdir("..")
+        os.chdir(cwd)
 
         return v_output.ns