Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This is a recipe for mysql-connector-python #2974

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
36 changes: 36 additions & 0 deletions pythonforandroid/recipes/mysql-connector-python/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,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()
Loading