1.1 --- a/tools/update_scheduling_modules.py Tue Jan 31 16:18:55 2017 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,80 +0,0 @@
1.4 -#!/usr/bin/env python
1.5 -
1.6 -"""
1.7 -Update the scheduling modules import manifest.
1.8 -
1.9 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk>
1.10 -
1.11 -This program is free software; you can redistribute it and/or modify it under
1.12 -the terms of the GNU General Public License as published by the Free Software
1.13 -Foundation; either version 3 of the License, or (at your option) any later
1.14 -version.
1.15 -
1.16 -This program is distributed in the hope that it will be useful, but WITHOUT
1.17 -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.18 -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.19 -details.
1.20 -
1.21 -You should have received a copy of the GNU General Public License along with
1.22 -this program. If not, see <http://www.gnu.org/licenses/>.
1.23 -"""
1.24 -
1.25 -from glob import glob
1.26 -from os.path import join, split, splitext
1.27 -import imp
1.28 -
1.29 -reserved = ["__init__.py", "common.py", "manifest.py"]
1.30 -
1.31 -# The main program generating a new version of the manifest module.
1.32 -
1.33 -if __name__ == "__main__":
1.34 - _f, dirname, _d = imp.find_module("imiptools/handlers")
1.35 - dirname = join(dirname, "scheduling")
1.36 -
1.37 - # Get all Python files in the scheduling directory, filtering out the
1.38 - # reserved files that do not provide scheduling functions.
1.39 -
1.40 - filenames = []
1.41 - found = glob(join(dirname, "*.py"))
1.42 - found.sort()
1.43 -
1.44 - for filename in found:
1.45 - filename = split(filename)[-1]
1.46 - if filename not in reserved:
1.47 - filenames.append(filename)
1.48 -
1.49 - # Open the manifest module and write code to import and combine the
1.50 - # functions from each module.
1.51 -
1.52 - f = open(join(dirname, "manifest.py"), "w")
1.53 - try:
1.54 - print >>f, """\
1.55 -confirmation_functions = {}
1.56 -locking_functions = {}
1.57 -retraction_functions = {}
1.58 -scheduling_functions = {}
1.59 -unlocking_functions = {}
1.60 -"""
1.61 -
1.62 - for filename in filenames:
1.63 - module = splitext(filename)[0]
1.64 -
1.65 - print >>f, """\
1.66 -from imiptools.handlers.scheduling.%s import (
1.67 - confirmation_functions as c,
1.68 - locking_functions as l,
1.69 - retraction_functions as r,
1.70 - scheduling_functions as s,
1.71 - unlocking_functions as u)
1.72 -
1.73 -confirmation_functions.update(c)
1.74 -locking_functions.update(l)
1.75 -retraction_functions.update(r)
1.76 -scheduling_functions.update(s)
1.77 -unlocking_functions.update(u)
1.78 -""" % module
1.79 -
1.80 - finally:
1.81 - f.close()
1.82 -
1.83 -# vim: tabstop=4 expandtab shiftwidth=4