update-maintainer: Consider only valid-looking debian directories

When scanning for debian/ directories to use, only consider ones that
have control and changelog files present.  This should handle cases
where the user may have non-package directories named debian high in
their path.
This commit is contained in:
Bryce Harrington 2020-06-26 10:57:46 -07:00
parent 928da0ec02
commit 8d77c72c33

View File

@ -31,7 +31,8 @@ def find_debian_dir(depth=6):
"""
for path in ['../'*n or './' for n in list(range(0,depth+1))]:
debian_path = '{}debian'.format(path)
if os.path.exists(debian_path):
if os.path.exists(os.path.join(debian_path, 'control')) \
and os.path.exists(os.path.join(debian_path, 'changelog')):
return debian_path
return None