1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-30 02:52:10 +00:00
mpv/waftools/generators/sources.py
2014-06-08 20:48:42 +02:00

51 lines
1.5 KiB
Python

from waflib.Build import BuildContext
import os
def __file2string_cmd__(ctx):
return "${{BIN_PERL}} {0}/TOOLS/file2string.pl ${{SRC}} > ${{TGT}}" \
.format(ctx.srcnode.abspath())
def __matroska_cmd__(ctx, argument):
return "${{BIN_PERL}} {0}/TOOLS/matroska.pl {1} ${{SRC}} > ${{TGT}}" \
.format(ctx.srcnode.abspath(), argument)
def __zshcomp_cmd__(ctx, argument):
return "${{BIN_PERL}} {0}/TOOLS/zsh.pl {1} > ${{TGT}}" \
.format(ctx.srcnode.abspath(), argument)
def __file2string__(ctx, **kwargs):
ctx(
rule = __file2string_cmd__(ctx),
before = ("c",),
name = os.path.basename(kwargs['target']),
**kwargs
)
def __matroska_header__(ctx, **kwargs):
ctx(
rule = __matroska_cmd__(ctx, '--generate-header'),
before = ("c",),
name = os.path.basename(kwargs['target']),
**kwargs
)
def __matroska_definitions__(ctx, **kwargs):
ctx(
rule = __matroska_cmd__(ctx, '--generate-definitions'),
before = ("c",),
**kwargs
)
def __zshcomp__(ctx, **kwargs):
ctx(
rule = __zshcomp_cmd__(ctx, './mpv'),
before = ("c",),
name = os.path.basename(kwargs['target']),
**kwargs
)
BuildContext.file2string = __file2string__
BuildContext.matroska_header = __matroska_header__
BuildContext.matroska_definitions = __matroska_definitions__
BuildContext.zshcomp = __zshcomp__