Skip to content

Commit

Permalink
Fix install directory clobbering and setup.py positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Livingston committed Jan 30, 2018
1 parent be2583a commit f1ed6da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ def __init__(self,

has_setup_py_in_top_level = False
for source in sources:
raise ValueError(self.address.rel_path)
if source == os.path.join(self.address.rel_path, 'setup.py'):
if source == 'setup.py':
has_setup_py_in_top_level = True

if not has_setup_py_in_top_level:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,13 @@ def _create_dist(self, dist_tgt, dist_target_dir):
src_relative_to_target_base)
shutil.copyfile(abs_src_path, src_rel_to_results_dir)
# Build a whl using SetupPyRunner and return its absolute path.
install_dir = os.path.join(dist_target_dir, '.dist')
safe_mkdir(install_dir)
setup_runner = SetupPyRunner(dist_target_dir, 'bdist_wheel', interpreter=interpreter, install_dir=install_dir)
setup_runner = SetupPyRunner(dist_target_dir, 'bdist_wheel', interpreter=interpreter)
setup_runner.run()
return self._get_whl_from_dir(install_dir)
return self._get_whl_from_dir(os.path.join(dist_target_dir, 'dist'))

def _get_whl_from_dir(self, install_dir):
"""Return the absolute path of the whl in a setup.py install directory."""
dists = glob.glob(os.path.join(install_dir, '*.whl'))
if len(dists) == 0:
raise TaskError('No distributions were produced by python_create_distribution task.')

return dists[0]

0 comments on commit f1ed6da

Please sign in to comment.