Re: aap calling cvs problem on Windows

Bram Moolenaar <[email protected]> Mon, 23 Feb 2004 22:12:52 +0100
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Joe Cooper wrote:

> I'm using AAP to package and build a bunch of stuff for Windows, and I'm 
> running into a problem with packages that have to be fetched via CVS. 
> My aap is installed into C:\Program Files\aap\Exec.  The first time I 
> tried to checkout via CVS, aap complained about not having CVS and 
> offered to install it.  It installed a working cvs.exe into C:\Program 
> Files\aap\Exec\bin, but on subsequent runs, it gives an error about 
> trying to run "C:\Program".  Obviously, it's not handling a space in the 
> path correctly...I'm still too much of an amateur with Python to know 
> where to look to fix this, so I thought I'd see if anyone had any pointers.

This is an omission in Aap: quotes should be put around the command to
include the space.  Please try the patch below.

> As another data point, I've since tried adding CVS to the path and 
> installing a cvs into my normal path, but aap seems to now be
> configured to look for the cvs.exe in its bin directory rather than
> checking the path.

Aap does try to find "cvs" in $PATH.  But make sure this works in a
newly opened console window.  MS-Windows is quite confusing when it
comes to environment variables (as in: "which environment?").

Index: VersContCvs.py
===================================================================
RCS file: /cvsroot/a-a-p/Exec/VersContCvs.py,v
retrieving revision 1.10
diff -u -r1.10 VersContCvs.py
--- VersContCvs.py	12 Aug 2003 16:41:51 -0000	1.10
+++ VersContCvs.py	23 Feb 2004 19:28:18 -0000
@@ -128,7 +128,7 @@
 
     # TODO: check which of the nodes actually failed
     if logged_system(recdict,
-                   '%s %s tag "%s" %s' % (cvscmd, serverarg, tag, names)) == 0:
+                 '"%s" %s tag "%s" %s' % (cvscmd, serverarg, tag, names)) == 0:
         return []
     return nodelist
 
@@ -140,7 +140,10 @@
     try:
         f = open(fname)
     except StandardError, e:
-        msg_warning(recdict,
+        # Only give this error when the directory exists, when it doesn't it's
+        # probably the first time the files are checked out.
+        if os.path.exists(os.path.join(dir, "CVS")):
+            msg_warning(recdict,
                 (_('Cannot open for obtaining path in module: "%s"')
                                                              % fname) + str(e))
     else:
@@ -185,7 +188,7 @@
             dir_for_path = node.recipe_dir
         else:
             # Try to obtain the path from the CVS/Repository file.
-            if os.path.isdir(node.absname):
+            if os.path.isdir(os.path.join(node.absname, "CVS")):
                 dir_for_path = node.absname
             else:
                 dir_for_path = os.path.dirname(node.absname)
@@ -316,7 +319,7 @@
         did_add_dir = 0
         while 1:
             # TODO: escaping special characters
-            cmd = ('%s %s commit %s "%s"'
+            cmd = ('"%s" %s commit %s "%s"'
                                       % (cvscmd, serverarg, logarg, node_name))
             ok, text = redir_system_int(recdict, cmd)
 
@@ -351,18 +354,18 @@
         try:
             msg_info(recdict,
                    _("File does not appear to exist in repository, adding it"))
-            logged_system(recdict, "%s %s add %s"
+            logged_system(recdict, '"%s" %s add %s'
                                               % (cvscmd, serverarg, node_name))
         except StandardError, e:
             msg_warning(recdict, _('Adding file failed: ') + str(e))
 
 
         # TODO: escaping special characters
-        return logged_system(recdict, '%s %s commit %s "%s"'
+        return logged_system(recdict, '"%s" %s commit %s "%s"'
                                % (cvscmd, serverarg, logarg, node_name)) == 0
 
     # TODO: escaping special characters
-    return logged_system(recdict, '%s %s %s "%s"'
+    return logged_system(recdict, '"%s" %s %s "%s"'
                                  % (cvscmd, serverarg, action, node_name)) == 0
 
 
@@ -379,7 +382,8 @@
         if dirlevels > 0 and not os.path.isdir("CVS"):
             commit_dir(recdict, dirname, serverarg, dirlevels - 1, cvscmd)
 
-        logged_system(recdict, '%s %s add "%s"' % (cvscmd, serverarg, dirname))
+        logged_system(recdict, '"%s" %s add "%s"'
+                                                % (cvscmd, serverarg, dirname))
     except:
         pass
     os.chdir(cwd)

-- 
If evolution theories are correct, humans will soon grow a third
hand for operating the mouse.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click