11from pythonforandroid .toolchain import Recipe , current_directory
22from pythonforandroid .logger import info , debug , shprint , warning
3- from os .path import exists , join
3+ from os .path import join , isdir , isfile
44from os import environ
55import sh
66from colorama import Fore , Style
@@ -13,7 +13,7 @@ class VlcRecipe(Recipe):
1313 depends = []
1414
1515 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'
1717 ENV_LIBVLC_AAR = 'LIBVLC_AAR'
1818 aars = {} # for future use of multiple arch
1919
@@ -22,36 +22,39 @@ def prebuild_arch(self, arch):
2222 build_dir = self .get_build_dir (arch .arch )
2323 port_dir = join (build_dir , 'vlc-port-android' )
2424 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 ))
2930 info ("check {} environment!" .format (self .ENV_LIBVLC_AAR ))
3031 exit (1 )
32+ self .aars [arch ] = aar
3133 else :
3234 aar_path = join (port_dir , 'libvlc' , 'build' , 'outputs' , 'aar' )
3335 self .aars [arch ] = aar = join (aar_path , 'libvlc-{}.aar' .format (self .version ))
3436 warning ("HINT: set path to precompiled libvlc-<ver>.aar bundle " \
3537 "in {} environment!" .format (self .ENV_LIBVLC_AAR ))
3638 info ("libvlc-<ver>.aar should build " \
3739 "from sources at {}" .format (port_dir ))
38- if not exists (join (port_dir , 'compile.sh' )):
40+ if not isfile (join (port_dir , 'compile.sh' )):
3941 info ("clone vlc port for android sources from {}" .format (
4042 self .port_git ))
4143 shprint (sh .git , 'clone' , self .port_git , port_dir ,
4244 _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)
4851
4952 def build_arch (self , arch ):
5053 super (VlcRecipe , self ).build_arch (arch )
5154 build_dir = self .get_build_dir (arch .arch )
5255 port_dir = join (build_dir , 'vlc-port-android' )
5356 aar = self .aars [arch ]
54- if not exists (aar ):
57+ if not isfile (aar ):
5558 with current_directory (port_dir ):
5659 env = dict (environ )
5760 env .update ({
@@ -61,7 +64,7 @@ def build_arch(self, arch):
6164 })
6265 info ("compiling vlc from sources" )
6366 debug ("environment: {}" .format (env ))
64- if not exists (join ('bin' , 'VLC-debug.apk' )):
67+ if not isfile (join ('bin' , 'VLC-debug.apk' )):
6568 shprint (sh .Command ('./compile.sh' ), _env = env ,
6669 _tail = 50 , _critical = True )
6770 shprint (sh .Command ('./compile-libvlc.sh' ), _env = env ,
0 commit comments