Skip to content

Commit cbb1d72

Browse files
committed
Adding support for excluding directories when an includes list is not explicitly provided. For our full.cfg example profile, we can exclude the OpenLayers/Lang and Firebug directories instead of having to explicitly list language files to exclude (see #2871).
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10816 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
1 parent e2f7caa commit cbb1d72

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

build/full.cfg

+2-16
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,5 @@ Rico/Corner.js
1414
[include]
1515

1616
[exclude]
17-
Firebug/firebug.js
18-
Firebug/firebugx.js
19-
OpenLayers/Lang/ca.js
20-
OpenLayers/Lang/cs-CZ.js
21-
OpenLayers/Lang/da-DK.js
22-
OpenLayers/Lang/de.js
23-
OpenLayers/Lang/en-CA.js
24-
OpenLayers/Lang/es.js
25-
OpenLayers/Lang/fr.js
26-
OpenLayers/Lang/it.js
27-
OpenLayers/Lang/nb.js
28-
OpenLayers/Lang/nl.js
29-
OpenLayers/Lang/pt-BR.js
30-
OpenLayers/Lang/sv-SE.js
31-
OpenLayers/Lang/zh-TW.js
32-
OpenLayers/Lang/zh-CN.js
17+
Firebug
18+
OpenLayers/Lang

tools/mergejs.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class Config:
9494
9595
[exclude]
9696
3rd/logger.js
97+
exclude/this/dir
9798
9899
All headings are required.
99100
@@ -122,6 +123,20 @@ def __init__(self, filename):
122123
self.include = lines[lines.index("[include]") + 1:lines.index("[exclude]")]
123124
self.exclude = lines[lines.index("[exclude]") + 1:]
124125

126+
def undesired(filepath, excludes):
127+
# exclude file if listed
128+
exclude = filepath in excludes
129+
if not exclude:
130+
# check if directory is listed
131+
for excludepath in excludes:
132+
if not excludepath.endswith("/"):
133+
excludepath += "/"
134+
if filepath.startswith(excludepath):
135+
exclude = True
136+
break
137+
return exclude
138+
139+
125140
def run (sourceDirectory, outputFilename = None, configFile = None):
126141
cfg = None
127142
if configFile:
@@ -138,7 +153,7 @@ def run (sourceDirectory, outputFilename = None, configFile = None):
138153
if cfg and cfg.include:
139154
if filepath in cfg.include or filepath in cfg.forceFirst:
140155
allFiles.append(filepath)
141-
elif (not cfg) or (filepath not in cfg.exclude):
156+
elif (not cfg) or (not undesired(filepath, cfg.exclude)):
142157
allFiles.append(filepath)
143158

144159
## Header inserted at the start of each file in the output

0 commit comments

Comments
 (0)