From: Steven Black Date: Tue, 23 Feb 2016 00:20:20 +0000 (-0500) Subject: Changes to support extensions. X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=3dde2e39d20e04b1b8907515c689d0d4c79caaf3;p=stevenblack-hosts.git Changes to support extensions. --- diff --git a/updateHostsFile.py b/updateHostsFile.py index 820ead7f5..39e591f2e 100644 --- a/updateHostsFile.py +++ b/updateHostsFile.py @@ -80,6 +80,7 @@ EXTENSIONS_PATH = os.path.join(BASEDIR_PATH, 'extensions') DATA_FILENAMES = 'hosts' UPDATE_URL_FILENAME = 'update.info' SOURCES = listdir_nohidden(DATA_PATH) +EXTENSIONS = listdir_nohidden(EXTENSIONS_PATH) README_TEMPLATE = os.path.join(BASEDIR_PATH, 'readme_template.md') README_FILE = os.path.join(BASEDIR_PATH, 'readme.md') WHITELIST_FILE = os.path.join(BASEDIR_PATH, 'whitelist') @@ -202,7 +203,8 @@ def matchesExclusions(strippedRule): # Update Logic def updateAllSources(): - for source in SOURCES: + allsources = list(set(SOURCES) | set(EXTENSIONS)) + for source in allsources: updateURL = getUpdateURLFromFile(source) if updateURL is None: continue @@ -240,6 +242,11 @@ def createInitialFile(): #Done in a cross-python way writeData(mergeFile, curFile.read()) + for source in extensions: + curFile = open(os.path.join(EXTENSIONS_PATH, source, DATA_FILENAMES), 'r') + #Done in a cross-python way + writeData(mergeFile, curFile.read()) + return mergeFile def removeDupsAndExcl(mergeFile):