1. Michał Górny
  2. flaggie

Commits

Michał Górny  committed 7fe0a3c

Use package.accept_keywords file if it does exist.

  • Participants
  • Parent commits 0e6129a
  • Branches master

Comments (0)

Files changed (1)

File lib/flaggie/packagefile.py

View file
 	def __init__(self, basedir, dbapi):
 		p = lambda x: os.path.join(basedir, x)
 
-		if os.path.exists(p('package.keywords')) \
-				and os.path.exists(p('package.accept_keywords')):
+		pkfs = [x for x in (p('package.keywords'), p('package.accept_keywords')) \
+				if os.path.exists(x)]
+
+		if len(pkfs) > 1:
 			raise PackageFileConflict('''Both package.accept_keywords and package.keywords files exist. Please
 remove one of them or merge them. Refusing to proceed.''')
+		elif not pkfs:
+			# XXX: use package.accept_keywords by default when appropriate
+			pkfs = (p('package.keywords'),)
 
 		self.files = {
 			'use': PackageFileSet(p('package.use')),
-			'kw': PackageKeywordsFileSet(p('package.keywords'), dbapi),
+			'kw': PackageKeywordsFileSet(p(pkfs[0]), dbapi),
 			'lic': PackageFileSet(p('package.license')),
 			'env': PackageFileSet(p('package.env'))
 		}