importer.py (13663:9b64aeabf9a5) importer.py (13670:8a98db5a481f)
1# Copyright (c) 2008 The Hewlett-Packard Development Company
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 53 unchanged lines hidden (view full) ---

62 sys.modules[fullname] = mod
63
64 try:
65 mod.__loader__ = self
66 srcfile,abspath,code = self.modules[fullname]
67
68 override = os.environ.get('M5_OVERRIDE_PY_SOURCE', 'false').lower()
69 if override in ('true', 'yes') and os.path.exists(abspath):
1# Copyright (c) 2008 The Hewlett-Packard Development Company
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 53 unchanged lines hidden (view full) ---

62 sys.modules[fullname] = mod
63
64 try:
65 mod.__loader__ = self
66 srcfile,abspath,code = self.modules[fullname]
67
68 override = os.environ.get('M5_OVERRIDE_PY_SOURCE', 'false').lower()
69 if override in ('true', 'yes') and os.path.exists(abspath):
70 src = file(abspath, 'r').read()
70 src = open(abspath, 'r').read()
71 code = compile(src, abspath, 'exec')
72
73 if os.path.basename(srcfile) == '__init__.py':
74 mod.__path__ = fullname.split('.')
75 mod.__package__ = fullname
76 else:
77 mod.__package__ = fullname.rpartition('.')[0]
78 mod.__file__ = srcfile

--- 15 unchanged lines hidden ---
71 code = compile(src, abspath, 'exec')
72
73 if os.path.basename(srcfile) == '__init__.py':
74 mod.__path__ = fullname.split('.')
75 mod.__package__ = fullname
76 else:
77 mod.__package__ = fullname.rpartition('.')[0]
78 mod.__file__ = srcfile

--- 15 unchanged lines hidden ---