summaryrefslogtreecommitdiffstats
path: root/libtoprammer/bitfile.py
diff options
context:
space:
mode:
authorMichael Buesch <m@bues.ch>2012-04-07 00:03:34 +0200
committerMichael Buesch <m@bues.ch>2012-04-07 00:03:34 +0200
commit031078d37a6bc5b21c7ff5b16c972b2deb77a5ba (patch)
tree1e61fb591cb3740653ca06c460c3d2ebd5b84240 /libtoprammer/bitfile.py
parent6c1ebab053c2e5264f561b88403ec03c6b03557d (diff)
downloadtoprammer-031078d37a6bc5b21c7ff5b16c972b2deb77a5ba.tar.xz
toprammer-031078d37a6bc5b21c7ff5b16c972b2deb77a5ba.zip
Rename libtoprammer/bit to libtoprammer/fpga
Signed-off-by: Michael Buesch <m@bues.ch>
Diffstat (limited to 'libtoprammer/bitfile.py')
-rw-r--r--libtoprammer/bitfile.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/libtoprammer/bitfile.py b/libtoprammer/bitfile.py
index b5f6e4b..0745b15 100644
--- a/libtoprammer/bitfile.py
+++ b/libtoprammer/bitfile.py
@@ -70,7 +70,9 @@ class Bitfile:
def parseFile(self, filename):
try:
- data = file(filename, "rb").read()
+ fd = open(filename, "rb")
+ data = fd.read()
+ fd.close()
except (IOError), e:
raise BitfileException("Failed to read \"" + filename + "\": " + e.strerror)
self.filename = filename
@@ -125,7 +127,7 @@ class Bitfile:
def __probeFile(fullpath):
try:
- file(fullpath, "rb")
+ open(fullpath, "rb").close()
except (IOError), e:
return False
return True
@@ -137,12 +139,13 @@ def bitfileFind(filename):
if filename.startswith("/"):
if __probeFile(filename):
return filename
- paths = ( ".", "./libtoprammer/bit", )
+ paths = ( ".", "./libtoprammer/fpga", )
for path in paths:
fullpath = path + "/" + filename
if __probeFile(fullpath):
return fullpath
- fullpath = pkg_resources.resource_filename("libtoprammer", "bit/" + filename)
+ fullpath = pkg_resources.resource_filename("libtoprammer",
+ "fpga/" + filename)
if __probeFile(fullpath):
return fullpath
return None
bues.ch cgit interface