Skip to content

Commit 689dbf2

Browse files
committed
fix suffix
1 parent b0b0b54 commit 689dbf2

1 file changed

Lines changed: 39 additions & 39 deletions

File tree

pythonforandroid/recipes/hostpython3/__init__.py

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@
1515
)
1616
from pythonforandroid.prerequisites import OpenSSLPrerequisite
1717

18-
HOSTPYTHON_VERSION_UNSET_MESSAGE = (
19-
'The hostpython recipe must have set version'
20-
)
18+
HOSTPYTHON_VERSION_UNSET_MESSAGE = "The hostpython recipe must have set version"
2119

22-
SETUP_DIST_NOT_FIND_MESSAGE = (
23-
'Could not find Setup.dist or Setup in Python build'
24-
)
20+
SETUP_DIST_NOT_FIND_MESSAGE = "Could not find Setup.dist or Setup in Python build"
2521

2622

2723
class HostPython3Recipe(Recipe):
28-
'''
24+
"""
2925
The hostpython3's recipe.
3026
3127
.. versionchanged:: 2019.10.06.post0
@@ -34,17 +30,17 @@ class HostPython3Recipe(Recipe):
3430
.. versionchanged:: 0.6.0
3531
Refactored into the new class
3632
:class:`~pythonforandroid.python.HostPythonRecipe`
37-
'''
33+
"""
3834

39-
version = '3.14.2'
35+
version = "3.14.2"
4036

41-
url = 'https://github.com/python/cpython/archive/refs/tags/v{version}.tar.gz'
42-
'''The default url to download our host python recipe. This url will
43-
change depending on the python version set in attribute :attr:`version`.'''
37+
url = "https://github.com/python/cpython/archive/refs/tags/v{version}.tar.gz"
38+
"""The default url to download our host python recipe. This url will
39+
change depending on the python version set in attribute :attr:`version`."""
4440

45-
build_subdir = 'native-build'
46-
'''Specify the sub build directory for the hostpython3 recipe. Defaults
47-
to ``native-build``.'''
41+
build_subdir = "native-build"
42+
"""Specify the sub build directory for the hostpython3 recipe. Defaults
43+
to ``native-build``."""
4844

4945
patches = ["fix_ensurepip.patch"]
5046

@@ -59,16 +55,16 @@ def download(self):
5955

6056
@property
6157
def _exe_name(self):
62-
'''
58+
"""
6359
Returns the name of the python executable depending on the version.
64-
'''
60+
"""
6561
if not self.version:
6662
raise BuildInterruptingException(HOSTPYTHON_VERSION_UNSET_MESSAGE)
67-
return f'python{self.version.split(".")[0]}'
63+
return "python"
6864

6965
@property
7066
def python_exe(self):
71-
'''Returns the full path of the hostpython executable.'''
67+
"""Returns the full path of the hostpython executable."""
7268
return join(self.local_bin, self._exe_name)
7369

7470
def get_recipe_env(self, arch=None):
@@ -91,14 +87,14 @@ def should_build(self, arch):
9187

9288
def get_build_container_dir(self, arch=None):
9389
choices = self.check_recipe_choices()
94-
dir_name = '-'.join([self.name] + choices)
95-
return join(self.ctx.build_dir, 'other_builds', dir_name, 'desktop')
90+
dir_name = "-".join([self.name] + choices)
91+
return join(self.ctx.build_dir, "other_builds", dir_name, "desktop")
9692

9793
def get_build_dir(self, arch=None):
98-
'''
94+
"""
9995
.. note:: Unlike other recipes, the hostpython build dir doesn't
10096
depend on the target arch
101-
'''
97+
"""
10298
return join(self.get_build_container_dir(), self.name)
10399

104100
def get_path_to_python(self):
@@ -125,7 +121,7 @@ def site_dir(self):
125121
p_version = Version(self.version)
126122
return join(
127123
self.site_root,
128-
f"usr/local/lib/python{p_version.major}.{p_version.minor}/site-packages/"
124+
f"usr/local/lib/python{p_version.major}.{p_version.minor}/site-packages/",
129125
)
130126

131127
@property
@@ -167,39 +163,40 @@ def build_arch(self, arch):
167163
# Configure the build
168164
build_configured = False
169165
with current_directory(build_dir):
170-
if not Path('config.status').exists():
171-
shprint(sh.Command(join(recipe_build_dir, 'configure')),
172-
'--prefix', self.local_dir, _env=env)
166+
if not Path("config.status").exists():
167+
shprint(
168+
sh.Command(join(recipe_build_dir, "configure")),
169+
"--prefix",
170+
self.local_dir,
171+
_env=env,
172+
)
173173
build_configured = True
174174

175175
with current_directory(recipe_build_dir):
176176
# Create the Setup file. This copying from Setup.dist is
177177
# the normal and expected procedure before Python 3.8, but
178178
# after this the file with default options is already named "Setup"
179-
setup_dist_location = join('Modules', 'Setup.dist')
179+
setup_dist_location = join("Modules", "Setup.dist")
180180
if Path(setup_dist_location).exists():
181-
shprint(sh.cp, setup_dist_location,
182-
join(build_dir, 'Modules', 'Setup'))
181+
shprint(sh.cp, setup_dist_location, join(build_dir, "Modules", "Setup"))
183182
else:
184183
# Check the expected file does exist
185-
setup_location = join('Modules', 'Setup')
184+
setup_location = join("Modules", "Setup")
186185
if not Path(setup_location).exists():
187-
raise BuildInterruptingException(
188-
SETUP_DIST_NOT_FIND_MESSAGE
189-
)
186+
raise BuildInterruptingException(SETUP_DIST_NOT_FIND_MESSAGE)
190187

191-
shprint(sh.make, '-j', str(cpu_count()), '-C', build_dir, _env=env)
188+
shprint(sh.make, "-j", str(cpu_count()), "-C", build_dir, _env=env)
192189

193190
with current_directory(build_dir):
194-
shprint(sh.make, 'install', _env=env)
191+
shprint(sh.make, "install", _env=env)
195192

196193
with current_directory(recipe_build_dir):
197194
# make a copy of the python executable giving it the name we want,
198195
# because we got different python's executable names depending on
199196
# the fs being case-insensitive (Mac OS X, Cygwin...) or
200197
# case-sensitive (linux)...so this way we will have an unique name
201198
# for our hostpython, regarding the used fs
202-
for exe_name in ['python.exe', 'python']:
199+
for exe_name in ["python.exe", "python"]:
203200
exe = join(self.get_path_to_python(), exe_name)
204201
if Path(exe).is_file():
205202
shprint(sh.cp, exe, self.python_exe)
@@ -210,8 +207,11 @@ def build_arch(self, arch):
210207

211208
if build_configured:
212209
shprint(
213-
sh.Command(self.python_exe), "-m", "ensurepip", "-U",
214-
_env={"HOME": "/tmp", "PATH": self.local_bin}
210+
sh.Command(self.python_exe),
211+
"-m",
212+
"ensurepip",
213+
"-U",
214+
_env={"HOME": "/tmp", "PATH": self.local_bin},
215215
)
216216
self.fix_pip_shebangs()
217217

0 commit comments

Comments
 (0)