Skip to content

Commit df26b51

Browse files
committed
Simplify subprocess blocks in GeosLibrary.build
1 parent ee4d68b commit df26b51

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

packages/basemap/utils/GeosLibrary.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -218,24 +218,17 @@ def build(self, installdir=None, njobs=1):
218218
else:
219219
build_opts = ["-j", "{0:d}".format(njobs)] + build_opts
220220

221-
# Now move to the GEOS source code folder and build with CMake.
222-
cwd = os.getcwd()
221+
# Call cmake configure after ensuring that the build directory exists.
223222
try:
224-
# Ensure that the build directory exists.
225-
try:
226-
os.makedirs(builddir)
227-
except OSError:
228-
pass
229-
os.chdir(builddir)
230-
# Call cmake configure.
231-
subprocess.call(["cmake", ".."] + config_opts)
232-
# Ensure that the install directory exists.
233-
try:
234-
os.makedirs(installdir)
235-
except OSError:
236-
pass
237-
# Call cmake build and install.
238-
subprocess.call(["cmake", "--build", "."] + build_opts,
239-
env=build_env)
240-
finally:
241-
os.chdir(cwd)
223+
os.makedirs(builddir)
224+
except OSError:
225+
pass
226+
subprocess.call(["cmake", ".."] + config_opts, cwd=builddir)
227+
228+
# Call cmake build after ensuring that the install directory exists.
229+
try:
230+
os.makedirs(installdir)
231+
except OSError:
232+
pass
233+
subprocess.call(["cmake", "--build", "."] + build_opts,
234+
cwd=builddir, env=build_env)

0 commit comments

Comments
 (0)