Skip to content

Commit

Permalink
I have produced cross-platform wheels for plyvel here: https://pypi.o…
Browse files Browse the repository at this point in the history
…rg/project/plyvel-wheels/#files

- Which fixes this problem: wbolster/plyvel#114 for details on "Symbol not found: __ZTIN7leveldb10ComparatorE" error
- By including a statically linked leveldb v 1.22 in the wheel (for Mac).
- This also saves the user from needing to perform a "brew install leveldb" step and is therefore an essential part of making the SDK a one-click-installation...
  • Loading branch information
AustEcon committed Jul 31, 2021
1 parent 13f4b67 commit dc249fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
18 changes: 4 additions & 14 deletions electrumsv_sdk/builtin_components/electrumsv/local_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,10 @@ def packages_electrumsv(self, url: str, branch: str) -> None:
)

electrumsv_libs_path = PYTHON_LIB_DIR / self.plugin.COMPONENT_NAME
if sys.platform == 'win32':
cmd1 = f"{sys.executable} -m pip install --target {electrumsv_libs_path} --upgrade " \
f"-r {electrumsv_requirements_path}"
cmd2 = f"{sys.executable} -m pip install --target {electrumsv_libs_path} --upgrade " \
f"-r {electrumsv_binary_requirements_path}"
elif sys.platform in ['linux', 'darwin']:
cmd1 = f"{sys.executable} -m pip install --target {electrumsv_libs_path} --upgrade " \
f"-r {electrumsv_requirements_path}"
cmd2 = f"{sys.executable} -m pip install --target {electrumsv_libs_path} --upgrade " \
f"-r {electrumsv_binary_requirements_path}"
else:
cmd1 = f"echo platform: {sys.platform} unsupported"
cmd2 = f"echo ''"

cmd1 = f"{sys.executable} -m pip install --target {electrumsv_libs_path} --upgrade " \
f"-r {electrumsv_requirements_path}"
cmd2 = f"{sys.executable} -m pip install --target {electrumsv_libs_path} --upgrade " \
f"-r {electrumsv_binary_requirements_path}"
process1 = subprocess.Popen(cmd1, shell=True)
process1.wait()
process2 = subprocess.Popen(cmd2, shell=True)
Expand Down
16 changes: 6 additions & 10 deletions electrumsv_sdk/builtin_components/electrumx/local_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ def packages_electrumx(self, url: str, branch: str) -> None:
"""plyvel wheels are not available on windows so it is swapped out for plyvel-win32 to
make it work"""

def modify_requirements_for_windows(temp_requirements):
"""replaces plyvel with plyvel-win32"""
def modify_requirements_for_windows_and_mac(temp_requirements):
"""replaces plyvel with plyvel-wheels"""
packages = []
with open(requirements_path, 'r') as f:
for line in f.readlines():
if line.strip() == 'plyvel':
continue
packages.append(line)
packages.append('plyvel-win32')
packages.append('plyvel-wheels')
with open(temp_requirements, 'w') as f:
f.writelines(packages)

Expand All @@ -98,19 +98,15 @@ def modify_requirements_for_windows(temp_requirements):
requirements_path = self.plugin.src.joinpath('requirements.txt')
electrumx_libs_path = PYTHON_LIB_DIR / self.plugin.COMPONENT_NAME

if sys.platform in ['linux', 'darwin']:
if sys.platform == 'darwin':
# so that plyvel dependency can build wheel
process = subprocess.Popen(["brew", "install", "leveldb"])
process.wait()
if sys.platform == 'linux':
process = subprocess.Popen(
f"{sys.executable} -m pip install --target {electrumx_libs_path} "
f"-r {requirements_path} --upgrade", shell=True)
process.wait()

elif sys.platform == 'win32':
elif sys.platform in {'win32', 'darwin'}:
temp_requirements = self.plugin.src.joinpath('requirements-temp.txt')
modify_requirements_for_windows(temp_requirements)
modify_requirements_for_windows_and_mac(temp_requirements)
process = subprocess.Popen(
f"{sys.executable} -m pip install --target {electrumx_libs_path} "
f"-r {temp_requirements} --upgrade", shell=True)
Expand Down

0 comments on commit dc249fb

Please sign in to comment.