Skip to content

Commit

Permalink
Minor cleanup in builder class
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Partee committed Jan 4, 2022
1 parent 7c73569 commit 5fd3b14
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions smartsim/_core/_install/builder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import multiprocessing as mp
import os
import shutil
import site
Expand Down Expand Up @@ -27,9 +26,9 @@ def __init__(self, jobs=None, verbose=False):

# Find _core directory and set up paths
_core_dir = Path(os.path.abspath(__file__)).parent.parent
self.build_dir = _core_dir.joinpath(".third-party")
self.bin_path = _core_dir.joinpath("bin/")
self.lib_path = _core_dir.joinpath("lib/")
self.build_dir = _core_dir / ".third-party"
self.bin_path = _core_dir / "bin"
self.lib_path = _core_dir / "lib"

# Set wether build process will output to std output
self.out = subprocess.DEVNULL
Expand Down Expand Up @@ -95,16 +94,6 @@ def copy_dir(self, src, dst, set_exe=False):
else:
self.copy_file(content, dst / content.name, set_exe=set_exe)

def copy_to_bin(self, files):
for file in files:
binary_dest = self.bin_path.joinpath(file.name)
self.copy_file(file, binary_dest, set_exe=True)

def copy_to_lib(self, files):
for file in files:
lib_dest = self.lib_path.joinpath(file.name)
self.copy_file(file, lib_dest)

def cleanup(self):
if self.build_dir.is_dir():
shutil.rmtree(str(self.build_dir))
Expand Down Expand Up @@ -173,10 +162,11 @@ def build_from_git(self, git_url, branch):
)

# move redis binaries to smartsim/smartsim/_core/bin
src_dir = redis_build_path.joinpath("src")
binaries = ["redis-server", "redis-cli"]
to_export = [src_dir.joinpath(_bin) for _bin in binaries]
self.copy_to_bin(to_export)
redis_src_dir = redis_build_path / "src"
self.copy_file(redis_src_dir / "redis-server",
self.bin_path / "redis-server")
self.copy_file(redis_src_dir / "redis-cli",
self.bin_path / "redis-cli")


class RedisAIBuilder(Builder):
Expand Down

0 comments on commit 5fd3b14

Please sign in to comment.