Skip to content

Commit

Permalink
Add rjiang suggestion for counting setup.py files
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Livingston committed Jan 30, 2018
1 parent e2bf445 commit 022b1e7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ def __init__(self,
super(PythonDistribution, self).__init__(address=address, payload=payload, **kwargs)
self.add_labels('python')

sources_basenames = [os.path.basename(source) for source in sources]
if not 'setup.py' in sources_basenames:
count_of_setup_py = [os.path.basename(s) for s in sources].count('setup.py')
if count_of_setup_py == 0:
raise TargetDefinitionException(self,
'A setup.py is required to create a python_dist. '
'You must include a setup.py file in your sources field.')
if len(filter(lambda x: x == 'setup.py', sources_basenames)) > 1:
if count_of_setup_py > 1:
raise TargetDefinitionException(self,
'Multiple setup.py files detected. You can only specify one '
'setup.py in a python_dist target.')
Expand Down

0 comments on commit 022b1e7

Please sign in to comment.