mirror of https://github.com/mpv-player/mpv
ci/lint: check for pep8 naming convention
This commit is contained in:
parent
1562895af7
commit
416035a174
|
@ -216,7 +216,7 @@ def process_swift_libraries(binary):
|
||||||
def process_vulkan_loader(binary, loader_name, loader_relative_folder, library_node):
|
def process_vulkan_loader(binary, loader_name, loader_relative_folder, library_node):
|
||||||
# https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderDriverInterface.md#example-macos-driver-search-path
|
# https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderDriverInterface.md#example-macos-driver-search-path
|
||||||
# https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderLayerInterface.md#macos-layer-discovery
|
# https://github.com/KhronosGroup/Vulkan-Loader/blob/main/docs/LoaderLayerInterface.md#macos-layer-discovery
|
||||||
loaderSystemSearchFolders = [
|
loader_system_search_folders = [
|
||||||
os.path.join(os.path.expanduser("~"), ".config", loader_relative_folder),
|
os.path.join(os.path.expanduser("~"), ".config", loader_relative_folder),
|
||||||
os.path.join("/etc/xdg", loader_relative_folder),
|
os.path.join("/etc/xdg", loader_relative_folder),
|
||||||
os.path.join("/usr/local/etc", loader_relative_folder),
|
os.path.join("/usr/local/etc", loader_relative_folder),
|
||||||
|
@ -227,50 +227,52 @@ def process_vulkan_loader(binary, loader_name, loader_relative_folder, library_n
|
||||||
os.path.join(get_homebrew_prefix(), "share", loader_relative_folder),
|
os.path.join(get_homebrew_prefix(), "share", loader_relative_folder),
|
||||||
]
|
]
|
||||||
|
|
||||||
loaderSystemFolder = ""
|
loader_system_folder = ""
|
||||||
for loaderSystemSearchFolder in loaderSystemSearchFolders:
|
for loader_system_search_folder in loader_system_search_folders:
|
||||||
if os.path.exists(loaderSystemSearchFolder):
|
if os.path.exists(loader_system_search_folder):
|
||||||
loaderSystemFolder = loaderSystemSearchFolder
|
loader_system_folder = loader_system_search_folder
|
||||||
break
|
break
|
||||||
|
|
||||||
if not loaderSystemFolder:
|
if not loader_system_folder:
|
||||||
print(">>> could not find loader folder " + loader_relative_folder)
|
print(">>> could not find loader folder " + loader_relative_folder)
|
||||||
return
|
return
|
||||||
|
|
||||||
loaderBundleFolder = os.path.join(resources_path(binary), loader_relative_folder)
|
loader_bundle_folder = os.path.join(resources_path(binary), loader_relative_folder)
|
||||||
loaderSystemPath = os.path.join(loaderSystemFolder, loader_name)
|
loader_system_path = os.path.join(loader_system_folder, loader_name)
|
||||||
loaderBundlePath = os.path.join(loaderBundleFolder, loader_name)
|
loader_bundle_path = os.path.join(loader_bundle_folder, loader_name)
|
||||||
libraryRelativeFolder = "../../../Frameworks/"
|
library_relative_folder = "../../../Frameworks/"
|
||||||
|
|
||||||
if not os.path.exists(loaderSystemPath):
|
if not os.path.exists(loader_system_path):
|
||||||
print(">>> could not find loader " + loader_name)
|
print(">>> could not find loader " + loader_name)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not os.path.exists(loaderBundleFolder):
|
if not os.path.exists(loader_bundle_folder):
|
||||||
os.makedirs(loaderBundleFolder)
|
os.makedirs(loader_bundle_folder)
|
||||||
|
|
||||||
loaderSystemFile = open(loaderSystemPath)
|
loader_system_file = open(loader_system_path)
|
||||||
loaderJsonData = json.load(loaderSystemFile)
|
loader_json_data = json.load(loader_system_file)
|
||||||
libraryPath = loaderJsonData[library_node]["library_path"]
|
library_path = loader_json_data[library_node]["library_path"]
|
||||||
librarySystemPath = os.path.join(loaderSystemFolder, libraryPath)
|
library_system_path = os.path.join(loader_system_folder, library_path)
|
||||||
|
|
||||||
if not os.path.exists(librarySystemPath):
|
if not os.path.exists(library_system_path):
|
||||||
print(">>> could not find loader library " + librarySystemPath)
|
print(">>> could not find loader library " + library_system_path)
|
||||||
return
|
return
|
||||||
|
|
||||||
print(">>> modifiying and writing loader json " + loader_name)
|
print(">>> modifiying and writing loader json " + loader_name)
|
||||||
loaderBundleFile = open(loaderBundlePath, "w")
|
loader_bundle_file = open(loader_bundle_path, "w")
|
||||||
loaderLibraryName = os.path.basename(librarySystemPath)
|
loader_library_name = os.path.basename(library_system_path)
|
||||||
library_path = os.path.join(libraryRelativeFolder, loaderLibraryName)
|
library_path = os.path.join(library_relative_folder, loader_library_name)
|
||||||
loaderJsonData[library_node]["library_path"] = library_path
|
loader_json_data[library_node]["library_path"] = library_path
|
||||||
json.dump(loaderJsonData, loaderBundleFile, indent=4)
|
json.dump(loader_json_data, loader_bundle_file, indent=4)
|
||||||
|
|
||||||
print(">>> copying loader library " + loaderLibraryName)
|
print(">>> copying loader library " + loader_library_name)
|
||||||
frameworkBundleFolder = os.path.join(loaderBundleFolder, libraryRelativeFolder)
|
framework_bundle_folder = os.path.join(
|
||||||
if not os.path.exists(frameworkBundleFolder):
|
loader_bundle_folder, library_relative_folder
|
||||||
os.makedirs(frameworkBundleFolder)
|
)
|
||||||
library_target_path = os.path.join(frameworkBundleFolder, loaderLibraryName)
|
if not os.path.exists(framework_bundle_folder):
|
||||||
shutil.copy(librarySystemPath, library_target_path)
|
os.makedirs(framework_bundle_folder)
|
||||||
|
library_target_path = os.path.join(framework_bundle_folder, loader_library_name)
|
||||||
|
shutil.copy(library_system_path, library_target_path)
|
||||||
|
|
||||||
def remove_dev_tools_rapths(binary):
|
def remove_dev_tools_rapths(binary):
|
||||||
for path in get_rpaths_dev_tools(binary):
|
for path in get_rpaths_dev_tools(binary):
|
||||||
|
|
|
@ -249,9 +249,6 @@ elements_matroska = (
|
||||||
def byte2num(s):
|
def byte2num(s):
|
||||||
return int(hexlify(s), 16)
|
return int(hexlify(s), 16)
|
||||||
|
|
||||||
class EOF(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def camelcase_to_words(name):
|
def camelcase_to_words(name):
|
||||||
parts = []
|
parts = []
|
||||||
start = 0
|
start = 0
|
||||||
|
@ -315,7 +312,7 @@ def printf(out, *args):
|
||||||
out.write(" ".join(str(x) for x in args))
|
out.write(" ".join(str(x) for x in args))
|
||||||
out.write("\n")
|
out.write("\n")
|
||||||
|
|
||||||
def generate_C_header(out):
|
def generate_c_header(out):
|
||||||
printf(out, "// Generated by TOOLS/matroska.py, do not edit manually")
|
printf(out, "// Generated by TOOLS/matroska.py, do not edit manually")
|
||||||
printf(out)
|
printf(out)
|
||||||
|
|
||||||
|
@ -348,7 +345,7 @@ def generate_C_header(out):
|
||||||
for el in elementlist))
|
for el in elementlist))
|
||||||
|
|
||||||
|
|
||||||
def generate_C_definitions(out):
|
def generate_c_definitions(out):
|
||||||
printf(out, "// Generated by TOOLS/matroska.py, do not edit manually")
|
printf(out, "// Generated by TOOLS/matroska.py, do not edit manually")
|
||||||
printf(out)
|
printf(out)
|
||||||
for el in reversed(elementlist):
|
for el in reversed(elementlist):
|
||||||
|
@ -367,7 +364,7 @@ def generate_C_definitions(out):
|
||||||
def read(s, length):
|
def read(s, length):
|
||||||
t = s.read(length)
|
t = s.read(length)
|
||||||
if len(t) != length:
|
if len(t) != length:
|
||||||
raise EOF
|
raise EOFError
|
||||||
return t
|
return t
|
||||||
|
|
||||||
def read_id(s):
|
def read_id(s):
|
||||||
|
@ -475,16 +472,16 @@ if __name__ == "__main__":
|
||||||
parse_one(s, 0, None, 1 << 63)
|
parse_one(s, 0, None, 1 << 63)
|
||||||
|
|
||||||
if sys.argv[1] == "--generate-header":
|
if sys.argv[1] == "--generate-header":
|
||||||
generate_C_header(open(sys.argv[2], "w"))
|
generate_c_header(open(sys.argv[2], "w"))
|
||||||
elif sys.argv[1] == "--generate-definitions":
|
elif sys.argv[1] == "--generate-definitions":
|
||||||
generate_C_definitions(open(sys.argv[2], "w"))
|
generate_c_definitions(open(sys.argv[2], "w"))
|
||||||
else:
|
else:
|
||||||
s = open(sys.argv[1], "rb")
|
s = open(sys.argv[1], "rb")
|
||||||
while 1:
|
while 1:
|
||||||
start = s.tell()
|
start = s.tell()
|
||||||
try:
|
try:
|
||||||
parse_toplevel(s)
|
parse_toplevel(s)
|
||||||
except EOF:
|
except EOFError:
|
||||||
if s.tell() != start:
|
if s.tell() != start:
|
||||||
raise Exception("Unexpected end of file")
|
raise Exception("Unexpected end of file")
|
||||||
break
|
break
|
||||||
|
|
|
@ -40,8 +40,8 @@ def apply_plist_template(plist_file, version):
|
||||||
|
|
||||||
def sign_bundle(binary_name):
|
def sign_bundle(binary_name):
|
||||||
sign_directories = ["Contents/Frameworks", "Contents/MacOS"]
|
sign_directories = ["Contents/Frameworks", "Contents/MacOS"]
|
||||||
for dir in sign_directories:
|
for sign_dir in sign_directories:
|
||||||
resolved_dir = os.path.join(bundle_path(binary_name), dir)
|
resolved_dir = os.path.join(bundle_path(binary_name), sign_dir)
|
||||||
for root, _dirs, files in os.walk(resolved_dir):
|
for root, _dirs, files in os.walk(resolved_dir):
|
||||||
for f in files:
|
for f in files:
|
||||||
path = os.path.join(root, f)
|
path = os.path.join(root, f)
|
||||||
|
|
|
@ -81,7 +81,7 @@ colors = [
|
||||||
(0.75, 0, 0.75),
|
(0.75, 0, 0.75),
|
||||||
]
|
]
|
||||||
|
|
||||||
def mkColor(t):
|
def mk_color(t):
|
||||||
return pg.mkColor(int(t[0] * 255), int(t[1] * 255), int(t[2] * 255))
|
return pg.mkColor(int(t[0] * 255), int(t[1] * 255), int(t[2] * 255))
|
||||||
|
|
||||||
SCALE = 1e6 # microseconds to seconds
|
SCALE = 1e6 # microseconds to seconds
|
||||||
|
@ -174,7 +174,7 @@ for e in G.sevents:
|
||||||
if cur not in G.curveno:
|
if cur not in G.curveno:
|
||||||
G.curveno[cur] = 0
|
G.curveno[cur] = 0
|
||||||
args = {"name": e.name,"antialias":True}
|
args = {"name": e.name,"antialias":True}
|
||||||
color = mkColor(colors[G.curveno[cur] % len(colors)])
|
color = mk_color(colors[G.curveno[cur] % len(colors)])
|
||||||
if e.type == "event-signal":
|
if e.type == "event-signal":
|
||||||
args["symbol"] = e.marker
|
args["symbol"] = e.marker
|
||||||
args["symbolBrush"] = pg.mkBrush(color, width=0)
|
args["symbolBrush"] = pg.mkBrush(color, width=0)
|
||||||
|
|
|
@ -5,6 +5,8 @@ line-length = 100
|
||||||
select = [
|
select = [
|
||||||
"F", # pyflakes
|
"F", # pyflakes
|
||||||
"E", "W", # pycodestyle
|
"E", "W", # pycodestyle
|
||||||
|
"N", # pep8-naming
|
||||||
"UP", # pyupgrade
|
"UP", # pyupgrade
|
||||||
|
"A", # flake8-builtins
|
||||||
"Q", # flake8-quotes
|
"Q", # flake8-quotes
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue