lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: patches for python in gub


From: Jan Nieuwenhuizen
Subject: Re: patches for python in gub
Date: Thu, 17 Jan 2019 21:38:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Werner LEMBERG writes:

>> There's another feature we added in the patches: dynamic/runtime
>> relocation of the install prefix.  You may have to keep that bit.
>
> I seem to be blind since I can't find that feature in the patches.
> Could you please give a link to a relevant spot in the gub patch files
> for, say, python 2.4.5?

I only seem to have 2.4.2 handy here and that has in
patches/python-2.4.2-1.patch..  It may have been fixed upstream too?

@@ -384,13 +407,23 @@ calculate_path(void)
     unsigned long nsexeclength = MAXPATHLEN;
 #endif
 
-       /* If there is no slash in the argv0 path, then we have to
-        * assume python is on the user's $PATH, since there's no
-        * other way to find a directory to start the search from.  If
-        * $PATH isn't exported, you lose.
-        */
-       if (strchr(prog, SEP))
-               strncpy(progpath, prog, MAXPATHLEN);
+    /* If PROG is an absolute name, then we're done.  If PROG is not
+     * an absolute name and contains SEP/ALTSEP, then it must be
+     * reachable from CWD.  Otherwise, python is on the user's $PATH,
+     * since there's no other way to find a directory to start the
+     * search from.  If $PATH isn't exported, you lose.
+     */
+    if (IS_ABSOLUTE(prog))
+       strncpy(progpath, prog, MAXPATHLEN);
+    else if (strchr(prog, SEP)
+#ifdef ALTSEP
+            || strchr(prog, ALTSEP)
+#endif /* ALTSEP */
+            )
+      {
+       getcwd(progpath, MAXPATHLEN);
+       joinpath(progpath, prog);
+      }
 #ifdef __APPLE__
      /* On Mac OS X, if a script uses an interpreter of the form
       * "#!/opt/python2.3/bin/python", the kernel only passes "python"
@@ -406,6 +439,9 @@ calculate_path(void)
        ;
 #endif /* __APPLE__ */
        else if (path) {
+#ifdef __MINGW32__
+               char const *ext = strchr(prog, '.') ? "" : ".exe";
+#endif
                while (1) {
                        char *delim = strchr(path, DELIM);
 
@@ -420,9 +456,11 @@ calculate_path(void)
                                strncpy(progpath, path, MAXPATHLEN);
 
                        joinpath(progpath, prog);
+#ifdef __MINGW32__
+                       strcat(progpath, ext);
+#endif


-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]