5 from subprocess
import check_call
7 from helpers
import GitWrapper
, run_command
12 # Currently only ffmpeg-mt is supported. When upgrading from
13 # previous versions force it enabled.
14 switch_to_mt
= not path
.exists('ffmpeg-mt-enabled')
16 open('ffmpeg-mt-enabled', 'w').close()
17 if path
.exists('ffmpeg-mt-disabled'):
18 os
.remove('ffmpeg-mt-disabled')
19 # Allow setups where both ffmpeg and ffmpeg-mt are checked out
20 # simultaneously, and leave the directories alone in that case.
21 if path
.exists('ffmpeg/.git') and not path
.exists('ffmpeg-mt/.git'):
22 # fmpeg-mt should be an empty directory if things are right
24 os
.rename('ffmpeg', 'ffmpeg-mt')
26 # libswscale has changed from a submodule to a normal subdirectory
27 if path
.exists('ffmpeg-mt/libswscale/.git'):
28 os
.system('cd ffmpeg-mt && rm -rf libswscale')
30 config
= git
.get_config()
31 submodules
= git
.get_submodules()
32 # Update existing submodules, but don't check out new ones
34 if not 'submodule.%s.url' % p
in config
:
36 if not path
.exists(path
.join(p
, '.git')):
38 check_call('git submodule update'.split() + [p
])
40 check_call('git submodule update --init'.split())
41 git
.foreach_submodule(cmd
)
45 print "Currently only ffmpeg-mt version is maintained."
46 print "This repository has been automatically switched from ffmpeg to ffmpeg-mt."
47 print "This should work OK on single-core machines too."
48 print "You should run ./clean before recompiling due to the switch."