Commits

Michał Górny committed a48720a

Fix transforming actions with incorrect pkgs into global actions.

  • Participants
  • Parent commits 849c4d6

Comments (0)

Files changed (1)

lib/flaggie/cli.py

 	out = []
 	cache = Caches(dbapi)
 	actset = ActionSet(cache = cache)
+	had_pkgs = False
 
 	for i, a in enumerate(args):
 		if not a:
 				act = Action(a)
 			except Action.NotAnAction:
 				if actset:
-					out.append(actset)
+					# Avoid transforming actset with all atoms being
+					# incorrect into global actions.
+					if actset.pkgs or not had_pkgs:
+						out.append(actset)
 					actset = ActionSet(cache = cache)
+				had_pkgs = True
 				try:
 					atom = dep_expand(a, mydb = dbapi, settings = settings)
 				except AmbiguousPackageName as e:
 		except ParserError as e:
 			print('At argv[%d]=\'%s\': %s' % (i + 1, a, e))
 
-	if actset:
+	if actset and (actset.pkgs or not had_pkgs):
 		out.append(actset)
 	return out