Add auto-updating of youtube-dl version in ISSUE_TEMPLATE

This commit is contained in:
Sander van den Oever 2016-03-08 15:01:41 +01:00
parent 60bf14d3e9
commit f8481d79d5
3 changed files with 40 additions and 8 deletions

View File

@ -4,6 +4,9 @@
- [ ] Bug report (encountered problems with youtube-dl)
- [ ] Other, namely ...
**Run `youtube-dl --version` to check whether you have the latest version**
- [ ] I've verified that I'm running the latest version available (2016.03.06)
**Brief description of the problem/request**
*I am having a problem with ... I have tried to do ... and ... I expected that ... would happen, but instead ... happened. Example: I tried to download a file but the site was not supported. Please add support for site xyz. Another example: I encountered a bug when downloading a video from xyz. I have tried to do a and b.*
@ -20,9 +23,3 @@
```
Replace the contents between the backticks (`) with the output of youtube-dl when running with the --verbose or -v flag.
```
**Output of running `youtube-dl --version`**
```
Replace the contents between the backticks (`) with the output of 'youtube-dl --version'.
Make sure you are using the latest version by running 'youtube-dl --update'
```

View File

@ -1,4 +1,4 @@
all: youtube-dl README.md CONTRIBUTING.md README.txt youtube-dl.1 youtube-dl.bash-completion youtube-dl.zsh youtube-dl.fish supportedsites
all: youtube-dl README.md CONTRIBUTING.md issue_template README.txt youtube-dl.1 youtube-dl.bash-completion youtube-dl.zsh youtube-dl.fish supportedsites
clean:
rm -rf youtube-dl.1.temp.md youtube-dl.1 youtube-dl.bash-completion README.txt MANIFEST build/ dist/ .coverage cover/ youtube-dl.tar.gz youtube-dl.zsh youtube-dl.fish *.dump *.part *.info.json *.mp4 *.flv *.mp3 *.avi CONTRIBUTING.md.tmp youtube-dl youtube-dl.exe
@ -67,6 +67,9 @@ README.md: youtube_dl/*.py youtube_dl/*/*.py
CONTRIBUTING.md: README.md
$(PYTHON) devscripts/make_contributing.py README.md CONTRIBUTING.md
issue_template: ISSUE_TEMPLATE.md youtube_dl/version.py
$(PYTHON) devscripts/make_issue_template.py ISSUE_TEMPLATE.md
supportedsites:
$(PYTHON) devscripts/make_supportedsites.py docs/supportedsites.md

View File

@ -0,0 +1,32 @@
#!/usr/bin/env python
from __future__ import unicode_literals
import io
import optparse
import re
def main():
parser = optparse.OptionParser(usage='%prog FILE')
options, args = parser.parse_args()
if len(args) != 1:
parser.error('Expected an filename')
with io.open(args[0], encoding='utf-8') as inf:
issue_template_text = inf.read()
# Get the version from youtube_dl/version.py without importing the package
exec(compile(open('youtube_dl/version.py').read(),
'youtube_dl/version.py', 'exec'))
issue_template_text = re.sub(
r'(?<=available \()(?P<version>[0-9\.]+)(?=\))',
__version__,
issue_template_text
)
with io.open(args[0], 'w', encoding='utf-8') as outf:
outf.write(issue_template_text)
if __name__ == '__main__':
main()