mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
PR 2115 - Fix checking when the path does not fully exist.
This commit is contained in:
@@ -261,7 +261,7 @@ class command_line:
|
|||||||
for m in um:
|
for m in um:
|
||||||
self.defaults.load(m)
|
self.defaults.load(m)
|
||||||
# Check the prefix permission
|
# Check the prefix permission
|
||||||
if not self.no_install() and not path.iswritable(self.defaults['_prefix']):
|
if not self.no_install() and not path.ispathwritable(self.defaults['_prefix']):
|
||||||
raise error.general('prefix is not writable: %s' % (path.host(self.defaults['_prefix'])))
|
raise error.general('prefix is not writable: %s' % (path.host(self.defaults['_prefix'])))
|
||||||
|
|
||||||
def command(self):
|
def command(self):
|
||||||
|
@@ -92,6 +92,14 @@ def isabspath(path):
|
|||||||
def iswritable(path):
|
def iswritable(path):
|
||||||
return os.access(host(path), os.W_OK)
|
return os.access(host(path), os.W_OK)
|
||||||
|
|
||||||
|
def ispathwritable(path):
|
||||||
|
path = host(path)
|
||||||
|
while len(path) != 0:
|
||||||
|
if os.path.exists(path):
|
||||||
|
return iswritable(path)
|
||||||
|
path = os.path.dirname(path)
|
||||||
|
return False
|
||||||
|
|
||||||
def mkdir(path):
|
def mkdir(path):
|
||||||
path = host(path)
|
path = host(path)
|
||||||
if exists(path):
|
if exists(path):
|
||||||
|
Reference in New Issue
Block a user