"Fossies" - the Fresh Open Source Software Archive

Member "svnchecker-0.3/checks/Checkout.py" (12 Mar 2008, 1364 Bytes) of package /linux/privat/old/svnchecker-0.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "Checkout.py" see the Fossies "Dox" file reference documentation.

    1 # Copyright 2008 German Aerospace Center (DLR)
    2 #
    3 # Licensed under the Apache License, Version 2.0 (the "License");
    4 # you may not use this file except in compliance with the License.
    5 # You may obtain a copy of the License at
    6 #
    7 #     http://www.apache.org/licenses/LICENSE-2.0
    8 #
    9 # Unless required by applicable law or agreed to in writing, software
   10 # distributed under the License is distributed on an "AS IS" BASIS,
   11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12 # See the License for the specific language governing permissions and
   13 # limitations under the License.
   14 
   15 """ Checkout files from the repository to file system locations. """
   16 
   17 import shutil
   18 
   19 def run(transaction, config):
   20 
   21     entries = config.getArray("Checkout.Entries")
   22     
   23     for entry in entries:
   24 
   25         source = config.getString("Checkout.%s.Source" % entry)
   26         destination = config.getString("Checkout.%s.Destination" % entry)
   27 
   28         if transaction.fileExists(source):
   29             filepath = transaction.getFile(source)
   30         else:
   31             return ("File %r to checkout does not exist in the repository." % source, 1)
   32 
   33         try:
   34             shutil.move(filepath, destination)
   35         except IOError, e:
   36             return ("Failed to checkout file %r to %r: %s" % (source, destination, e), 1)
   37 
   38     return ("", 0)