Compare commits
No commits in common. "847353990bf7f65a9ee905401092be2b1f4941ca" and "aca23524522bb853190c8aa82c45a60dfdd80b50" have entirely different histories.
847353990b
...
aca2352452
Binary file not shown.
14
bargo.py
14
bargo.py
|
@ -11,9 +11,6 @@ import create_git_repo as repo
|
||||||
import util.color_io as io
|
import util.color_io as io
|
||||||
|
|
||||||
scripts_dir = "/home/brett/Documents/code/scripts"
|
scripts_dir = "/home/brett/Documents/code/scripts"
|
||||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
|
||||||
if not dir_path.endswith("/"):
|
|
||||||
dir_path += "/"
|
|
||||||
github_url = "https://github.com/Tri11Paragon/"
|
github_url = "https://github.com/Tri11Paragon/"
|
||||||
|
|
||||||
git_ignore = """cmake-build*/
|
git_ignore = """cmake-build*/
|
||||||
|
@ -40,8 +37,8 @@ file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${PROJECT_BUILD_FILES})
|
add_executable(${PROJECT_NAME} ${PROJECT_BUILD_FILES})
|
||||||
|
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Weverything -Wpedantic -Wno-comment)
|
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment)
|
||||||
target_link_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Weverything -Wpedantic -Wno-comment)
|
target_link_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment)
|
||||||
|
|
||||||
${LINKS}
|
${LINKS}
|
||||||
|
|
||||||
|
@ -77,8 +74,8 @@ file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
||||||
|
|
||||||
add_library(${PROJECT_NAME}${CMAKE_LIBRARY_TYPE} ${PROJECT_BUILD_FILES})
|
add_library(${PROJECT_NAME}${CMAKE_LIBRARY_TYPE} ${PROJECT_BUILD_FILES})
|
||||||
|
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Weverything -Wpedantic -Wno-comment)
|
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment)
|
||||||
target_link_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Weverything -Wpedantic -Wno-comment)
|
target_link_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror -Wpedantic -Wno-comment)
|
||||||
|
|
||||||
${LINKS}
|
${LINKS}
|
||||||
|
|
||||||
|
@ -211,11 +208,10 @@ if args.create_git:
|
||||||
desc = ""
|
desc = ""
|
||||||
if isinstance(args.create_git, str):
|
if isinstance(args.create_git, str):
|
||||||
desc = args.create_git
|
desc = args.create_git
|
||||||
open_process(["python3", dir_path + "create_git_repo.py", "-d", desc, project_name])
|
open_process(["create_git_repo", "-d", desc, project_name])
|
||||||
if not github_url.endswith("/"):
|
if not github_url.endswith("/"):
|
||||||
github_url += "/"
|
github_url += "/"
|
||||||
open_process(["git", "remote", "add", "origin", github_url + project_name])
|
open_process(["git", "remote", "add", "origin", github_url + project_name])
|
||||||
open_process(["git", "branch", "--set-upstream-to=origin/main", "main"])
|
|
||||||
|
|
||||||
cmake_text = cmake_text.replace("${SUB_DIRS}", sub_dirs)
|
cmake_text = cmake_text.replace("${SUB_DIRS}", sub_dirs)
|
||||||
cmake_text = cmake_text.replace("${LINKS}", links)
|
cmake_text = cmake_text.replace("${LINKS}", links)
|
||||||
|
|
217
commit.py
217
commit.py
|
@ -1,13 +1,6 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import argparse
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import itertools
|
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
# CONFIG
|
# CONFIG
|
||||||
|
@ -15,95 +8,12 @@ from pathlib import Path
|
||||||
|
|
||||||
VERSION_BEGIN_STR = " VERSION "
|
VERSION_BEGIN_STR = " VERSION "
|
||||||
VERSION_END_STR = ")"
|
VERSION_END_STR = ")"
|
||||||
|
PATCH_LIMIT = 100000
|
||||||
|
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
# DO NOT TOUCH
|
# DO NOT TOUCH
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
|
|
||||||
USER_HOME = Path.home()
|
|
||||||
ENVIRONMENT_DATA_LOCATION = USER_HOME / ".brett_scripts.env"
|
|
||||||
|
|
||||||
if sys.platform.startswith("win"):
|
|
||||||
CONFIG_FILE_LOCATION = os.getenv('APPDATA') + "\BLT\commit_config.env"
|
|
||||||
else:
|
|
||||||
XDG_CONFIG_HOME = Path(os.environ.get('XDG_CONFIG_HOME'))
|
|
||||||
if len(str(XDG_CONFIG_HOME)) == 0:
|
|
||||||
XDG_CONFIG_HOME = USER_HOME
|
|
||||||
CONFIG_FILE_LOCATION = XDG_CONFIG_HOME / "blt" / "commit_config.env"
|
|
||||||
|
|
||||||
class Config:
|
|
||||||
def __init__(self):
|
|
||||||
# Inline with semantic versioning it doesn't make sense to branch / release on minor
|
|
||||||
self.branch_on_major = True
|
|
||||||
self.branch_on_minor = False
|
|
||||||
self.release_on_major = True
|
|
||||||
self.release_on_minor = False
|
|
||||||
self.main_branch = "main"
|
|
||||||
self.patch_limit = -1
|
|
||||||
|
|
||||||
def from_file(file):
|
|
||||||
values = {}
|
|
||||||
with open(file, "rt") as f:
|
|
||||||
for line in f:
|
|
||||||
if line.startswith("export"):
|
|
||||||
content = line.split("=")
|
|
||||||
for idx, c in enumerate(content):
|
|
||||||
content[idx] = c.replace("export", "").strip()
|
|
||||||
values[content[0]] = content[1].replace("\"", "").replace("'", "")
|
|
||||||
config = Config()
|
|
||||||
config.branch_on_major = values["branch_on_major"].lower() == "true"
|
|
||||||
config.release_on_major = values["release_on_major"].lower() == "true"
|
|
||||||
config.main_branch = values["main_branch"]
|
|
||||||
config.patch_limit = int(values["patch_limit"])
|
|
||||||
|
|
||||||
return config;
|
|
||||||
|
|
||||||
def save_to_file(self, file):
|
|
||||||
with open(file, 'w') as f:
|
|
||||||
f.write("export branch_on_major=" + str(self.branch_on_major))
|
|
||||||
f.write("export release_on_major=" + str(self.release_on_major))
|
|
||||||
f.write('export main_branch="' + self.main_branch + '"')
|
|
||||||
f.write("export patch_limit=" + str(self.patch_limit))
|
|
||||||
|
|
||||||
|
|
||||||
class EnvData:
|
|
||||||
def __init__(self, github_username = '', github_token = ''):
|
|
||||||
self.github_token = github_token
|
|
||||||
self.github_username = github_username
|
|
||||||
|
|
||||||
def get_env_from_file(file):
|
|
||||||
f = open(file, "rt")
|
|
||||||
values = {}
|
|
||||||
for line in f:
|
|
||||||
if line.startswith("export"):
|
|
||||||
content = line.split("=")
|
|
||||||
for idx, c in enumerate(content):
|
|
||||||
content[idx] = c.replace("export", "").strip()
|
|
||||||
values[content[0]] = content[1].replace("\"", "").replace("'", "")
|
|
||||||
try:
|
|
||||||
github_token = values["github_token"]
|
|
||||||
except Exception:
|
|
||||||
print("Failed to parse github token!")
|
|
||||||
try:
|
|
||||||
github_username = values["github_username"]
|
|
||||||
except:
|
|
||||||
print("Failed to parse github username! Assuming you are me!")
|
|
||||||
github_username = "Tri11Paragon"
|
|
||||||
return EnvData(github_username=github_username, github_token=github_token)
|
|
||||||
|
|
||||||
def open_process(command, print_out = True):
|
|
||||||
process = subprocess.Popen(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
stdout, stderr = process.communicate()
|
|
||||||
exit_code = process.wait()
|
|
||||||
str_out = stdout.decode('utf8')
|
|
||||||
str_err = stderr.decode('utf8')
|
|
||||||
if print_out and len(str_out) > 0:
|
|
||||||
print(str_out, end='')
|
|
||||||
if print_out and len(str_err) > 0:
|
|
||||||
print(str_err, end='')
|
|
||||||
#print(stdout, stderr, exit_code)
|
|
||||||
return (stdout, stderr, exit_code)
|
|
||||||
|
|
||||||
def load_cmake():
|
def load_cmake():
|
||||||
cmake_file = open("CMakeLists.txt", 'r')
|
cmake_file = open("CMakeLists.txt", 'r')
|
||||||
cmake_text = cmake_file.read()
|
cmake_text = cmake_file.read()
|
||||||
|
@ -128,8 +38,8 @@ def split_version(cmake_text):
|
||||||
def recombine(cmake_text, version_parts, begin, end):
|
def recombine(cmake_text, version_parts, begin, end):
|
||||||
constructed_version = version_parts[0] + '.' + version_parts[1] + '.' + version_parts[2]
|
constructed_version = version_parts[0] + '.' + version_parts[1] + '.' + version_parts[2]
|
||||||
constructed_text_begin = cmake_text[0:begin]
|
constructed_text_begin = cmake_text[0:begin]
|
||||||
constructed_text_end = cmake_text[end::]
|
constrcuted_text_end = cmake_text[end::]
|
||||||
return constructed_text_begin + constructed_version + constructed_text_end
|
return constructed_text_begin + constructed_version + constrcuted_text_end
|
||||||
|
|
||||||
|
|
||||||
def inc_major(cmake_text):
|
def inc_major(cmake_text):
|
||||||
|
@ -145,127 +55,32 @@ def inc_minor(cmake_text):
|
||||||
version_parts[2] = '0'
|
version_parts[2] = '0'
|
||||||
return recombine(cmake_text, version_parts, begin, end)
|
return recombine(cmake_text, version_parts, begin, end)
|
||||||
|
|
||||||
def inc_patch(config: Config, cmake_text):
|
def inc_patch(cmake_text):
|
||||||
version_parts, begin, end = split_version(cmake_text)
|
version_parts, begin, end = split_version(cmake_text)
|
||||||
if config.patch_limit > 0 and int(version_parts[2]) + 1 >= config.patch_limit:
|
if int(version_parts[2]) + 1 >= PATCH_LIMIT:
|
||||||
return inc_minor(cmake_text)
|
return inc_minor(cmake_text)
|
||||||
version_parts[2] = str(int(version_parts[2]) + 1)
|
version_parts[2] = str(int(version_parts[2]) + 1)
|
||||||
return recombine(cmake_text, version_parts, begin, end)
|
return recombine(cmake_text, version_parts, begin, end)
|
||||||
|
|
||||||
def make_branch(config: Config, name):
|
cmake_text = load_cmake()
|
||||||
print(f"Making new branch {name}")
|
cmake_version = get_version(cmake_text)[0]
|
||||||
subprocess.call(["git", "branch", "-b", name])
|
print(f"Current Version: {cmake_version}")
|
||||||
subprocess.call(["git", "checkout", name])
|
|
||||||
subprocess.call(["git", "merge", config.main_branch])
|
|
||||||
subprocess.call(["git", "checkout", config.main_branch])
|
|
||||||
|
|
||||||
def make_release(env: EnvData, name):
|
try:
|
||||||
print(f"Making new release {name}")
|
type = input("What kind of commit is this ((M)ajor, (m)inor, (p)atch)? ")
|
||||||
repos_v = open_process(["git", "remote", "-v"])[0].splitlines()
|
|
||||||
urls = []
|
|
||||||
for line in repos_v:
|
|
||||||
origin = itertools.takewhile(lambda c: not c.isspace(), line)
|
|
||||||
print(f"Origin: {origin}")
|
|
||||||
urls.append(open_process(["git", "remote", "get-url", origin])[0])
|
|
||||||
urls = set(urls)
|
|
||||||
print(urls)
|
|
||||||
data = {
|
|
||||||
'tag_name': name,
|
|
||||||
'name': name,
|
|
||||||
'body': "Automated Release",
|
|
||||||
'draft': False,
|
|
||||||
'prerelease': False
|
|
||||||
}
|
|
||||||
headers = {
|
|
||||||
'Authorization': f'token {env.github_token}',
|
|
||||||
'Accept': 'application/vnd.github.v3+json'
|
|
||||||
}
|
|
||||||
for url in urls:
|
|
||||||
response = requests.post(url, headers=headers, data=json.dumps(data))
|
|
||||||
if response.status_code == 201:
|
|
||||||
print('Release created successfully!')
|
|
||||||
release_data = response.json()
|
|
||||||
print(f"Release URL: {release_data['html_url']}")
|
|
||||||
else:
|
|
||||||
print(f"Failed to create release: {response.status_code}")
|
|
||||||
print(response.json())
|
|
||||||
|
|
||||||
|
if type.startswith('M'):
|
||||||
def main():
|
|
||||||
parser = argparse.ArgumentParser(
|
|
||||||
prog="Commit Helper",
|
|
||||||
description="Help you make pretty commits :3")
|
|
||||||
|
|
||||||
parser.add_argument("action", nargs='?', default=None)
|
|
||||||
parser.add_argument("-p", "--patch", action='store_true', default=False, required=False)
|
|
||||||
parser.add_argument("-m", "--minor", action='store_true', default=False, required=False)
|
|
||||||
parser.add_argument("-M", "--major", action='store_true', default=False, required=False)
|
|
||||||
parser.add_argument('-e', "--env", help="environment file", required=False)
|
|
||||||
parser.add_argument('-c', "--config", help="config file", required=False)
|
|
||||||
parser.add_argument("--create_default_config", action="store_true", default=False, required=False)
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
if args.env is not None:
|
|
||||||
env = EnvData.get_env_from_file(args.e)
|
|
||||||
else:
|
|
||||||
env = EnvData.get_env_from_file(ENVIRONMENT_DATA_LOCATION)
|
|
||||||
|
|
||||||
if args.config is not None:
|
|
||||||
config = Config.from_file(args.config)
|
|
||||||
else:
|
|
||||||
config = Config.from_file(CONFIG_FILE_LOCATION)
|
|
||||||
|
|
||||||
if args.default_create_config:
|
|
||||||
Config.save_to_file(args.config if args.config is not None else CONFIG_FILE_LOCATION)
|
|
||||||
|
|
||||||
cmake_text = load_cmake()
|
|
||||||
cmake_version = get_version(cmake_text)[0]
|
|
||||||
print(f"Current Version: {cmake_version}")
|
|
||||||
|
|
||||||
if not (args.patch or args.minor or args.major):
|
|
||||||
try:
|
|
||||||
if args.action is not None:
|
|
||||||
type = args.action
|
|
||||||
else:
|
|
||||||
type = input("What kind of commit is this ((M)ajor, (m)inor, (p)atch)? ")
|
|
||||||
|
|
||||||
if type.startswith('M'):
|
|
||||||
args.major = True
|
|
||||||
elif type.startswith('m'):
|
|
||||||
args.minor = True
|
|
||||||
elif type.startswith('p') or type.startswith('P') or len(type) == 0:
|
|
||||||
args.patch = True
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print("\nCancelling!")
|
|
||||||
|
|
||||||
if args.major:
|
|
||||||
print("Selected major")
|
print("Selected major")
|
||||||
write_cmake(inc_major(cmake_text))
|
write_cmake(inc_major(cmake_text))
|
||||||
elif args.minor:
|
elif type.startswith('m'):
|
||||||
print("Selected minor")
|
print("Selected minor")
|
||||||
write_cmake(inc_minor(cmake_text))
|
write_cmake(inc_minor(cmake_text))
|
||||||
elif args.patch:
|
elif type.startswith('p') or type.startswith('P') or len(type) == 0:
|
||||||
print("Selected patch")
|
print("Selected patch")
|
||||||
write_cmake(inc_patch(config, cmake_text))
|
write_cmake(inc_patch(cmake_text))
|
||||||
|
|
||||||
|
|
||||||
subprocess.call(["git", "add", "*"])
|
subprocess.call(["git", "add", "*"])
|
||||||
subprocess.call(["git", "commit"])
|
subprocess.call(["git", "commit"])
|
||||||
|
|
||||||
if args.major:
|
|
||||||
version_parts = split_version(cmake_text)[0]
|
|
||||||
if config.branch_on_major:
|
|
||||||
make_branch(config, "v" + str(version_parts[0]))
|
|
||||||
if config.branch_on_minor:
|
|
||||||
make_branch(config, "v" + str(version_parts[0]) + "." + str(version_parts[1]))
|
|
||||||
if config.release_on_major:
|
|
||||||
make_release(env, "v" + str(version_parts[0]))
|
|
||||||
if config.release_on_minor:
|
|
||||||
make_release(env, "v" + str(version_parts[0]) + "." + str(version_parts[1]))
|
|
||||||
|
|
||||||
|
|
||||||
subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"])
|
subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"])
|
||||||
|
except KeyboardInterrupt:
|
||||||
if __name__ == "__main__":
|
print("\nCancelling!")
|
||||||
main()
|
|
||||||
|
|
|
@ -7,50 +7,42 @@ import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
class EnvData:
|
class EnvData:
|
||||||
def __init__(self, github_username = '', gitea_username = '', github_token = '', gitea_token = ''):
|
def __init__(self, github_token = '', gitea_token = ''):
|
||||||
self.github_token = github_token
|
self.github_token = github_token
|
||||||
self.gitea_token = gitea_token
|
self.gitea_token = gitea_token
|
||||||
self.github_username = github_username
|
|
||||||
self.gitea_username = gitea_username
|
|
||||||
|
|
||||||
def get_env_from_file(file):
|
|
||||||
f = open(file, "rt")
|
|
||||||
values = {}
|
|
||||||
for line in f:
|
|
||||||
if line.startswith("export"):
|
|
||||||
content = line.split("=")
|
|
||||||
for idx, c in enumerate(content):
|
|
||||||
content[idx] = c.replace("export", "").strip()
|
|
||||||
values[content[0]] = content[1].replace("\"", "").replace("'", "")
|
|
||||||
try:
|
|
||||||
github_token = values["github_token"]
|
|
||||||
except Exception:
|
|
||||||
print("Failed to parse github token!")
|
|
||||||
try:
|
|
||||||
gitea_token = values["gitea_token"]
|
|
||||||
except:
|
|
||||||
print("Failed to parse gitea token!")
|
|
||||||
try:
|
|
||||||
github_username = values["github_username"]
|
|
||||||
except:
|
|
||||||
print("Failed to parse github username! Assuming you are me!")
|
|
||||||
github_username = "Tri11Paragon"
|
|
||||||
try:
|
|
||||||
gitea_username = values["gitea_username"]
|
|
||||||
except:
|
|
||||||
print("Failed to parse gitea username! Assuming github username")
|
|
||||||
gitea_username = github_username
|
|
||||||
return EnvData(github_username=github_username, gitea_username=gitea_username, github_token=github_token, gitea_token=gitea_token)
|
|
||||||
|
|
||||||
class RepoData:
|
class RepoData:
|
||||||
def __init__(self, repo_name, description, env: EnvData, gitea_url = "https://git.tpgc.me"):
|
def __init__(self, repo_name, description, env: EnvData, github_username = "tri11paragon", gitea_username = "tri11paragon", gitea_url = "https://git.tpgc.me"):
|
||||||
self.repo_name = repo_name
|
self.repo_name = repo_name
|
||||||
self.description = description
|
self.description = description
|
||||||
self.env = env
|
self.env = env
|
||||||
|
self.github_username = github_username
|
||||||
|
self.gitea_username = gitea_username
|
||||||
self.gitea_url = gitea_url
|
self.gitea_url = gitea_url
|
||||||
|
|
||||||
|
def get_env_from_file(file):
|
||||||
|
github_token = ''
|
||||||
|
gitea_token = ''
|
||||||
|
f = open(file, "rt")
|
||||||
|
values = {}
|
||||||
|
for line in f:
|
||||||
|
if line.startswith("export"):
|
||||||
|
content = line.split("=")
|
||||||
|
for idx, c in enumerate(content):
|
||||||
|
content[idx] = c.replace("export", "").strip()
|
||||||
|
values[content[0]] = content[1].replace("\"", "").replace("'", "")
|
||||||
|
try:
|
||||||
|
github_token = values["github_token"]
|
||||||
|
except Exception:
|
||||||
|
print("Failed to parse github token")
|
||||||
|
try:
|
||||||
|
gitea_token = values["gitea_token"]
|
||||||
|
except:
|
||||||
|
print("Failed to parse gitea token!")
|
||||||
|
return EnvData(github_token=github_token, gitea_token=gitea_token)
|
||||||
|
|
||||||
def get_env_from_os():
|
def get_env_from_os():
|
||||||
return EnvData(github_username=os.environ["github_username"], gitea_username=os.environ["gitea_username"], github_token=os.environ["github_token"], gitea_token=os.environ["gitea_token"])
|
return EnvData(github_token=os.environ["github_token"], gitea_token=os.environ["gitea_token"])
|
||||||
|
|
||||||
def create_repo(data: RepoData):
|
def create_repo(data: RepoData):
|
||||||
# GitHub API endpoint for creating a repository
|
# GitHub API endpoint for creating a repository
|
||||||
|
@ -78,8 +70,8 @@ def create_repo(data: RepoData):
|
||||||
gitea_url = f'{data.gitea_url}/api/v1/repos/migrate'
|
gitea_url = f'{data.gitea_url}/api/v1/repos/migrate'
|
||||||
gitea_payload = {
|
gitea_payload = {
|
||||||
'auth_token': data.env.github_token,
|
'auth_token': data.env.github_token,
|
||||||
'auth_username': data.env.github_username,
|
'auth_username': data.github_username,
|
||||||
'clone_addr': f'https://github.com/{data.env.github_username}/{data.repo_name}.git',
|
'clone_addr': f'https://github.com/{data.github_username}/{data.repo_name}.git',
|
||||||
'description': data.description,
|
'description': data.description,
|
||||||
"issues": True,
|
"issues": True,
|
||||||
"labels": True,
|
"labels": True,
|
||||||
|
@ -91,7 +83,7 @@ def create_repo(data: RepoData):
|
||||||
"service": "github",
|
"service": "github",
|
||||||
"wiki": True,
|
"wiki": True,
|
||||||
'repo_name': data.repo_name,
|
'repo_name': data.repo_name,
|
||||||
'repo_owner': data.env.gitea_username,
|
'repo_owner': data.gitea_username,
|
||||||
'private': False # Set to True if you want a private repository
|
'private': False # Set to True if you want a private repository
|
||||||
}
|
}
|
||||||
gitea_headers = {
|
gitea_headers = {
|
||||||
|
@ -121,8 +113,9 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
env = EnvData('', '')
|
||||||
if (args.e is not None) and not (args.e == 'env'):
|
if (args.e is not None) and not (args.e == 'env'):
|
||||||
env = EnvData.get_env_from_file(args.e)
|
env = get_env_from_file(args.e)
|
||||||
else:
|
else:
|
||||||
env = get_env_from_os()
|
env = get_env_from_os()
|
||||||
|
|
||||||
|
|
10
default.nix
10
default.nix
|
@ -1,10 +0,0 @@
|
||||||
let
|
|
||||||
pkgs = import <nixpkgs> {};
|
|
||||||
in pkgs.mkShell {
|
|
||||||
packages = [
|
|
||||||
pkgs.git
|
|
||||||
(pkgs.python3.withPackages (python-pkgs: [
|
|
||||||
python-pkgs.requests
|
|
||||||
]))
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
{ lib, buildPythonPackage, fetchFromGitHub, requests, bs4, withAlias ? false, update-python-libraries}:
|
|
||||||
|
|
||||||
buildPythonPackage rec {
|
|
||||||
pname = "blt-utils";
|
|
||||||
# The websites yt-dlp deals with are a very moving target. That means that
|
|
||||||
# downloads break constantly. Because of that, updates should always be backported
|
|
||||||
# to the latest stable release.
|
|
||||||
version = "2024.09.12";
|
|
||||||
pyproject = true;
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "Tri11Paragon";
|
|
||||||
repo = "Scripts";
|
|
||||||
rev = "aca23524522bb853190c8aa82c45a60dfdd80b50";
|
|
||||||
hash = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
build-system = [];
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
requests
|
|
||||||
bs4
|
|
||||||
];
|
|
||||||
|
|
||||||
pythonRelaxDeps = [ "requests" ];
|
|
||||||
|
|
||||||
postInstall = lib.optionalString withAlias ''
|
|
||||||
ln -s "$out/commit.py" "$out/bin/commit.py"
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru.updateScript = [ update-python-libraries (toString ./.) ];
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
homepage = "https://github.com/yt-dlp/yt-dlp/";
|
|
||||||
description = "Command-line tool to download videos from YouTube.com and other sites (youtube-dl fork)";
|
|
||||||
longDescription = ''
|
|
||||||
yt-dlp is a youtube-dl fork based on the now inactive youtube-dlc.
|
|
||||||
|
|
||||||
youtube-dl is a small, Python-based command-line program
|
|
||||||
to download videos from YouTube.com and a few more sites.
|
|
||||||
youtube-dl is released to the public domain, which means
|
|
||||||
you can modify it, redistribute it or use it however you like.
|
|
||||||
'';
|
|
||||||
changelog = "https://github.com/yt-dlp/yt-dlp/releases/tag/${version}";
|
|
||||||
license = licenses.unlicense;
|
|
||||||
maintainers = with maintainers; [ mkg20001 SuperSandro2000 ];
|
|
||||||
mainProgram = "yt-dlp";
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Reference in New Issue