4 from helpers
import run_command
5 from optparse
import OptionParser
7 def write(local_path
, path
, revision
, outdir
):
8 if os
.system("(cd %s && git archive --format=tar --prefix=%s/ %s | (cd %s && tar xf -))" % (local_path
, path
, revision
, outdir
)) != 0:
11 def subrev(revision
, name
):
12 return run_command(("git", "ls-tree", revision
, name
)).split()[2]
14 def export(revision
, outdir
, mt
):
18 open(outdir
+ '/ffmpeg-mt-enabled', 'w').close()
21 open(outdir
+ '/ffmpeg-mt-disabled', 'w').close()
22 if os
.path
.exists('ffmpeg-mt-enabled'):
23 local_ffmpeg
= 'ffmpeg-mt'
25 local_ffmpeg
= 'ffmpeg'
26 mplayer_rev
= subrev(revision
, "mplayer")
27 libass_rev
= subrev(revision
, "libass")
28 ffmpeg_rev
= subrev(revision
, ffmpeg
)
29 os
.chdir(local_ffmpeg
)
30 swscale_rev
= subrev(ffmpeg_rev
, "libswscale")
33 version
= run_command('git describe --match v[0-9]* --always ' +
36 write('.', '.', revision
, outdir
)
37 os
.putenv('PYTHONDONTWRITEBYTECODE', '1')
38 os
.system("cd %s && ./init --init-optionfiles-only" % outdir
)
39 for name
in 'clean disable-mt enable-mt init update'.split():
40 os
.remove(outdir
+ '/' + name
)
41 write('mplayer', "mplayer", mplayer_rev
, outdir
)
42 f
= open(outdir
+ '/mplayer/snapshot_version', 'w')
45 write('libass', "libass", libass_rev
, outdir
)
46 write(local_ffmpeg
, ffmpeg
, ffmpeg_rev
, outdir
)
47 write(local_ffmpeg
+ '/libswscale', ffmpeg
+ '/libswscale', swscale_rev
,
52 usage
= "usage: [options] revision outdir"
53 parser
= OptionParser(usage
=usage
)
54 parser
.add_option('--disable-mt', action
='store_false', dest
="mt",
55 help='use non-mt FFmpeg')
56 parser
.set_defaults(mt
=True)
57 options
, args
= parser
.parse_args()
59 parser
.error("incorrect number of arguments")
60 export(args
[0], args
[1], options
.mt
)