MilesCranmer commited on
Commit
73e83d4
1 Parent(s): a6b3561

Fix precompilation logic

Browse files
Files changed (1) hide show
  1. pysr/julia_helpers.py +4 -9
pysr/julia_helpers.py CHANGED
@@ -78,17 +78,15 @@ def install(julia_project=None, quiet=False, precompile=None): # pragma: no cov
78
  processed_julia_project, is_shared = _process_julia_project(julia_project)
79
  _set_julia_project_env(processed_julia_project, is_shared)
80
 
81
- if not precompile:
82
  os.environ["JULIA_PKG_PRECOMPILE_AUTO"] = "0"
83
 
84
  julia.install(quiet=quiet)
85
  Main, init_log = init_julia(julia_project, quiet=quiet, return_aux=True)
86
  io_arg = _get_io_arg(quiet)
87
 
88
- if precompile is None and not init_log["compiled_modules"]:
89
- precompile = False
90
- else:
91
- precompile = True
92
 
93
  if not precompile:
94
  Main.eval('ENV["JULIA_PKG_PRECOMPILE_AUTO"] = 0')
@@ -100,10 +98,7 @@ def install(julia_project=None, quiet=False, precompile=None): # pragma: no cov
100
  Main.eval("using Pkg")
101
  Main.eval(f"Pkg.instantiate({io_arg})")
102
 
103
- if precompile and (
104
- "JULIA_PKG_PRECOMPILE_AUTO" not in os.environ
105
- or str(os.environ["JULIA_PKG_PRECOMPILE_AUTO"]) != "0"
106
- ):
107
  Main.eval(f"Pkg.precompile({io_arg})")
108
 
109
  if not quiet:
 
78
  processed_julia_project, is_shared = _process_julia_project(julia_project)
79
  _set_julia_project_env(processed_julia_project, is_shared)
80
 
81
+ if precompile == False:
82
  os.environ["JULIA_PKG_PRECOMPILE_AUTO"] = "0"
83
 
84
  julia.install(quiet=quiet)
85
  Main, init_log = init_julia(julia_project, quiet=quiet, return_aux=True)
86
  io_arg = _get_io_arg(quiet)
87
 
88
+ if precompile is None:
89
+ precompile = init_log["compiled_modules"]
 
 
90
 
91
  if not precompile:
92
  Main.eval('ENV["JULIA_PKG_PRECOMPILE_AUTO"] = 0')
 
98
  Main.eval("using Pkg")
99
  Main.eval(f"Pkg.instantiate({io_arg})")
100
 
101
+ if precompile:
 
 
 
102
  Main.eval(f"Pkg.precompile({io_arg})")
103
 
104
  if not quiet: