Skip to content

Commit

Permalink
greedy_url in error
Browse files Browse the repository at this point in the history
  • Loading branch information
Reza committed Sep 17, 2024
1 parent a482a7d commit 8f71d05
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 32 deletions.
8 changes: 6 additions & 2 deletions pyalfe/interfaces/greedy.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import subprocess
from shutil import which

from pyalfe.tools import GREEDY_PATH
from pyalfe.tools import GREEDY_PATH, greedy_url


class Greedy:
def __init__(self, greedy_path=GREEDY_PATH):
self.cmd = [greedy_path]
if which(greedy_path) is None:
raise RuntimeError(
msg = (
f'{greedy_path} executable was not found in your system. '
'To download and install greedy, visit:\n '
'https://greedy.readthedocs.io/en/latest/install.html#using-pre-compiled-binaries'
)
if greedy_url:
msg += f'\n or {greedy_url} \n'

raise RuntimeError(msg)

def dim(self, d):
self.cmd += ['-d', str(d)]
Expand Down
80 changes: 50 additions & 30 deletions pyalfe/tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,62 @@
import os
from collections import defaultdict

greedy_url = {
'Linux': {
'x86_64': (
'https://sourceforge.net/projects/greedy-reg/files/Nightly/'
'greedy-nightly-Linux-gcc64.tar.gz'
)
},
'Darwin': {
'x86_64': (
'https://sourceforge.net/projects/greedy-reg/files/Nightly/'
'greedy-nightly-MacOS-x86_64.dmg'
greedy_url = defaultdict(
lambda: defaultdict(str),
{
'Linux': defaultdict(
str,
{
'x86_64': (
'https://sourceforge.net/projects/greedy-reg/files/Nightly/'
'greedy-nightly-Linux-gcc64.tar.gz'
)
},
),
'arm64': (
'https://sourceforge.net/projects/greedy-reg/files/Nightly/'
'greedy-nightly-MacOS-arm64.dmg'
'Darwin': defaultdict(
str,
{
'x86_64': (
'https://sourceforge.net/projects/greedy-reg/files/Nightly/'
'greedy-nightly-MacOS-x86_64.dmg'
),
'arm64': (
'https://sourceforge.net/projects/greedy-reg/files/Nightly/'
'greedy-nightly-MacOS-arm64.dmg'
),
},
),
},
}[os.uname()[0]][os.uname()[-1]]
)[os.uname()[0]][os.uname()[-1]]

c3d_url = {
'Linux': {
'x86_64': (
'https://sourceforge.net/projects/c3d/files/c3d/Nightly/'
'c3d-nightly-Linux-gcc64.tar.gz'
)
},
'Darwin': {
'x86_64': (
'https://sourceforge.net/projects/c3d/files/c3d/Nightly/'
'c3d-nightly-MacOS-x86_64.dmg'

c3d_url = defaultdict(
lambda: defaultdict(str),
{
'Linux': defaultdict(
str,
{
'x86_64': (
'https://sourceforge.net/projects/c3d/files/c3d/Nightly/'
'c3d-nightly-Linux-gcc64.tar.gz'
)
},
),
'arm64': (
'https://sourceforge.net/projects/c3d/files/c3d/Nightly/'
'c3d-nightly-MacOS-arm64.dmg'
'Darwin': defaultdict(
str,
{
'x86_64': (
'https://sourceforge.net/projects/c3d/files/c3d/Nightly/'
'c3d-nightly-MacOS-x86_64.dmg'
),
'arm64': (
'https://sourceforge.net/projects/c3d/files/c3d/Nightly/'
'c3d-nightly-MacOS-arm64.dmg'
),
},
),
},
}[os.uname()[0]][os.uname()[-1]]
)[os.uname()[0]][os.uname()[-1]]

GREEDY_PATH = 'greedy' # importlib.resources.files('pyalfe.tools').joinpath('greedy')
C3D_PATH = 'c3d' # importlib.resources.files('pyalfe.tools').joinpath('c3d')

0 comments on commit 8f71d05

Please sign in to comment.