equal
deleted
inserted
replaced
|
1 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 # All rights reserved. |
|
3 # This component and the accompanying materials are made available |
|
4 # under the terms of "Eclipse Public License v1.0" |
|
5 # which accompanies this distribution, and is available |
|
6 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 # |
|
8 # Initial Contributors: |
|
9 # Nokia Corporation - initial contribution. |
|
10 # |
|
11 # Contributors: |
|
12 # |
|
13 # Description: |
|
14 # Script to filter out components that are not contributed to the foundation for any reason. |
|
15 # |
|
16 |
|
17 import re |
|
18 import glob |
|
19 import sys |
|
20 import os |
|
21 import shutil |
|
22 import stat |
|
23 |
|
24 policyexpression = re.compile(r"^\s*3\s*$") |
|
25 |
|
26 def cleanfolder(folder): |
|
27 os.chdir(folder) |
|
28 here = os.getcwd() |
|
29 if os.path.exists('distribution.policy.s60'): |
|
30 f = open('distribution.policy.s60', 'r') |
|
31 policy = f.read() |
|
32 f.close() |
|
33 if not policyexpression.match(policy): |
|
34 print 'Deleting ' + os.getcwd() + ' due to policy ' + policy |
|
35 for root, dirs, files in os.walk(os.getcwd()): |
|
36 for name in files: |
|
37 os.chmod(os.path.join(root,name), stat.S_IWRITE) |
|
38 os.chdir('\\') |
|
39 shutil.rmtree(here) |
|
40 return |
|
41 for file in glob.glob('*'): |
|
42 os.chdir(here) |
|
43 if os.path.isdir(file): |
|
44 cleanfolder(file) |
|
45 |
|
46 print 'Removing subfolder trees from ' + sys.argv[1] + ' with a distribution.policy.s60 entry other than 3' |
|
47 |
|
48 cleanfolder(sys.argv[1]) |