4
4
5
5
from django .conf import settings
6
6
7
- from readthedocs .builds .constants import LATEST
8
7
from readthedocs .doc_builder .config import ConfigWrapper
9
8
from readthedocs .doc_builder .loader import get_builder_class
10
9
from readthedocs .projects .constants import LOG_TEMPLATE
@@ -35,7 +34,7 @@ def delete_existing_build_dir(self):
35
34
36
35
# Handle deleting old build dir
37
36
build_dir = os .path .join (
38
- self .venv_path (version = self . version . slug ),
37
+ self .venv_path (),
39
38
'build' )
40
39
if os .path .exists (build_dir ):
41
40
self ._log ('Removing existing build directory' )
@@ -47,14 +46,14 @@ def install_package(self):
47
46
if getattr (settings , 'USE_PIP_INSTALL' , False ):
48
47
self .build_env .run (
49
48
'python' ,
50
- self .venv_bin (version = self . version . slug , filename = 'pip' ),
49
+ self .venv_bin (filename = 'pip' ),
51
50
'install' ,
52
51
'--ignore-installed' ,
53
52
'--cache-dir' ,
54
53
self .project .pip_cache_path ,
55
54
'.' ,
56
55
cwd = self .checkout_path ,
57
- bin_path = self .venv_bin (version = self . version . slug )
56
+ bin_path = self .venv_bin ()
58
57
)
59
58
else :
60
59
self .build_env .run (
@@ -63,32 +62,31 @@ def install_package(self):
63
62
'install' ,
64
63
'--force' ,
65
64
cwd = self .checkout_path ,
66
- bin_path = self .venv_bin (version = self . version . slug )
65
+ bin_path = self .venv_bin ()
67
66
)
68
67
69
- def venv_bin (self , version = LATEST , filename = None ):
68
+ def venv_bin (self , filename = None ):
70
69
"""Return path to the virtualenv bin path, or a specific binary
71
70
72
- :param version: Version slug to use in path name
73
71
:param filename: If specified, add this filename to the path return
74
72
:returns: Path to virtualenv bin or filename in virtualenv bin
75
73
"""
76
- parts = [self .venv_path (version ), 'bin' ]
74
+ parts = [self .venv_path (), 'bin' ]
77
75
if filename is not None :
78
76
parts .append (filename )
79
77
return os .path .join (* parts )
80
78
81
79
82
80
class Virtualenv (PythonEnvironment ):
83
81
84
- def venv_path (self , version = LATEST ):
85
- return os .path .join (self .project .doc_path , 'envs' , version )
82
+ def venv_path (self ):
83
+ return os .path .join (self .project .doc_path , 'envs' , self . version . slug )
86
84
87
85
def setup_base (self ):
88
86
site_packages = '--no-site-packages'
89
87
if self .config .use_system_site_packages :
90
88
site_packages = '--system-site-packages'
91
- env_path = self .venv_path (version = self . version . slug )
89
+ env_path = self .venv_path ()
92
90
self .build_env .run (
93
91
self .config .python_interpreter ,
94
92
'-mvirtualenv' ,
@@ -114,7 +112,7 @@ def install_core_requirements(self):
114
112
115
113
cmd = [
116
114
'python' ,
117
- self .venv_bin (version = self . version . slug , filename = 'pip' ),
115
+ self .venv_bin (filename = 'pip' ),
118
116
'install' ,
119
117
'--use-wheel' ,
120
118
'-U' ,
@@ -130,7 +128,7 @@ def install_core_requirements(self):
130
128
cmd .extend (requirements )
131
129
self .build_env .run (
132
130
* cmd ,
133
- bin_path = self .venv_bin (version = self . version . slug )
131
+ bin_path = self .venv_bin ()
134
132
)
135
133
136
134
def install_user_requirements (self ):
@@ -149,21 +147,21 @@ def install_user_requirements(self):
149
147
if requirements_file_path :
150
148
self .build_env .run (
151
149
'python' ,
152
- self .venv_bin (version = self . version . slug , filename = 'pip' ),
150
+ self .venv_bin (filename = 'pip' ),
153
151
'install' ,
154
152
'--exists-action=w' ,
155
153
'--cache-dir' ,
156
154
self .project .pip_cache_path ,
157
155
'-r{0}' .format (requirements_file_path ),
158
156
cwd = self .checkout_path ,
159
- bin_path = self .venv_bin (version = self . version . slug )
157
+ bin_path = self .venv_bin ()
160
158
)
161
159
162
160
163
161
class Conda (PythonEnvironment ):
164
162
165
- def venv_path (self , version = LATEST ):
166
- return os .path .join (self .project .doc_path , 'conda' , version )
163
+ def venv_path (self ):
164
+ return os .path .join (self .project .doc_path , 'conda' , self . version . slug )
167
165
168
166
def setup_base (self ):
169
167
conda_env_path = os .path .join (self .project .doc_path , 'conda' )
@@ -220,7 +218,7 @@ def install_core_requirements(self):
220
218
221
219
pip_cmd = [
222
220
'python' ,
223
- self .venv_bin (version = self . version . slug , filename = 'pip' ),
221
+ self .venv_bin (filename = 'pip' ),
224
222
'install' ,
225
223
'-U' ,
226
224
'--cache-dir' ,
@@ -229,7 +227,7 @@ def install_core_requirements(self):
229
227
pip_cmd .extend (pip_requirements )
230
228
self .build_env .run (
231
229
* pip_cmd ,
232
- bin_path = self .venv_bin (version = self . version . slug )
230
+ bin_path = self .venv_bin ()
233
231
)
234
232
235
233
def install_user_requirements (self ):
0 commit comments