From c8ff21bd82537ab8d0acfb2b382f55f0996dcf44 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Sun, 30 Dec 2012 20:12:14 +0100 Subject: [PATCH] moved docs and updates generation scripts from gh-pages branch to master --- Makefile | 6 ------ generate-download | 33 --------------------------------- update-copyright | 21 --------------------- update/sign_versions.py | 27 --------------------------- 4 files changed, 87 deletions(-) delete mode 100644 Makefile delete mode 100755 generate-download delete mode 100644 update-copyright delete mode 100755 update/sign_versions.py diff --git a/Makefile b/Makefile deleted file mode 100644 index b5f9dbb66..000000000 --- a/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -update: - python3 ./generate-download - python3 ./update-copyright - -.PHONY: update - diff --git a/generate-download b/generate-download deleted file mode 100755 index f19729f59..000000000 --- a/generate-download +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 -import hashlib -import shutil -import subprocess -import tempfile -import urllib.request - -URL = 'https://github.com/downloads/rg3/youtube-dl/youtube-dl' - -with tempfile.NamedTemporaryFile(suffix='youtube-dl', delete=True) as ytdl_file: - with urllib.request.urlopen(URL) as dl: - shutil.copyfileobj(dl, ytdl_file) - - ytdl_file.seek(0) - data = ytdl_file.read() - - ytdl_file.flush() - version = subprocess.check_output(['python3', ytdl_file.name, '--version']).decode('ascii').strip() - -# Read template page -with open('download.html.in', 'r', encoding='utf-8') as tmplf: - template = tmplf.read() - -md5sum = hashlib.md5(data).hexdigest() -sha1sum = hashlib.sha1(data).hexdigest() -sha256sum = hashlib.sha256(data).hexdigest() -template = template.replace('@PROGRAM_VERSION@', version) -template = template.replace('@PROGRAM_URL@', URL) -template = template.replace('@PROGRAM_MD5SUM@', md5sum) -template = template.replace('@PROGRAM_SHA1SUM@', sha1sum) -template = template.replace('@PROGRAM_SHA256SUM@', sha256sum) -with open('download.html', 'w', encoding='utf-8') as dlf: - dlf.write(template) diff --git a/update-copyright b/update-copyright deleted file mode 100644 index 12c2a9194..000000000 --- a/update-copyright +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 - -from __future__ import with_statement - -import datetime -import glob -import io # For Python 2 compatibilty -import os -import re - -year = str(datetime.datetime.now().year) -for fn in glob.glob('*.html*'): - with io.open(fn, encoding='utf-8') as f: - content = f.read() - newc = re.sub(u'(?PCopyright © 2006-)(?P[0-9]{4})', u'Copyright © 2006-' + year, content) - if content != newc: - tmpFn = fn + '.part' - with io.open(tmpFn, 'wt', encoding='utf-8') as outf: - outf.write(newc) - os.rename(tmpFn, fn) diff --git a/update/sign_versions.py b/update/sign_versions.py deleted file mode 100755 index 072cd1393..000000000 --- a/update/sign_versions.py +++ /dev/null @@ -1,27 +0,0 @@ -#! /usr/bin/env python3 - -import rsa -import json -from binascii import hexlify - -# TODO path discovery -versions_info = json.load(open('versions.json')) -if 'signature' in versions_info: - del versions_info['signature'] - - -print('Enter the PKCS1 private key, followed by a blank line:') -privkey = '' -while True: - try: - line = input() - except EOFError: - break - if line == '': - break - privkey += line + '\n' -privkey = bytes(privkey, 'ascii') -privkey = rsa.PrivateKey.load_pkcs1(privkey) - -signature = hexlify(rsa.pkcs1.sign(json.dumps(versions_info, sort_keys=True).encode('utf-8'), privkey, 'SHA-256')) -print('signature: ' + signature.decode()) \ No newline at end of file