From c13f6d8b2ce7d70b5df93be9f6c7a64d1595bff5 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 23 Nov 2016 09:51:04 +0100 Subject: [PATCH] scripts: Add script to init bee file for pypi package This script can be used to create a bee file for a python package available from pypi. Howto: * search for the package at https://pypi.python.org/pypi to get the latest version * call the script with the package name and the version number. e.g. : scripts/init-pythonpackage PrettyTable 0.7.2 note: case is not relevant in the package name this will create a new bee file python-PKG-VER-0.be0 * execute the bee file generated from the previous step e.g. : ./python-prettytable-0.7.2-0.be0 --- scripts/init-pythonpackage | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 scripts/init-pythonpackage diff --git a/scripts/init-pythonpackage b/scripts/init-pythonpackage new file mode 100755 index 000000000..6fe15b311 --- /dev/null +++ b/scripts/init-pythonpackage @@ -0,0 +1,51 @@ +#! /usr/bin/perl + +sub USAGE { + <<"__EOF__"; +usage: $0 package version + +eg: $0 pyparsing 2.1.10 + +This only works for pypi ( https://pypi.python.org/pypi ) packages + +__EOF__ +} + +@ARGV==2 or die USAGE; +my ($package,$version)=@ARGV; + +$package=lc $package; + +my $beefile="python-$package.be0"; + +my $c=substr($package,0,1); + +-e $beefile and die "$beefile: exists\n"; + +open my $bee,'>',$beefile or die "$beefile: $!\n"; +print $bee <<"__EOF__"; +#!/bin/env beesh + +# BEE_VERSION python-$package-$version-0 + +# https://pypi.python.org/pypi/$package + +SRCURL[0]="https://files.pythonhosted.org/packages/source/$c/$package/$package-$version.tar.gz" + +BEE_CONFIGURE=none + +build_in_sourcedir + +B=\${S} + +mee_build() { + python setup.py build +} + +mee_install() { + python setup.py install --root=\${D} +} +__EOF__ +close $bee; +system 'chmod','+x',$beefile and exit 1; +warn "created $beefile\n";