[OpenLayers-Commits] r10816 - in trunk/openlayers: build tools
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Mon Oct 11 11:51:30 EDT 2010
Author: tschaub
Date: 2010-10-11 08:51:29 -0700 (Mon, 11 Oct 2010)
New Revision: 10816
Modified:
trunk/openlayers/build/full.cfg
trunk/openlayers/tools/mergejs.py
Log:
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).
Modified: trunk/openlayers/build/full.cfg
===================================================================
--- trunk/openlayers/build/full.cfg 2010-10-09 22:15:20 UTC (rev 10815)
+++ trunk/openlayers/build/full.cfg 2010-10-11 15:51:29 UTC (rev 10816)
@@ -14,19 +14,5 @@
[include]
[exclude]
-Firebug/firebug.js
-Firebug/firebugx.js
-OpenLayers/Lang/ca.js
-OpenLayers/Lang/cs-CZ.js
-OpenLayers/Lang/da-DK.js
-OpenLayers/Lang/de.js
-OpenLayers/Lang/en-CA.js
-OpenLayers/Lang/es.js
-OpenLayers/Lang/fr.js
-OpenLayers/Lang/it.js
-OpenLayers/Lang/nb.js
-OpenLayers/Lang/nl.js
-OpenLayers/Lang/pt-BR.js
-OpenLayers/Lang/sv-SE.js
-OpenLayers/Lang/zh-TW.js
-OpenLayers/Lang/zh-CN.js
+Firebug
+OpenLayers/Lang
Modified: trunk/openlayers/tools/mergejs.py
===================================================================
--- trunk/openlayers/tools/mergejs.py 2010-10-09 22:15:20 UTC (rev 10815)
+++ trunk/openlayers/tools/mergejs.py 2010-10-11 15:51:29 UTC (rev 10816)
@@ -94,6 +94,7 @@
[exclude]
3rd/logger.js
+ exclude/this/dir
All headings are required.
@@ -122,6 +123,20 @@
self.include = lines[lines.index("[include]") + 1:lines.index("[exclude]")]
self.exclude = lines[lines.index("[exclude]") + 1:]
+def undesired(filepath, excludes):
+ # exclude file if listed
+ exclude = filepath in excludes
+ if not exclude:
+ # check if directory is listed
+ for excludepath in excludes:
+ if not excludepath.endswith("/"):
+ excludepath += "/"
+ if filepath.startswith(excludepath):
+ exclude = True
+ break
+ return exclude
+
+
def run (sourceDirectory, outputFilename = None, configFile = None):
cfg = None
if configFile:
@@ -138,7 +153,7 @@
if cfg and cfg.include:
if filepath in cfg.include or filepath in cfg.forceFirst:
allFiles.append(filepath)
- elif (not cfg) or (filepath not in cfg.exclude):
+ elif (not cfg) or (not undesired(filepath, cfg.exclude)):
allFiles.append(filepath)
## Header inserted at the start of each file in the output
More information about the Commits
mailing list