Created
October 19, 2018 15:16
-
-
Save CJ-Wright/6cd36c4a062661c0f936daae742a3045 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jinja2 | |
from rever.tools import hash_url | |
def render_url(name, version, org=''): | |
if org: | |
a = 'https://github.com/{{ org }}/{{ name }}/releases/download/{{version}}/{{ version }}.tar.gz' | |
else: | |
a = 'https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz' | |
gt = jinja2.Template(a) | |
if org: | |
tt = gt.render(version=version, name=name, org=org) | |
else: | |
tt = gt.render(version=version, name=name) | |
print(hash_url(tt)) | |
def run_pypi(name, version): | |
a = 'https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz' | |
gt = jinja2.Template(a) | |
tt = gt.render(version=version, name=name) | |
wget @(tt) | |
sha256sum * | |
def run_github(name, version, org): | |
a = 'https://github.com/{{ org }}/{{ name }}/archive/v{{ version }}.tar.gz' | |
gt = jinja2.Template(a) | |
tt = gt.render(version=version, name=name, org=org) | |
print(tt) | |
wget @(tt) | |
sha256sum * |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment