forked from orbit-oss/flask
Added a workaround for samefile. This fixes #600
This commit is contained in:
parent
3c1d7758d5
commit
f8b6033a3b
1 changed files with 4 additions and 1 deletions
|
|
@ -32,9 +32,12 @@ def add_to_path(path):
|
||||||
raise RuntimeError('Tried to add nonexisting path')
|
raise RuntimeError('Tried to add nonexisting path')
|
||||||
|
|
||||||
def _samefile(x, y):
|
def _samefile(x, y):
|
||||||
|
if x == y:
|
||||||
|
return True
|
||||||
try:
|
try:
|
||||||
return os.path.samefile(x, y)
|
return os.path.samefile(x, y)
|
||||||
except (IOError, OSError):
|
except (IOError, OSError, AttributeError):
|
||||||
|
# Windows has no samefile
|
||||||
return False
|
return False
|
||||||
sys.path[:] = [x for x in sys.path if not _samefile(path, x)]
|
sys.path[:] = [x for x in sys.path if not _samefile(path, x)]
|
||||||
sys.path.insert(0, path)
|
sys.path.insert(0, path)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue