mirror of
https://github.com/kennethreitz/bake.git
synced 2026-06-05 23:00:17 +00:00
Improve Bakefile detection logic
If Bakefile is not found, None would be returned as a result of Bakefile.find().
This commit is contained in:
+4
-2
@@ -131,18 +131,20 @@ class Bakefile:
|
||||
|
||||
@classmethod
|
||||
def find(
|
||||
Class, *, filename="Bashfile", root=os.getcwd(), max_depth=4, topdown=False
|
||||
Class, *, filename="Bakefile", root=os.getcwd(), max_depth=4, topdown=False
|
||||
):
|
||||
"""Returns the path of a Pipfile in parent directories."""
|
||||
|
||||
i = 0
|
||||
for c, d, f in utils.walk_up(root):
|
||||
if i > max_depth:
|
||||
raise NoBakefileFound(f"No {filename} found!")
|
||||
break
|
||||
elif filename in f:
|
||||
return Class(path=os.path.join(c, filename))
|
||||
i += 1
|
||||
|
||||
raise NoBakefileFound(f"No {filename} found!")
|
||||
|
||||
@property
|
||||
def source(self):
|
||||
with open(self.path, "r") as f:
|
||||
|
||||
Reference in New Issue
Block a user