Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def from_file(self, file, url=None, no_recipe=False):
if file is not None and os.path.exists(file):
start = os.path.dirname(file)
if url is not None and url.startswith('file://'):
start = url[7:]
with open(file) as f:
for line in f.readlines():
tokens = shlex.split(line, comments=True)
if len(tokens) > 0:
yield self.parse_pkg_build(parse_pkg_build_tokens(tokens), start=start, no_recipe=no_recipe)