From fc7a90321080447a614992010aec2c31193ff9f4 Mon Sep 17 00:00:00 2001
From: Christian Taedcke <hacking@taedcke.com>
Date: Thu, 4 Feb 2016 23:49:02 +0100
Subject: [PATCH 3/8] Convert create_makefile.py to python 3.

---
 regress/modules/create_makefile.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/regress/modules/create_makefile.py b/regress/modules/create_makefile.py
index f58dacb..88cfaaa 100644
--- a/regress/modules/create_makefile.py
+++ b/regress/modules/create_makefile.py
@@ -1,5 +1,5 @@
-#! /usr/bin/env python
-# -*- coding: UTF-8 -*-
+#! /usr/bin/env python3
+# -*- coding: utf-8 -*-
 ###############################################################################
 #
 # simulavr - A simulator for the Atmel AVR family of microcontrollers.
@@ -24,7 +24,7 @@
 # $Id: $
 #
 from optparse import OptionParser
-from ConfigParser import ConfigParser
+from configparser import ConfigParser
 from os.path import exists
 from sys import stderr
 from re import compile
@@ -49,7 +49,7 @@ def readArgs():
   opts.config = ConfigParser()
   try:
     opts.config.read(opts.configfile)
-  except Exception, e:
+  except Exception as e:
     p.error("config file not readable: %s" % str(e))
   if not opts.config.has_section("_rule_") or not opts.config.has_option("_rule_", "rule"):
     p.error("config file wrong: no section '_rule_' or no option 'rule' in it")
@@ -58,7 +58,7 @@ def readArgs():
   if not exists(opts.templatefile): p.error("template file not found")
   try:
     opts.template = open(opts.templatefile, "r").read()
-  except Exception, e:
+  except Exception as e:
     p.error("template file not readable: %s" % str(e))
     
   return opts
@@ -101,12 +101,12 @@ def create_rules(config):
         for p in processors.split():
           d = dict(processor = p)
           d.update(data)
-          rules.append(config.get("_rule_", "rule", False, d))
-          targets.append(config.get(name, "target", False, d))
+          rules.append(config.get("_rule_", "rule", raw=False, vars=d))
+          targets.append(config.get(name, "target", raw=False, vars=d))
       else:
           targets.append(config.get(name, "target"))
-    except Exception, e:
-      print >> stderr, str(e)
+    except Exception as e:
+      print(str(e), file=stderr)
   return dict(rules = "\n".join(rules), targets = " ".join(targets))
   
 if __name__ == "__main__":
-- 
2.24.0

