Skip to content

Commit e9f0e0d

Browse files
committed
allow usage of == to specify version. For example: ./distribute.sh -m "kivy==master"
1 parent 6681363 commit e9f0e0d

File tree

32 files changed

+79
-40
lines changed

32 files changed

+79
-40
lines changed

distribute.sh

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#------------------------------------------------------------------------------
88

99
# Modules
10-
MODULES=$MODULES
10+
MODULES=
1111

1212
# Resolve Python path
1313
PYTHON="$(which python2.7)"
@@ -358,6 +358,26 @@ function in_array() {
358358
}
359359

360360
function run_source_modules() {
361+
# preprocess version modules
362+
needed=($MODULES)
363+
while [ ${#needed[*]} -ne 0 ]; do
364+
365+
# pop module from the needed list
366+
module=${needed[0]}
367+
unset needed[0]
368+
needed=( ${needed[@]} )
369+
370+
# is a version is specified ?
371+
items=( ${module//==/ } )
372+
module=${items[0]}
373+
version=${items[1]}
374+
if [ ! -z "$version" ]; then
375+
info "Specific version detected for $module: $version"
376+
eval "VERSION_$module=$version"
377+
fi
378+
done
379+
380+
361381
needed=($MODULES)
362382
declare -a processed
363383

@@ -374,6 +394,11 @@ function run_source_modules() {
374394
unset needed[0]
375395
needed=( ${needed[@]} )
376396

397+
# split the version if exist
398+
items=( ${module//==/ } )
399+
module=${items[0]}
400+
version=${items[1]}
401+
377402
# check if the module have already been declared
378403
in_array $module "${processed[@]}"
379404
if [ $? -ne 255 ]; then
@@ -393,6 +418,13 @@ function run_source_modules() {
393418
fi
394419
source $RECIPES_PATH/$module/recipe.sh
395420

421+
# if a version has been specified by the user, the md5 will not
422+
# correspond at all. so deactivate it.
423+
if [ ! -z "$version" ]; then
424+
debug "Deactivate MD5 test for $module, due to specific version"
425+
eval "MD5_$module="
426+
fi
427+
396428
# append current module deps to the needed
397429
deps=$(echo \$"{DEPS_$module[@]}")
398430
eval deps=($deps)

docs/source/usage.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ You can include other modules (or "recipes") to compile using `-m`::
1717
./distribute.sh -m "openssl kivy"
1818
./distribute.sh -m "pil ffmpeg kivy"
1919

20+
You can also specify a specific version for each package. Please note that the
21+
compilation might **break** if you don't use the default version. Most recipes
22+
have patch to fixes android issues, and might not apply if you specify a
23+
version. We also recommand to clean build/ before changing version.::
24+
25+
./distribute.sh -m "openssl kivy==master"
2026

2127
The list of available recipes is available at:
2228
https://github.com/kivy/python-for-android/tree/master/recipes

recipes/audiostream/recipe.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
VERSION_audiostream=
4-
URL_audiostream=https://github.com/kivy/audiostream/zipball/master/audiostream.zip
3+
VERSION_audiostream=${VERSION_audiostream:-master}
4+
URL_audiostream=https://github.com/kivy/audiostream/zipball/$VERSION_audiostream/audiostream.zip
55
DEPS_audiostream=(python sdl pyjnius)
66
MD5_audiostream=
77
BUILD_audiostream=$BUILD_PATH/audiostream/audiostream

recipes/cymunk/recipe.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
VERSION_cymunk=
4-
URL_cymunk=http://github.com/tito/cymunk/zipball/master/cymunk.zip
3+
VERSION_cymunk=${VERSION_cymunk:-master}
4+
URL_cymunk=http://github.com/tito/cymunk/zipball/$VERSION_cymunk/cymunk.zip
55
DEPS_cymunk=(python)
66
MD5_cymunk=
77
BUILD_cymunk=$BUILD_PATH/cymunk/$(get_directory $URL_cymunk)

recipes/docutils/recipe.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
VERSION_docutils=
4-
URL_docutils=http://prdownloads.sourceforge.net/docutils/docutils-0.9.1.tar.gz
3+
VERSION_docutils=${VERSION_docutils:-0.9.1}
4+
URL_docutils=http://prdownloads.sourceforge.net/docutils/docutils-$VERSION_docutils.tar.gz
55
DEPS_docutils=(pil)
66
MD5_docutils=
77
BUILD_docutils=$BUILD_PATH/docutils/$(get_directory $URL_docutils)

recipes/ffmpeg/recipe.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Recent change made ffmpeg not compatible with python-for-android yet.
33
# Only h264+aac build are working.
44

5-
VERSION_ffmpeg=
6-
URL_ffmpeg=https://github.com/tito/ffmpeg-android/zipball/master/ffmpeg-android.zip
5+
VERSION_ffmpeg=${VERSION_ffmpeg:-master}
6+
URL_ffmpeg=https://github.com/tito/ffmpeg-android/zipball/$VERSION_ffmpeg/ffmpeg-android.zip
77
DEPS_ffmpeg=(python sdl)
88
MD5_ffmpeg=
99
BUILD_ffmpeg=$BUILD_PATH/ffmpeg/ffmpeg-android

recipes/gevent/recipe.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
VERSION_gevent=0.13.8
3+
VERSION_gevent=${VERSION_gevent:-0.13.8}
44
URL_gevent=https://pypi.python.org/packages/source/g/gevent/gevent-$VERSION_gevent.tar.gz
55
DEPS_gevent=(libevent greenlet)
66
MD5_gevent=ca9dcaa7880762d8ebbc266b11252960

recipes/greenlet/recipe.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
VERSION_greenlet=0.4.1
3+
VERSION_greenlet=${VERSION_greenlet:-0.4.1}
44
URL_greenlet=https://pypi.python.org/packages/source/g/greenlet/greenlet-$VERSION_greenlet.zip
55
https://github.com/downloads/greenlet/greenlet/greenlet-$VERSION_greenlet.tar.gz
66
DEPS_greenlet=(python)

recipes/kivy/recipe.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
VERSION_kivy=
4-
URL_kivy=https://github.com/kivy/kivy/zipball/stable/kivy-stable.zip
3+
VERSION_kivy=${VERSION_kivy:-stable}
4+
URL_kivy=https://github.com/kivy/kivy/zipball/$VERSION_kivy/kivy-$VERSION_kivy.zip
55
DEPS_kivy=(pygame pyjnius android)
66
MD5_kivy=
77
BUILD_kivy=$BUILD_PATH/kivy/$(get_directory $URL_kivy)

recipes/libevent/recipe.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
VERSION_libevent=2.0.21-stable
3+
VERSION_libevent=${VERSION_libevent:-2.0.21-stable}
44
URL_libevent=https://github.com/downloads/libevent/libevent/libevent-$VERSION_libevent.tar.gz
55
DEPS_libevent=(python)
66
MD5_libevent=b2405cc9ebf264aa47ff615d9de527a2

0 commit comments

Comments
 (0)