linux/debian/bin/patch.apply

51 lines
1.2 KiB
Python

#!/usr/bin/env python
import os, os.path, re, sys
from warnings import warn
from debian_linux.patches import PatchSeries
def main():
options, args = parse_options()
if len(args) > 1:
print "Too much arguments"
return
home = options.home
name = options.featureset or "all"
fp = file(os.path.join(home, "series-%s" % name))
PatchSeries(name, home, fp)()
def parse_options():
from optparse import OptionParser
parser = OptionParser(
usage = "%prog [OPTION]... [TARGET]",
)
parser.add_option(
'-f', '--featureset',
dest = 'featureset',
help = "featureset",
)
parser.add_option(
'-H', '--overwrite-home',
dest = 'home',
help = "overwrite home [no default]",
)
options, args = parser.parse_args()
return options, args
if __name__ == '__main__':
def showwarning(message, category, filename, lineno,
file=sys.stderr, line=''):
file.write("Warning: %s\n" % message)
import warnings
warnings.showwarning = showwarning
try:
main()
except RuntimeError, e:
sys.stderr.write("Error: %s\n" % e)
raise SystemExit, 1