Skip to content

Commit

Permalink
32 bit db packages
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminpkane committed Jan 12, 2022
1 parent b490a8c commit a95eb32
Showing 4 changed files with 38 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-db.yml
Original file line number Diff line number Diff line change
@@ -17,9 +17,11 @@ jobs:
matrix:
platform:
- linux-aarch64
- linux-i686
- linux-x86_64
- mac-arm64
- mac-x86_64
- win-32
- win-amd64
steps:
- name: Clone fiftyone
26 changes: 17 additions & 9 deletions fiftyone/core/odm/database.py
Original file line number Diff line number Diff line change
@@ -82,15 +82,23 @@ def establish_db_conn(config):
os.environ["FIFTYONE_PRIVATE_DATABASE_PORT"] = str(port)

except fos.ServiceExecutableNotFound as error:
if not fou.is_arm_mac():
raise error

raise FiftyOneConfigError(
"MongoDB is not yet supported on Apple Silicon Macs. Please"
"define a `database_uri` in your"
"`fiftyone.core.config.FiftyOneConfig` to define a connection"
"to your own MongoDB instance or cluster"
)
if fou.is_32_bit():
raise FiftyOneConfigError(
"MongoDB is not supported on 32-bit systems. Please "
"define a `database_uri` in your "
"`fiftyone.core.config.FiftyOneConfig` to define a "
"connection to your own MongoDB instance or cluster "
)

if fou.is_arm_mac():
raise FiftyOneConfigError(
"MongoDB is not yet supported on Apple Silicon Macs. "
"Please define a `database_uri` in your "
"`fiftyone.core.config.FiftyOneConfig` to define a "
"connection to your own MongoDB instance or cluster"
)

raise error

_client = pymongo.MongoClient(**_connection_kwargs)
_validate_db_version(config, _client)
10 changes: 10 additions & 0 deletions fiftyone/core/utils.py
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
import os
import platform
import signal
import struct
import subprocess
import timeit
import types
@@ -1238,6 +1239,15 @@ def is_arm_mac():
)


def is_32_bit():
"""Determines whether the system is 32-bit.
Returns:
True/False
"""
return struct.calcsize("P") * 8 == 32


def datetime_to_timestamp(dt):
"""Converts a `datetime.date` or `datetime.datetime` to milliseconds since
epoch.
12 changes: 9 additions & 3 deletions package/db/setup.py
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
import tarfile
import zipfile

from setuptools import setup, find_packages
from setuptools import setup
from wheel.bdist_wheel import bdist_wheel

try:
@@ -26,9 +26,11 @@
# arm64 is not available for ubuntu1604 and debian9
MONGODB_DOWNLOAD_URLS = {
"linux-aarch64": "https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-ubuntu1804-4.4.2.tgz",
"linux-i686": None,
"linux-x86_64": "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.4.2.tgz",
"mac-arm64": None,
"mac-x86_64": "https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.4.2.tgz",
"win-32": None,
"win-amd64": "https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-4.4.2.zip",
"debian9": {
"manylinux1_x86_64": "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-4.4.2.tgz",
@@ -73,16 +75,20 @@ def finalize_options(self):
not isa or platform.endswith(isa)
)

if is_platform("linux", "aarch64"):
if is_platform("linux", "i686"):
self.plat_name = "manylinux1_i686"
elif is_platform("linux", "aarch64"):
self.plat_name = "manylinux2014_aarch64"
elif is_platform("linux", "x86_64"):
self.plat_name = "manylinux1_x86_64"
elif is_platform("mac", "arm64"):
self.plat_name = "macosx_11_0_arm64"
elif is_platform("mac", "x86_64"):
self.plat_name = "macosx_10_13_x86_64"
elif is_platform("win"):
elif is_platform("win", "amd64"):
self.plat_name = "win_amd64"
elif is_platform("win", "32"):
self.plat_name = "win32"
else:
raise ValueError(
"Unsupported target platform: %r" % self.plat_name

0 comments on commit a95eb32

Please sign in to comment.