root/galaxy-central/eggs/sqlalchemy_migrate-0.5.4-py2.6.egg/migrate/versioning/util/importpath.py
リビジョン 3, 496 bytes (コミッタ: kohda, 14 年 前) |
---|
行番号 | |
---|---|
1 | import os |
2 | import sys |
3 | |
4 | def import_path(fullpath): |
5 | """ Import a file with full path specification. Allows one to |
6 | import from anywhere, something __import__ does not do. |
7 | """ |
8 | # http://zephyrfalcon.org/weblog/arch_d7_2002_08_31.html |
9 | path, filename = os.path.split(fullpath) |
10 | filename, ext = os.path.splitext(filename) |
11 | sys.path.append(path) |
12 | module = __import__(filename) |
13 | reload(module) # Might be out of date during tests |
14 | del sys.path[-1] |
15 | return module |
16 |
Note: リポジトリブラウザについてのヘルプは TracBrowser
を参照してください。