5 from subprocess import check_call
7 from helpers import GitWrapper, run_command
12 # Update from versions using a submodule name different from "libav"
14 if path.exists('ffmpeg-mt/.git'):
18 switch_to_libav = not path.exists('libav/.git') and p
20 if p == 'ffmpeg-mt' and path.exists('ffmpeg-mt/libswscale/.git'):
21 # Update from old version with libswscale as submodule
22 os.system('cd ffmpeg-mt && rm -rf libswscale')
25 # Rename the build dir mainly to get it cleaned up -
26 # incremental builds probably won't work due to wrong absolute
27 # paths recorded in .d files.
28 os.rename('ffmpeg_build', 'libav_build')
31 if path.exists('ffmpeg_options') and not path.exists('libav_options'):
32 os.rename('ffmpeg_options', 'libav_options')
33 for fname in ('ffmpeg-mt-enabled', 'ffmpeg-mt-disabled'):
34 if path.exists(fname):
36 check_call('git submodule init libav'.split())
38 config = git.get_config()
39 submodules = git.get_submodules()
40 # Update existing submodules, but don't check out new ones
42 if not b'submodule.'+p+b'.url' in config:
44 if not path.exists(path.join(p, b'.git')):
46 check_call('git submodule update'.split() + [p])
48 check_call('git submodule update --init'.split())
49 git.foreach_submodule(cmd)
53 print("The ffmpeg-mt submodule directory has been renamed to libav.")
54 print("The contents of the submodule have already been based on")
55 print("the Libav project for some time (FFmpeg-mt was merged to it).")
56 print("The ffmpeg_options file has been renamed to libav_options.")
57 print("You should run ./clean before recompiling due to the switch.")