Attached patches ... applied. -- "An organisation that treats its programmers as morons will soon have programmers that are willing and able to act like morons only." -Bjarne Stroustrup
From 2fad9189600fb3d3e6b695152c3512e5f22271a8 Mon Sep 17 00:00:00 2001 From: Steve 'Ashcrow' Milner <stevem@xxxxxxxxxxxx> Date: Sun, 13 Jan 2008 14:06:05 -0500 Subject: [PATCH] Added in func-create-module to make boilerplate module code. spec, setup and version updated as well. --- scripts/func-create-module | 66 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 deletions(-) create mode 100755 scripts/func-create-module diff --git a/scripts/func-create-module b/scripts/func-create-module new file mode 100755 index 0000000..afb4d09 --- /dev/null +++ b/scripts/func-create-module @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# Steve 'Ashcrow' Milner <smilner@xxxxxxxxxx> +# John Eckersberg <jeckersb@xxxxxxxxxx> +# +# This software may be freely redistributed under the terms of the GNU +# general public license. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +TEMPLATE = """\ +from modules import func_module +# Add your imports here +import sub_process + +class %s(func_module.FuncModule): + + # Update these if need be. + version = "0.0.1" + api_version = "0.0.1" + description = "%s" + + def __init__(self): + self.methods = { +%s + } + func_module.FuncModule.__init__(self) + +%s + + +methods = %s() +register_rpc = methods.register_rpc +""" + + +def populate_template(module_name, desc, methods): + """ + Makes the method strings and populates the template. + """ + actual_methods = "" + method_str_dict = "" + for method in methods: + method_str_dict += ' "%s": self.%s,\n' % (method, method) + actual_methods += " def self.%s(self):\n pass\n\n" % method + return TEMPLATE % (module_name, desc, + method_str_dict[:-1], actual_methods[:-2], module_name) + + +if __name__ == '__main__': + module_name = raw_input("Name: ").capitalize() + desc = raw_input("Description: ") + methods = [] + print "\nLeave blank to finish." + while True: + method = raw_input("Method: ") + if method == '': + break + methods.append(method) + # Write it out to a file + file_name = "%s.py" % module_name.lower() + file_obj = open(file_name, "w") + file_obj.write(populate_template(module_name, desc, methods)) + file_obj.close() + print "Your module is ready to be hacked on. Wrote out to %s." % file_name \ No newline at end of file -- 1.5.3.7
From 5d5aba57547471d9b4f9b66cd36e4b3799744c4d Mon Sep 17 00:00:00 2001 From: Steve 'Ashcrow' Milner <stevem@xxxxxxxxxxxx> Date: Sun, 13 Jan 2008 14:08:01 -0500 Subject: [PATCH] Added in func-create-module to make boilerplate module code. spec, setup and version updated as well (oops). --- func.spec | 5 ++++- setup.py | 3 ++- version | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/func.spec b/func.spec index d57dbc9..3963943 100644 --- a/func.spec +++ b/func.spec @@ -54,6 +54,7 @@ rm -fr $RPM_BUILD_ROOT %{_bindir}/certmaster %{_bindir}/certmaster-ca %{_bindir}/func-inventory +%{_bindir}/func-create-module /etc/init.d/funcd /etc/init.d/certmaster %dir %{_sysconfdir}/%{name} @@ -124,6 +125,9 @@ fi %changelog +* Sun Jan 13 2008 Steve 'Ashcrow' Milner <smilner@xxxxxxxxxxx> - 0.0.14-6 +- Added in func-create-module for scripts. + * Tue Dec 18 2007 Adrian Likins <alikins@xxxxxxxxxx> - 0.0.14-5 - add /var/lib/ dirs to spec file @@ -175,4 +179,3 @@ fi * Thu Sep 20 2007 Adrian Likins <alikins@xxxxxxxxxx> - 0.0.11-1 - initial release (this one goes to .11) - diff --git a/setup.py b/setup.py index 5cd0e07..a9a9f9d 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,8 @@ if __name__ == "__main__": scripts = [ "scripts/funcd", "scripts/func", "scripts/certmaster", "scripts/certmaster-ca", - "scripts/func-inventory" + "scripts/func-inventory", + "scripts/func-create-module", ], # package_data = { '' : ['*.*'] }, package_dir = {"%s" % NAME: "%s" % NAME diff --git a/version b/version index 2e0811f..ca7996f 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.14 5 +0.14 6 -- 1.5.3.7
_______________________________________________ Func-list mailing list Func-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/func-list