[CMF-checkins] CVS: CMF - slurp_release.py:1.2

Tres Seaver tseaver@zope.com
Mon, 10 Mar 2003 14:15:29 -0500


Update of /cvs-repository/CMF
In directory cvs.zope.org:/tmp/cvs-serv8283

Modified Files:
	slurp_release.py 
Log Message:


  - Be resilient to absence of old archives.

  - Fix up usage message.

  - Tolerate "201" response code (newer Zopes seem to emit 201
    for "Object created").


=== CMF/slurp_release.py 1.1 => 1.2 ===
--- CMF/slurp_release.py:1.1	Tue Aug  6 14:09:50 2002
+++ CMF/slurp_release.py	Mon Mar 10 14:15:27 2003
@@ -41,8 +41,15 @@
         zip_command = ( '/usr/bin/zip -r %s.zip %s'
                       % ( self._version_id, self._version_id ) )
 
-        os.remove( '%s.tar.gz' % self._version_id )
-        os.remove( '%s.zip' % self._version_id )
+        try:
+            os.remove( '%s.tar.gz' % self._version_id )
+        except OSError:
+            pass
+
+        try:
+            os.remove( '%s.zip' % self._version_id )
+        except OSError:
+            pass
 
         os.system( tar_command )
         os.system( zip_command )
@@ -92,7 +99,7 @@
         """ How are we used?
         """
         USAGE = """\
-slurp_release [options] release_tag version_id userid password
+slurp_release [options] release_tag version_id
 
 options:
 
@@ -168,7 +175,7 @@
         print 'PUTting file, %s, to URL, %s' % ( filename, URL )
         conn.request( 'PUT', URL, body, self._getAuthHeaders() )
         response = conn.getresponse()
-        if int( response.status ) not in ( 200, 204, 302 ):
+        if int( response.status ) not in ( 200, 201, 204, 302 ):
             raise ValueError, 'Failed: %s (%s)' % ( response.status
                                                   , response.reason )