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
This commit is contained in:
+2
-16
@@ -14,19 +14,5 @@ Rico/Corner.js
|
|||||||
[include]
|
[include]
|
||||||
|
|
||||||
[exclude]
|
[exclude]
|
||||||
Firebug/firebug.js
|
Firebug
|
||||||
Firebug/firebugx.js
|
OpenLayers/Lang
|
||||||
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
|
|
||||||
|
|||||||
+16
-1
@@ -94,6 +94,7 @@ class Config:
|
|||||||
|
|
||||||
[exclude]
|
[exclude]
|
||||||
3rd/logger.js
|
3rd/logger.js
|
||||||
|
exclude/this/dir
|
||||||
|
|
||||||
All headings are required.
|
All headings are required.
|
||||||
|
|
||||||
@@ -122,6 +123,20 @@ class Config:
|
|||||||
self.include = lines[lines.index("[include]") + 1:lines.index("[exclude]")]
|
self.include = lines[lines.index("[include]") + 1:lines.index("[exclude]")]
|
||||||
self.exclude = lines[lines.index("[exclude]") + 1:]
|
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):
|
def run (sourceDirectory, outputFilename = None, configFile = None):
|
||||||
cfg = None
|
cfg = None
|
||||||
if configFile:
|
if configFile:
|
||||||
@@ -138,7 +153,7 @@ def run (sourceDirectory, outputFilename = None, configFile = None):
|
|||||||
if cfg and cfg.include:
|
if cfg and cfg.include:
|
||||||
if filepath in cfg.include or filepath in cfg.forceFirst:
|
if filepath in cfg.include or filepath in cfg.forceFirst:
|
||||||
allFiles.append(filepath)
|
allFiles.append(filepath)
|
||||||
elif (not cfg) or (filepath not in cfg.exclude):
|
elif (not cfg) or (not undesired(filepath, cfg.exclude)):
|
||||||
allFiles.append(filepath)
|
allFiles.append(filepath)
|
||||||
|
|
||||||
## Header inserted at the start of each file in the output
|
## Header inserted at the start of each file in the output
|
||||||
|
|||||||
Reference in New Issue
Block a user