Merge pull request #13 from YunoHost/clean_comments

[fix] don't take comments into account
This commit is contained in:
M5oul 2017-01-27 21:59:18 +01:00 committed by GitHub
commit dddc15f941

View file

@ -2,6 +2,7 @@
import sys import sys
import os import os
import re
import json import json
@ -58,7 +59,8 @@ def check_file_exist(file_path):
def read_file(file_path): def read_file(file_path):
with open(file_path) as f: with open(file_path) as f:
file = f.read().splitlines() # remove every comments from the file content to avoid false positives
file = re.sub("#.*[^\n]", "", f.read()).splitlines()
return file return file