GrammaTech / sel

Programmatic modification and evaluation of software
https://grammatech.github.io/sel/#Top
Other
165 stars 21 forks source link

Support ARM / apple silicon chips #32

Open juanmirocks opened 1 month ago

juanmirocks commented 1 month ago

At least trying to import the python asts binding, in an apple M1/2/3 laptop results into the following.

Recent versions of py-tree-sitter work just fine on any platform.

In [1]: import asts
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[1], line 1
----> 1 import asts

File .venv/lib/python3.12/site-packages/asts/__init__.py:1
----> 1 from .asts import *  # noqa: F401, F403
      2 from .types import *  # noqa: F401, F403

File .venv/lib/python3.12/site-packages/asts/asts.py:710
    705                 _interface._check_for_process_crash()
    707         return response
--> 710 _interface.start()
    711 atexit.register(_interface.stop)
    713 # Generated tree-sitter AST types and user-defined method specializations

File .venv/lib/python3.12/site-packages/asts/asts.py:543, in _interface.start()
    540     cmdline = [cmd]
    542 # Startup the interface subprocess.
--> 543 _interface._proc = subprocess.Popen(
    544     cmdline,
    545     stdin=subprocess.PIPE,
    546     stdout=subprocess.PIPE,
    547     stderr=subprocess.PIPE,
    548 )
    550 # If the interface was built using the deploy package for use
    551 # in a python wheel file, read standard error waiting for the
    552 # requisite tree-sitter libraries to be loaded and the launching
    553 # application notification to be given.
    554 if cmd != _interface._DEFAULT_CMD_NAME:

File python3.12/subprocess.py:1026, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask, pipesize, process_group)
   1022         if self.text_mode:
   1023             self.stderr = io.TextIOWrapper(self.stderr,
   1024                     encoding=encoding, errors=errors)
-> 1026     self._execute_child(args, executable, preexec_fn, close_fds,
   1027                         pass_fds, cwd, env,
   1028                         startupinfo, creationflags, shell,
   1029                         p2cread, p2cwrite,
   1030                         c2pread, c2pwrite,
   1031                         errread, errwrite,
   1032                         restore_signals,
   1033                         gid, gids, uid, umask,
   1034                         start_new_session, process_group)
   1035 except:
   1036     # Cleanup if the child failed starting.
   1037     for f in filter(None, (self.stdin, self.stdout, self.stderr)):

File python3.12/subprocess.py:1955, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, gid, gids, uid, umask, start_new_session, process_group)
   1953     err_msg = os.strerror(errno_num)
   1954 if err_filename is not None:
-> 1955     raise child_exception_type(errno_num, err_msg, err_filename)
   1956 else:
   1957     raise child_exception_type(errno_num, err_msg)

OSError: [Errno 8] Exec format error: '.venv/lib/python3.12/site-packages/asts/tree-sitter-interface'