Permalink
Browse files

inital commit

  • Loading branch information...
0 parents commit c8116aee1aa206f102f3e8e060d780b76fa49d41 @elbryan committed Feb 19, 2010
Showing with 92 additions and 0 deletions.
  1. +1 −0 AUTHORS
  2. +91 −0 unmaskit
@@ -0,0 +1 @@
+Fabiano Francesconi < fabiano 'dot' francesconi 'at' gmail 'dot' com >
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# This file is part of pyhtml2bbcode
+
+# Copyright (c) 2009-2010 - Fabiano Francesconi, Walter Da Col
+# encomiabile.it (c) 2009-2010 - www.encomiabile.it
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+__version__ = '0.0.1'
+
+import sys
+import os
+import portage
+from optparse import OptionParser
+
+config = {
+ 'is_source_url' : False,
+ 'config_file' : os.path.expanduser("~/.pyhtml2bbcode.cfg"),
+ 'compiled_file' :os.path.expanduser("~/.pyhtml2bbcode.srl"),
+ 'source_file' : None,
+ 'destination_file' : None,
+ 'verbose' : False,
+}
+
+def main():
+ usage = "usage: %prog [options] package"
+ version = "%%prog %s" % __version__
+ parser = OptionParser(
+ usage=usage,
+ version=version,
+ description="unmaskit unmasks dependencies for you")
+
+ # parser options
+ parser.add_option("-n", "--no-version", action="store_true",
+ dest="param_no_version", default=False,
+ help="unmask always the latest version")
+ parser.add_option("-p", "--pretend", action="store_true",
+ dest="param_pretend", default=False,
+ help="print what would be done")
+ parser.add_option("-q", "--quiet", action="store_true",
+ dest="param_quiet", default=False,
+ help="suppress all the output")
+
+ (options, args) = parser.parse_args()
+ config['param_no_version'] = options.param_no_version
+ config['param_pretend'] = options.param_pretend
+ config['param_quiet'] = options.param_quiet
+
+ print "Using repositories: %s %s" % (portage.settings['PORTDIR'], portage.settings['PORTDIR_OVERLAY'])
+
+ os.execve('/bin/sh', ["/bin/sh", '-c', "emerge -pe =nagios-3.2.0"], {})
+
+ # check args and store their values
+ if (len(args)!=2):
+ parser.error("incorrect number of arguments. See -h for usage help.")
+ else:
+ config['source_file'] = args[0]
+ config['destination_file'] = args[1]
+
+ # Read configuration file
+ if config['verbose']:
+ print "Loading configuration file..."
+
+ if not os.path.exists(config['config_file']):
+ print >> warn, "E: Configuration file cannot be found"
+ exit(1)
+
+ #Check if config file has been modified using md5 and return dict
+ cmp_re_dict = get_updated_re(config['config_file'],config['compiled_file'])
+
+ if config['verbose']:
+ print "... %d regexp has been found." % len(cmp_re_dict.values()[0])
+
+ run(cmp_re_dict,config['source_file'],config['destination_file'])
+
+
+if __name__ == '__main__':
+ sys.exit(main())

0 comments on commit c8116ae

Please sign in to comment.