dbrtools/dbr/installpatch.py
changeset 178 eab8a264a833
equal deleted inserted replaced
176:6d3c3db11e72 178:eab8a264a833
       
     1 # Copyright (c) 2009 Symbian Foundation Ltd
       
     2 # This component and the accompanying materials are made available
       
     3 # under the terms of the License "Eclipse Public License v1.0"
       
     4 # which accompanies this distribution, and is available
       
     5 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     6 #
       
     7 # Initial Contributors:
       
     8 # Symbian Foundation Ltd - initial contribution.
       
     9 #
       
    10 # Contributors:
       
    11 # mattd <mattd@symbian.org>
       
    12 #
       
    13 # Description:
       
    14 # DBR installpatch - installs a patch in the current environment
       
    15 
       
    16 import sys
       
    17 import os.path
       
    18 #import shutils
       
    19 import dbrutils
       
    20 
       
    21 
       
    22 
       
    23 def run(args):
       
    24   if(len(args)):
       
    25     patch = args[0]
       
    26     if(patch):
       
    27       if(os.path.exists(patch)):
       
    28         patchname = os.path.basename(patch)
       
    29         if(not os.path.exists(os.path.join(dbrutils.patchpath(),patchname))):
       
    30           shutils.copyfile(patch, os.path.join(dbrutils.patchpath(),patchname))
       
    31         files = set();
       
    32         files.add('*')
       
    33         dbrutils.extractfromzip(files,os.path.join(dbrutils.patchpath(),patchname))
       
    34         print 'Should probably run checkenv now...'
       
    35       else:
       
    36         print 'Cannot find patch zip: %s\n' %patch
       
    37         help()
       
    38     else:
       
    39         help()
       
    40   else:
       
    41    help()
       
    42       
       
    43 def help():
       
    44   print 'usage: Createpatch <patchname>'