Permalink
Browse files

Merge pull request #4611 from rtfd/agj/add-cwd

Add cwd to subprocess calls
  • Loading branch information...
humitos committed Sep 6, 2018
2 parents cbfc791 + c311c58 commit 04901b3d71ce2eb48afeae34d3bc275edfc3376b
@@ -310,7 +310,13 @@ def move(self, **__):
self.target,
'{}.epub'.format(self.project.slug),
)
self.run('mv', '-f', from_file, to_file)
self.run(
'mv',
'-f',
from_file,
to_file,
cwd=self.project.checkout_path(self.version.slug),
)
class LatexBuildCommand(BuildCommand):
@@ -429,4 +435,10 @@ def move(self, **__):
if from_file:
to_file = os.path.join(
self.target, '{}.pdf'.format(self.project.slug))
self.run('mv', '-f', from_file, to_file)
self.run(
'mv',
'-f',
from_file,
to_file,
cwd=self.project.checkout_path(self.version.slug),
)
@@ -78,7 +78,7 @@ def install_package(self):
self.project.pip_cache_path,
'.{0}'.format(extra_req_param),
cwd=self.checkout_path,
bin_path=self.venv_bin()
bin_path=self.venv_bin(),
)
elif self.config.python.install_with_setup:
self.build_env.run(
@@ -87,7 +87,7 @@ def install_package(self):
'install',
'--force',
cwd=self.checkout_path,
bin_path=self.venv_bin()
bin_path=self.venv_bin(),
)
def venv_bin(self, filename=None):
@@ -214,6 +214,7 @@ def setup_base(self):
'--no-download',
env_path,
bin_path=None, # Don't use virtualenv bin that doesn't exist yet
cwd=self.checkout_path,
)
def install_core_requirements(self):
@@ -267,7 +268,8 @@ def install_core_requirements(self):
cmd.extend(requirements)
self.build_env.run(
*cmd,
bin_path=self.venv_bin()
bin_path=self.venv_bin(),
cwd=self.checkout_path # noqa - no comma here in py27 :/
)
def install_user_requirements(self):
@@ -302,7 +304,7 @@ def install_user_requirements(self):
self.build_env.run(
*args,
cwd=self.checkout_path,
bin_path=self.venv_bin()
bin_path=self.venv_bin() # noqa - no comma here in py27 :/
)
@@ -334,6 +336,7 @@ def setup_base(self):
'--file',
self.config.conda.environment,
bin_path=None, # Don't use conda bin that doesn't exist yet
cwd=self.checkout_path,
)
def install_core_requirements(self):
@@ -364,7 +367,8 @@ def install_core_requirements(self):
]
cmd.extend(requirements)
self.build_env.run(
*cmd
*cmd,
cwd=self.checkout_path # noqa - no comma here in py27 :/
)
pip_cmd = [
@@ -378,7 +382,8 @@ def install_core_requirements(self):
pip_cmd.extend(pip_requirements)
self.build_env.run(
*pip_cmd,
bin_path=self.venv_bin()
bin_path=self.venv_bin(),
cwd=self.checkout_path # noqa - no comma here in py27 :/
)
def install_user_requirements(self):
@@ -1335,8 +1335,8 @@ def test_install_core_requirements_sphinx_conda(self, checkout_path):
args_conda.extend(conda_requirements)
self.build_env_mock.run.assert_has_calls([
mock.call(*args_conda),
mock.call(*args_pip, bin_path=mock.ANY)
mock.call(*args_conda, cwd=mock.ANY),
mock.call(*args_pip, bin_path=mock.ANY, cwd=mock.ANY)
])
@patch('readthedocs.projects.models.Project.checkout_path')
@@ -1374,8 +1374,8 @@ def test_install_core_requirements_mkdocs_conda(self, checkout_path):
args_conda.extend(conda_requirements)
self.build_env_mock.run.assert_has_calls([
mock.call(*args_conda),
mock.call(*args_pip, bin_path=mock.ANY)
mock.call(*args_conda, cwd=mock.ANY),
mock.call(*args_pip, bin_path=mock.ANY, cwd=mock.ANY)
])
@patch('readthedocs.projects.models.Project.checkout_path')

0 comments on commit 04901b3

Please sign in to comment.