aboutsummaryrefslogtreecommitdiffstats
path: root/devscripts/make_issue_template.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-04-27 13:45:45 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-04-27 16:12:36 +0530
commitc1714454313e01c94a7e55e1cb99d439ff933a43 (patch)
tree7b13d33e824eaf837959f434fea1b439f733cea2 /devscripts/make_issue_template.py
parent4f8095235321632ac2785dda2f038bc2aedba4d9 (diff)
downloadhypervideo-pre-c1714454313e01c94a7e55e1cb99d439ff933a43.tar.lz
hypervideo-pre-c1714454313e01c94a7e55e1cb99d439ff933a43.tar.xz
hypervideo-pre-c1714454313e01c94a7e55e1cb99d439ff933a43.zip
[cleanup,build] Cleanup some build-related code
Fixes an issue in 7ab56be2c7309a2d11d4ee28c71f8fb29da21ef7
Diffstat (limited to 'devscripts/make_issue_template.py')
-rw-r--r--devscripts/make_issue_template.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/devscripts/make_issue_template.py b/devscripts/make_issue_template.py
index 878b94166..811a3e9b5 100644
--- a/devscripts/make_issue_template.py
+++ b/devscripts/make_issue_template.py
@@ -3,6 +3,17 @@ import io
import optparse
+def read(fname):
+ with open(fname, encoding='utf-8') as f:
+ return f.read()
+
+
+# Get the version from yt_dlp/version.py without importing the package
+def read_version(fname):
+ exec(compile(read(fname), fname, 'exec'))
+ return locals()['__version__']
+
+
def main():
parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
options, args = parser.parse_args()
@@ -10,18 +21,9 @@ def main():
parser.error('Expected an input and an output filename')
infile, outfile = args
-
- with open(infile, encoding='utf-8') as inf:
- issue_template_tmpl = inf.read()
-
- # Get the version from yt_dlp/version.py without importing the package
- exec(compile(open('yt_dlp/version.py').read(),
- 'yt_dlp/version.py', 'exec'))
-
- out = issue_template_tmpl % {'version': locals()['__version__']}
-
with open(outfile, 'w', encoding='utf-8') as outf:
- outf.write(out)
+ outf.write(
+ read(infile) % {'version': read_version('yt_dlp/version.py')})
if __name__ == '__main__':