Skip to content

Commit

Permalink
Third time's the charm
Browse files Browse the repository at this point in the history
  • Loading branch information
blast-hardcheese committed Oct 21, 2024
1 parent 6afdc8c commit d093f30
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions pkgs/python-wrapped/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ var ReplitPythonLdLibraryPath string

// Set up environment for legacy nixpkgs
func legacy() {
// Previous wrapper script semantics:
// export LD_LIBRARY_PATH=${python-ld-library-path}
// if [ -n "''${PYTHON_LD_LIBRARY_PATH-}" ]; then
// export LD_LIBRARY_PATH=''${PYTHON_LD_LIBRARY_PATH}:$LD_LIBRARY_PATH
// fi
// if [ -n "''${REPLIT_LD_LIBRARY_PATH-}" ]; then
// export LD_LIBRARY_PATH=''${REPLIT_LD_LIBRARY_PATH}:$LD_LIBRARY_PATH
// fi

// REPLIT_LD_LIBRARY_PATH:PYTHON_LD_LIBRARY_PATH:${python-ld-library-path}

ldLibraryPath := []string{}
for _, key := range []string{
"REPLIT_LD_LIBRARY_PATH",
Expand All @@ -33,9 +44,19 @@ func modern() {
if ldAudit := os.Getenv("REPLIT_LD_AUDIT"); ldAudit != "" {
os.Setenv("LD_AUDIT", ldAudit)
}
if val, ok := os.LookupEnv("REPLIT_LD_LIBRARY_PATH"); ok && val != "" {
os.Setenv("REPLIT_LD_LIBRARY_PATH", strings.Join([]string{ReplitPythonLdLibraryPath, val}, ":"))

// Previous wrapper script semantics:
// export REPLIT_LD_LIBRARY_PATH=${python-ld-library-path}:''${REPLIT_LD_LIBRARY_PATH:-}

// ${python-ld-library-path}:REPLIT_LD_LIBRARY_PATH

replitLdLibraryPath := []string{ReplitPythonLdLibraryPath}

if val, ok := os.LookupEnv("REPLIT_LD_LIBRARY_PATH"); ok {
replitLdLibraryPath = append(replitLdLibraryPath, val)
}

os.Setenv("REPLIT_LD_LIBRARY_PATH", strings.Join(replitLdLibraryPath, ":"))
}

// returns whether a Nix channel works with RTLD loader
Expand Down

0 comments on commit d093f30

Please sign in to comment.