1
1
from pythonforandroid .toolchain import Recipe , shprint , current_directory , warning , info , debug
2
- from os .path import exists , join
2
+ from os .path import join , isdir , isfile
3
3
from os import environ
4
4
import sh
5
5
from colorama import Fore , Style
@@ -12,7 +12,7 @@ class VlcRecipe(Recipe):
12
12
depends = []
13
13
14
14
port_git = 'http://git.videolan.org/git/vlc-ports/android.git'
15
- vlc_git = 'http://git.videolan.org/git/vlc.git'
15
+ # vlc_git = 'http://git.videolan.org/git/vlc.git'
16
16
ENV_LIBVLC_AAR = 'LIBVLC_AAR'
17
17
aars = {} # for future use of multiple arch
18
18
@@ -21,36 +21,39 @@ def prebuild_arch(self, arch):
21
21
build_dir = self .get_build_dir (arch .arch )
22
22
port_dir = join (build_dir , 'vlc-port-android' )
23
23
if self .ENV_LIBVLC_AAR in environ :
24
- self .aars [arch ] = aar = environ .get (self .ENV_LIBVLC_AAR )
25
- if not exists (aar ):
26
- warning ("Error: libvlc-<ver>.aar bundle " \
27
- "not found in {}" .format (aar ))
24
+ aar = environ .get (self .ENV_LIBVLC_AAR )
25
+ if isdir (aar ):
26
+ aar = join (aar , 'libvlc-{}.aar' .format (self .version ))
27
+ if not isfile (aar ):
28
+ warning ("Error: {} is not valid libvlc-<ver>.aar bundle" .format (aar ))
28
29
info ("check {} environment!" .format (self .ENV_LIBVLC_AAR ))
29
30
exit (1 )
31
+ self .aars [arch ] = aar
30
32
else :
31
33
aar_path = join (port_dir , 'libvlc' , 'build' , 'outputs' , 'aar' )
32
34
self .aars [arch ] = aar = join (aar_path , 'libvlc-{}.aar' .format (self .version ))
33
35
warning ("HINT: set path to precompiled libvlc-<ver>.aar bundle " \
34
36
"in {} environment!" .format (self .ENV_LIBVLC_AAR ))
35
37
info ("libvlc-<ver>.aar should build " \
36
38
"from sources at {}" .format (port_dir ))
37
- if not exists (join (port_dir , 'compile.sh' )):
39
+ if not isfile (join (port_dir , 'compile.sh' )):
38
40
info ("clone vlc port for android sources from {}" .format (
39
41
self .port_git ))
40
42
shprint (sh .git , 'clone' , self .port_git , port_dir ,
41
43
_tail = 20 , _critical = True )
42
- vlc_dir = join (port_dir , 'vlc' )
43
- if not exists (join (vlc_dir , 'Makefile.am' )):
44
- info ("clone vlc sources from {}" .format (self .vlc_git ))
45
- shprint (sh .git , 'clone' , self .vlc_git , vlc_dir ,
46
- _tail = 20 , _critical = True )
44
+ # now "git clone ..." is a part of compile.sh
45
+ # vlc_dir = join(port_dir, 'vlc')
46
+ # if not isfile(join(vlc_dir, 'Makefile.am')):
47
+ # info("clone vlc sources from {}".format(self.vlc_git))
48
+ # shprint(sh.git, 'clone', self.vlc_git, vlc_dir,
49
+ # _tail=20, _critical=True)
47
50
48
51
def build_arch (self , arch ):
49
52
super (VlcRecipe , self ).build_arch (arch )
50
53
build_dir = self .get_build_dir (arch .arch )
51
54
port_dir = join (build_dir , 'vlc-port-android' )
52
55
aar = self .aars [arch ]
53
- if not exists (aar ):
56
+ if not isfile (aar ):
54
57
with current_directory (port_dir ):
55
58
env = dict (environ )
56
59
env .update ({
@@ -60,7 +63,7 @@ def build_arch(self, arch):
60
63
})
61
64
info ("compiling vlc from sources" )
62
65
debug ("environment: {}" .format (env ))
63
- if not exists (join ('bin' , 'VLC-debug.apk' )):
66
+ if not isfile (join ('bin' , 'VLC-debug.apk' )):
64
67
shprint (sh .Command ('./compile.sh' ), _env = env ,
65
68
_tail = 50 , _critical = True )
66
69
shprint (sh .Command ('./compile-libvlc.sh' ), _env = env ,
0 commit comments