On Sunday, March 24, 2013 11:41:04 AM UTC-7, Lewis Levin wrote:

> Running Spyder on Windows 7.
> Use the command "explore repository" on context menu in file explorer. 
>  The selected folder is (or contains) a git repository (.git is present).
> Spyder returns:  Unable to find external program.  Please install gitk.
>
> When trying commit, Spyder returns:   .... Please install git.
>
> All of git is installed.  This installation works with Wingware ide, 
> Tortoise, and Bash (mingw).
>
> so, the problem is in making Spyder aware of the location of the various 
> git executables.  I cannot find where to do this.  There is no general 
> "install external tool" available through the ui, nor in the ini file. 
>
> I am not in love with apps that have deep layers of dependencies (many 
> points of failure).  There is some reference to sip under PyQt, which is 
> where the connection to git may need to be made.  But, there is no 
> documentation or Google search results to point to any clues.
>
> Can someone point me to some clues?
>
> Thanks.
>
> (Spyder is pretty nice, btw...)
>


Here is a patch it works

    $ cat spyderlib_utils_programs.patch
    --- spyderlib/utils/programs.orig       Sat Jan  5 06:31:28 2013
    +++ spyderlib/utils/programs.py Mon Mar 25 16:39:09 2013
    @@ -22,6 +22,18 @@
             abspath = osp.join(path, basename)
             if osp.isfile(abspath):
                 return abspath
    +    # check for msysgit
    +    if basename in ['git', 'gitk'] and os.name == 'nt':
    +        if os.environ["PROCESSOR_ARCHITECTURE"] == "AMD64":
    +            abspath = "C:\\Program Files (x86)\\Git"
    +            if osp.isdir(abspath):
    +                return abspath
    +        else:
    +            abspath = abspath = "C:\\Program Files\\Git"
    +            if osp.isdir(abspath):
    +                return abspath
    +
    +


     def find_program(basename):
    @@ -46,6 +58,14 @@
         path = find_program(name)
         if not path:
             raise RuntimeError("Program %s was not found" % name)
    +    if path in ["C:\\Program Files (x86)\\Git", "C:\\Program 
Files\\Git"]:
    +        path = osp.join(path, "bin", "sh.exe")
    +        sh_args = ['--login', '-c']
    +        # git gui or gitk
    +        if args:
    +            args = sh_args + ['git gui']
    +        else:
    +            args = sh_args + ['gitk']
         subprocess.Popen([path]+args, cwd=cwd) 

Basically I check for msysgit and massage the commands to use `sh.exe 
--login -c <command>`

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


--- spyderlib/utils/programs.orig	Sat Jan  5 06:31:28 2013
+++ spyderlib/utils/programs.py	Mon Mar 25 16:39:09 2013
@@ -22,6 +22,18 @@
         abspath = osp.join(path, basename)
         if osp.isfile(abspath):
             return abspath
+    # check for msysgit
+    if basename in ['git', 'gitk'] and os.name == 'nt':
+        if os.environ["PROCESSOR_ARCHITECTURE"] == "AMD64":
+            abspath = "C:\\Program Files (x86)\\Git"
+            if osp.isdir(abspath):
+                return abspath
+        else:
+            abspath = abspath = "C:\\Program Files\\Git"
+            if osp.isdir(abspath):
+                return abspath
+        
+
 
 
 def find_program(basename):
@@ -46,6 +58,14 @@
     path = find_program(name)
     if not path:
         raise RuntimeError("Program %s was not found" % name)
+    if path in ["C:\\Program Files (x86)\\Git", "C:\\Program Files\\Git"]:
+        path = osp.join(path, "bin", "sh.exe")
+        sh_args = ['--login', '-c']
+        # git gui or gitk
+        if args:
+            args = sh_args + ['git gui']
+        else:
+            args = sh_args + ['gitk']
     subprocess.Popen([path]+args, cwd=cwd)
 
 

Reply via email to