Changes to support extensions.
authorSteven Black <redacted>
Tue, 23 Feb 2016 00:20:20 +0000 (19:20 -0500)
committerSteven Black <redacted>
Tue, 23 Feb 2016 00:20:20 +0000 (19:20 -0500)
updateHostsFile.py

index 820ead7f5c21fa003e8555fe8251c25dfd04e872..39e591f2e6b4e9fdf5a9fa1b8c3dbd16b4f2219f 100644 (file)
@@ -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):
git clone https://git.99rst.org/PROJECT