-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy path__init__.py
36 lines (29 loc) · 1.24 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
import shutil
import os
class MySQLConnectorPythonRecipe(CompiledComponentsPythonRecipe):
name = 'mysql-connector-python'
version = '8.3.0'
url = (
"https://dev.mysql.com/get/Downloads/Connector-Python/"
f"mysql-connector-python-{version}-src.tar.gz"
)
call_hostpython_via_targetpython = False
depends = ['python3', 'setuptools']
def post_download(self, archive_fn, destination_dir):
super(MySQLConnectorPythonRecipe, self).post_download(archive_fn, destination_dir)
# Extract the downloaded tarball and ensure correct directory structure
self.extract_tar(archive_fn, destination_dir)
# Move contents to the expected directory structure
extracted_dir = os.path.join(
destination_dir,
f'mysql-connector-python-{self.version}-src'
)
if os.path.exists(extracted_dir):
for item in os.listdir(extracted_dir):
shutil.move(
os.path.join(extracted_dir, item),
destination_dir
)
shutil.rmtree(extracted_dir)
recipe = MySQLConnectorPythonRecipe()