jetbrains: normalize file names

This commit is contained in:
xeals 2021-01-25 15:54:28 +11:00
parent 010665a5c9
commit eae2921ae2
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C

View File

@ -7,6 +7,7 @@ import re
import requests import requests
import subprocess as sp import subprocess as sp
import sys import sys
import unicodedata
import urllib import urllib
from lxml import etree from lxml import etree
@ -35,6 +36,7 @@ def to_slug(name):
slug = name.replace(" ", "-").lstrip(".") slug = name.replace(" ", "-").lstrip(".")
for char in ",/;'\\<>:\"|!@#$%^&*()": for char in ",/;'\\<>:\"|!@#$%^&*()":
slug = slug.replace(char, "") slug = slug.replace(char, "")
slug = unicodedata.normalize("NFD", slug).encode("ascii", "ignore").decode("utf-8")
return slug return slug
@ -195,8 +197,10 @@ def prefetch(plugin, build, url=None):
["nix-prefetch-url", "--name", plugin.filename(), url], capture_output=True, ["nix-prefetch-url", "--name", plugin.filename(), url], capture_output=True,
) )
if not res.stdout: if not res.stdout:
raise IOError(f"nix-prefetch-url {plugin} failed: {res.stderr.decode('utf-8')}") raise IOError(
return res.stdout.decode("utf-8").strip() f"nix-prefetch-url {plugin} failed: {res.stderr.decode('unicode-escape')}"
)
return res.stdout.decode("unicode-escape").strip()
def custom_license(short, full, url, free=False): def custom_license(short, full, url, free=False):