mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-24 04:32:46 +00:00
Raise error if there are two spec files
This commit is contained in:
parent
f84a0c5a11
commit
f4d77b6248
1 changed files with 10 additions and 4 deletions
|
@ -154,17 +154,23 @@ def create_builder(package_name, build_tag, build_version,
|
|||
|
||||
def find_spec_file(in_dir=None):
|
||||
"""
|
||||
Find the first spec file in the current directory. (hopefully there's
|
||||
only one)
|
||||
Find the first spec file in the current directory.
|
||||
|
||||
Returns only the file name, rather than the full path.
|
||||
"""
|
||||
if in_dir == None:
|
||||
in_dir = os.getcwd()
|
||||
spec_file_name = None
|
||||
for f in os.listdir(in_dir):
|
||||
if f.endswith(".spec"):
|
||||
return f
|
||||
error_out(["Unable to locate a spec file in %s" % in_dir])
|
||||
if spec_file_name is not None:
|
||||
error_out("At least two spec files in directory: %s and %s" % [spec_file_name, f])
|
||||
spec_file_name = f
|
||||
debug("Using spec file: %s" % f)
|
||||
if spec_file_name is None:
|
||||
error_out(["Unable to locate a spec file in %s" % in_dir])
|
||||
else:
|
||||
return spec_file_name
|
||||
|
||||
|
||||
def find_gemspec_file(in_dir=None):
|
||||
|
|
Loading…
Add table
Reference in a new issue