Skip to content

Commit

Permalink
TVB-2113: debugging logs
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianciu committed Dec 4, 2024
1 parent f9fda06 commit e9db126
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tvb_build/build_from_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,15 @@ def _replace_first_line_if_pattern(pathname: str, pattern: str, replacement: str
"""
for filename in os.listdir(pathname):
file_path = os.path.join(pathname, filename)
_log(1, f"Pip path: {file_path}")
if pattern in file_path:
with open(file_path, 'r') as file:
lines = file.readlines()
if lines:
lines[0] = replacement + '\n'
with open(file_path, 'w') as file:
file.writelines(lines)
print(f"First line of {file_path} replaced with: {replacement}")
_log(1, f"First line of {file_path} replaced with: {replacement}")


def _modify_pth(pth_name):
Expand Down Expand Up @@ -305,6 +306,7 @@ def prepare_anaconda_dist(config):
_modify_pth(config.easy_install_pth)
if config.bin_path:
_replace_first_line_if_pattern(config.bin_path, 'bin\\pip', '#!../tvb_data/bin/python')
_log(1, "Bin Path" + config.bin_path)
_fix_jupyter_kernel(config.target_library_root, config.platform_name == "Windows")

_log(1, "Creating command files:")
Expand Down

0 comments on commit e9db126

Please sign in to comment.