Fix the open calls to use a host path.

This commit is contained in:
Chris Johns 2013-05-01 06:29:12 +10:00
parent 2edd4c9f28
commit 84924e4e52
3 changed files with 8 additions and 7 deletions

View File

@ -44,7 +44,7 @@ def _collect(path_, file):
def _grep(file, pattern): def _grep(file, pattern):
rege = re.compile(pattern) rege = re.compile(pattern)
try: try:
f = open(file, 'r') f = open(path.host(file), 'r')
matches = [rege.match(l) != None for l in f.readlines()] matches = [rege.match(l) != None for l in f.readlines()]
f.close() f.close()
except IOError, err: except IOError, err:
@ -92,7 +92,7 @@ class autoreconf:
bsp_specs = _collect(self.cwd, 'bsp_specs') bsp_specs = _collect(self.cwd, 'bsp_specs')
try: try:
acinclude = path.join(self.cwd, 'acinclude.m4') acinclude = path.join(self.cwd, 'acinclude.m4')
b = open(acinclude, 'w') b = open(path.host(acinclude), 'w')
b.write('# RTEMS_CHECK_BSPDIR(RTEMS_BSP_FAMILY) ' + os.linesep) b.write('# RTEMS_CHECK_BSPDIR(RTEMS_BSP_FAMILY) ' + os.linesep)
b.write('AC_DEFUN([RTEMS_CHECK_BSPDIR],' + os.linesep) b.write('AC_DEFUN([RTEMS_CHECK_BSPDIR],' + os.linesep)
b.write('[' + os.linesep) b.write('[' + os.linesep)
@ -121,7 +121,7 @@ class autoreconf:
if _grep(makefile, 'stamp-h\.in'): if _grep(makefile, 'stamp-h\.in'):
stamp_h = path.join(self.cwd, 'stamp-h.in') stamp_h = path.join(self.cwd, 'stamp-h.in')
try: try:
t = open(stamp_h, 'w') t = open(path.host(stamp_h), 'w')
t.write('timestamp') t.write('timestamp')
t.close() t.close()
except IOError, err: except IOError, err:
@ -168,7 +168,7 @@ class ampolish3:
if self.command.exit_code != 0: if self.command.exit_code != 0:
raise error.general('error: ampolish3: %s' % (' '.join(self.command.cmd))) raise error.general('error: ampolish3: %s' % (' '.join(self.command.cmd)))
try: try:
p = open(self.preinstall, 'w') p = open(path.host(self.preinstall), 'w')
for l in self.command.output: for l in self.command.output:
p.write(l) p.write(l)
p.close() p.close()

View File

@ -334,14 +334,15 @@ class macros:
for n in names: for n in names:
if path.exists(n): if path.exists(n):
try: try:
mc = open(n, 'r') mc = open(path.host(n), 'r')
macros = self.parse(mc) macros = self.parse(mc)
mc.close() mc.close()
self.files += [n] self.files += [n]
return return
except IOError, err: except IOError, err:
pass pass
raise error.general('opening macro file: %s' % (path.host(name))) raise error.general('opening macro file: %s' % \
(path.host(self.expand(name))))
def get(self, key): def get(self, key):
if type(key) is not str: if type(key) is not str:

View File

@ -314,7 +314,7 @@ class report:
outfile.close() outfile.close()
if name is not None: if name is not None:
try: try:
o = open(name, "w") o = open(path.host(name), "w")
o.write(self.out) o.write(self.out)
o.close() o.close()
del o del o