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