AndrewAnnex / SpiceyPy

SpiceyPy: a Pythonic Wrapper for the SPICE Toolkit.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get_spice.py doesn't work on FreeBSD

murashinln opened this issue · comments

Describe the bug
In the FreeBSD environment, gunzip | tar xC in the get_spice.py doesn't work.

The command python3.10 -m pip install . in the SpiceyPy directory successfully exited but ~/.local/lib/python3.10/site-packages/spiceypy/utils/libcspice.so doesn't exist.

When I executed get_spice.py alone, I got following outputs:

$ python3.10 get_spice.py
Preparing cspice
Downloading CSPICE src from NAIF
Gathering information...
SYSTEM:    FreeBSD
PROCESSOR: amd64
MACHINE:   64bit amd64
Downloading CSPICE for PC_Linux_GCC_64bit...
Unpacking... (this may take some time!)
tar: Error opening archive: Failed to open '/dev/sa0'
Traceback (most recent call last):
  File "/tank0/home/murashin/repos/github/a/SpiceyPy/get_spice.py", line 447, in <module>
    main()
  File "/tank0/home/murashin/repos/github/a/SpiceyPy/get_spice.py", line 420, in main
    prepare_cspice()
  File "/tank0/home/murashin/repos/github/a/SpiceyPy/get_spice.py", line 324, in prepare_cspice
    GetCSPICE(dst=tmp_cspice_root_dir)
  File "/tank0/home/murashin/repos/github/a/SpiceyPy/get_spice.py", line 180, in __init__
    self._unpack()
  File "/tank0/home/murashin/repos/github/a/SpiceyPy/get_spice.py", line 255, in _unpack
    proc.stdin.write(self._local.read())
BrokenPipeError: [Errno 32] Broken pipe

Expected behavior
Successfully installs libcspice.so

To Reproduce
Execute python3.10 -m pip install . on the FreeBSD environment.

Desktop (please complete the following information):

  • SpiceyPy Version: 5.0.1
  • OS: FreeBSD 13.0-RELEASE-p7
  • OS Architecture: 64bit
  • Python Version: 3.10.4
  • Python Architecture: 64bit

Additional context
If I changed gunzip | tar xC into gunzip | tar xfC -, libcspice.so can be successfully installed. I guess the changed command will also work in the other Unix-like environments, but I'm not 100 percent sure.

hey @murashinln, could you try updating line 253 in get_spice.py to cmd = f"gunzip | tar {'xfC -' if host_OS is 'FreeBSD' else 'xC'} {self._root}" and see if that works? Assuming you sent me valid Freebsd syntax, it seems to be incompatible with macos so this fix may be needed

Hi, I tried updating it and I got a following result:

$ python3.10 get_spice.py
/tank0/home/murashin/repos/github/a/SpiceyPy/get_spice.py:253: SyntaxWarning: "is" with a literal. Did you mean "=="?
  cmd = f"gunzip | tar {'xfC -' if host_OS is 'FreeBSD' else 'xC'} {self._root}"
Preparing cspice
Downloading CSPICE src from NAIF
Gathering information...
SYSTEM:    FreeBSD
PROCESSOR: amd64
MACHINE:   64bit amd64
Downloading CSPICE for PC_Linux_GCC_64bit...
Unpacking... (this may take some time!)
tar: Error opening archive: Failed to open '/dev/sa0'
Traceback (most recent call last):
  File "/tank0/home/murashin/repos/github/a/SpiceyPy/get_spice.py", line 447, in <module>
    main()
  File "/tank0/home/murashin/repos/github/a/SpiceyPy/get_spice.py", line 420, in main
    prepare_cspice()
  File "/tank0/home/murashin/repos/github/a/SpiceyPy/get_spice.py", line 324, in prepare_cspice
    GetCSPICE(dst=tmp_cspice_root_dir)
  File "/tank0/home/murashin/repos/github/a/SpiceyPy/get_spice.py", line 180, in __init__
    self._unpack()
  File "/tank0/home/murashin/repos/github/a/SpiceyPy/get_spice.py", line 255, in _unpack
    proc.stdin.write(self._local.read())
BrokenPipeError: [Errno 32] Broken pipe

but if I tried with cmd = f"gunzip | tar {'xfC -' if host_OS == 'FreeBSD' else 'xC'} {self._root}", it works fine.

okay thanks for the correction, I'll make that change and close the issue.