Merge pull request #1307 from funilrys/issue-1166-bis

Fix location issue under windows
This commit is contained in:
Steven Black 2020-06-07 14:22:44 -04:00 committed by GitHub
commit 2565d15719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 10 deletions

View File

@ -1743,9 +1743,7 @@ class TestIsValidDomainFormat(BaseStdout):
self.assertTrue(expected in output)
def test_invalid_domain(self):
expected = (
"Do not include www.domain.com or http(s)://domain.com. Try again."
)
expected = "Do not include www.domain.com or http(s)://domain.com. Try again."
for invalid_domain in [
"www.subdomain.domain",

View File

@ -1089,12 +1089,7 @@ def write_opening_header(final_file, **header_params):
),
)
else:
write_data(
final_file,
"# Title: StevenBlack/hosts\n#\n".format(
", ".join(header_params["extensions"])
),
)
write_data(final_file, "# Title: StevenBlack/hosts\n#\n")
write_data(
final_file,
@ -1210,6 +1205,11 @@ def update_readme_data(readme_file, **readme_updates):
readme_data = json.load(f)
readme_data[extensions_key] = generation_data
for denomination, data in readme_data.copy().items():
if "location" in data and data["location"] and "\\" in data["location"]:
# Windows compatibility: #1166
readme_data[denomination]["location"] = data["location"].replace("\\", "/")
with open(readme_file, "w") as f:
json.dump(readme_data, f)

View File

@ -80,7 +80,10 @@ def main():
source_rows += t.substitute(this_row) + "\n"
with open(
os.path.join(data[key]["location"], README_FILENAME), "wt", encoding="utf-8", newline="\n"
os.path.join(data[key]["location"], README_FILENAME),
"wt",
encoding="utf-8",
newline="\n",
) as out:
for line in open(README_TEMPLATE, encoding="utf-8", newline="\n"):
line = line.replace(