Skip to content

Commit

Permalink
Able to save file in the virtual env of another project
Browse files Browse the repository at this point in the history
  • Loading branch information
PauloRadatz committed Oct 7, 2024
1 parent fb33733 commit 487626c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,18 @@ def build_opendss(self):
# logging.info("OpenDSS build completed successfully.")

# Define the target directory for the compiled library
target_lib_dir = os.path.join("opendss_official", "linux")
target_lib_dir = os.path.join("src", "py_dss_interface", "opendss_official", "linux", "cpp")
compiled_lib = os.path.join(build_dir, "libopendssc.so")
if not os.path.exists(target_lib_dir):
os.makedirs(target_lib_dir)
logging.info(f"Created target directory: {target_lib_dir}")

# Create a text file in the target directory
info_file_path = os.path.join(target_lib_dir, "info.so")
with open(info_file_path, "w") as file:
file.write("OpenDSS build information:\n")

# Move the compiled library (e.g., libopendssc.so) to the target folder
compiled_lib = os.path.join(build_dir, "libopendssc.so")
if os.path.exists(compiled_lib):
subprocess.check_call(["cp", compiled_lib, target_lib_dir])
logging.info(f"Successfully moved {compiled_lib} to {target_lib_dir}")
Expand Down Expand Up @@ -202,7 +207,7 @@ def read(*names, **kwargs):
'opendss_official/windows/delphi/x86/*.dll',
'opendss_official/windows/cpp/x64/*.dll',
'opendss_official/windows/cpp/x86/*.dll',
'opendss_official/linux/cpp/x64/*.so',
'opendss_official/linux/cpp/*.so',
]
},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
Expand Down

0 comments on commit 487626c

Please sign in to comment.