mirror of
https://github.com/StevenBlack/hosts.git
synced 2024-07-06 12:32:35 +02:00
Changes to support extensions.
This commit is contained in:
parent
25b299a6ea
commit
3dde2e39d2
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user