From cdb0f576a67d92ac35a3c6c664cbd57fc0eedf93 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Thu, 8 Nov 2018 15:22:48 -0600 Subject: [PATCH 1/5] Use python to expand the cwd instead of environment variables --- common | 2 +- readthedocs/doc_builder/python_environments.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common b/common index 52dfe7ab1db..576433b8b78 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 52dfe7ab1dbda9d2a05f2d63bedac63e30a4e5ad +Subproject commit 576433b8b78acb67b0a7edde6d56f93701d9904c diff --git a/readthedocs/doc_builder/python_environments.py b/readthedocs/doc_builder/python_environments.py index 882a0ebbbc5..10a25e11be5 100644 --- a/readthedocs/doc_builder/python_environments.py +++ b/readthedocs/doc_builder/python_environments.py @@ -218,7 +218,7 @@ def setup_base(self): # Don't use virtualenv bin that doesn't exist yet bin_path=None, # Don't use the project's root, some config files can interfere - cwd='$HOME', + cwd=os.path.expanduser("~"), ) def install_core_requirements(self): From 64b7806d775acf48f7865be2127337809e9e3201 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Thu, 8 Nov 2018 15:55:00 -0600 Subject: [PATCH 2/5] Expand variables in the cwd --- readthedocs/doc_builder/environments.py | 2 +- readthedocs/doc_builder/python_environments.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py index 038aeb0d834..be79222133a 100644 --- a/readthedocs/doc_builder/environments.py +++ b/readthedocs/doc_builder/environments.py @@ -82,7 +82,7 @@ def __init__(self, command, cwd=None, shell=False, environment=None, self.shell = shell if cwd is None: cwd = os.getcwd() - self.cwd = cwd + self.cwd = os.path.expandvars(cwd) self.environment = os.environ.copy() if environment is not None: assert 'PATH' not in environment, "PATH can't be set" diff --git a/readthedocs/doc_builder/python_environments.py b/readthedocs/doc_builder/python_environments.py index 10a25e11be5..882a0ebbbc5 100644 --- a/readthedocs/doc_builder/python_environments.py +++ b/readthedocs/doc_builder/python_environments.py @@ -218,7 +218,7 @@ def setup_base(self): # Don't use virtualenv bin that doesn't exist yet bin_path=None, # Don't use the project's root, some config files can interfere - cwd=os.path.expanduser("~"), + cwd='$HOME', ) def install_core_requirements(self): From 7a6e2b520360fb86020bff2edb3dfa372915b927 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Thu, 8 Nov 2018 15:55:38 -0600 Subject: [PATCH 3/5] Update common --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 576433b8b78..d8aa79b2b56 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 576433b8b78acb67b0a7edde6d56f93701d9904c +Subproject commit d8aa79b2b560b8f8d691298fec1912c6c679c8c1 From 562a95b15d85981706421e734258d1eb5d0d7b76 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Thu, 8 Nov 2018 16:02:33 -0600 Subject: [PATCH 4/5] Expand in the run method --- readthedocs/doc_builder/environments.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py index be79222133a..0ab5632e3ee 100644 --- a/readthedocs/doc_builder/environments.py +++ b/readthedocs/doc_builder/environments.py @@ -82,7 +82,7 @@ def __init__(self, command, cwd=None, shell=False, environment=None, self.shell = shell if cwd is None: cwd = os.getcwd() - self.cwd = os.path.expandvars(cwd) + self.cwd = cwd self.environment = os.environ.copy() if environment is not None: assert 'PATH' not in environment, "PATH can't be set" @@ -148,7 +148,7 @@ def run(self): proc = subprocess.Popen( self.command, shell=self.shell, - cwd=self.cwd, + cwd=os.path.expandvars(self.cwd), stdin=stdin, stdout=stdout, stderr=stderr, From 775ca33f7d7b61b0f87bbe5945a827d255e32e67 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Thu, 8 Nov 2018 16:03:05 -0600 Subject: [PATCH 5/5] Add comment --- readthedocs/doc_builder/environments.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py index 0ab5632e3ee..25443f05322 100644 --- a/readthedocs/doc_builder/environments.py +++ b/readthedocs/doc_builder/environments.py @@ -148,6 +148,8 @@ def run(self): proc = subprocess.Popen( self.command, shell=self.shell, + # This is done here for local builds, but not for docker, + # as we want docker to expand inside the container cwd=os.path.expandvars(self.cwd), stdin=stdin, stdout=stdout,