leonardt / pycoreir

Python bindings for coreir
BSD 3-Clause "New" or "Revised" License
10 stars 6 forks source link

Adding native wheel back again #119

Closed Kuree closed 4 years ago

Kuree commented 4 years ago

What does this PR do:

What needs to be done:

Some tricks I used to speed up macos build (about 4x):

Kuree commented 4 years ago

Something like this: https://github.com/leonardt/pycoreir/blob/8169636c1c252329973ea25ddc88d907e962e2eb/.travis.yml#L22-L26

If nothing has changed it should just work, but I'm not sure.

leonardt commented 4 years ago

Ok, we can test it, I'm getting this error when trying to run setup.py locally:

    running build_ext
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/leonardtruong/repos/pycoreir/setup.py", line 126, in <module>
        zip_safe=False
      File "/Users/leonardtruong/miniconda3/lib/python3.7/site-packages/setuptools/__init__.py", line 143, in setup
        return distutils.core.setup(**attrs)
      File "/Users/leonardtruong/miniconda3/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Users/leonardtruong/miniconda3/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Users/leonardtruong/miniconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Users/leonardtruong/miniconda3/lib/python3.7/site-packages/setuptools/command/develop.py", line 38, in run
        self.install_for_development()
      File "/Users/leonardtruong/miniconda3/lib/python3.7/site-packages/setuptools/command/develop.py", line 138, in install_for_development
        self.run_command('build_ext')
      File "/Users/leonardtruong/miniconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Users/leonardtruong/miniconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Users/leonardtruong/repos/pycoreir/setup.py", line 63, in run
        if coreir_path is not None and self.is_binary(coreir_path):
      File "/Users/leonardtruong/repos/pycoreir/setup.py", line 55, in is_binary
        return is_binary_string(f.read(1024))
      File "/Users/leonardtruong/miniconda3/lib/python3.7/codecs.py", line 322, in decode
        (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 0: invalid continuation byte

Investigating a good fix, but we can likely ignore (catch) the unicode error and assume it's binary.

leonardt commented 4 years ago

This seems to work for me:

-            return is_binary_string(f.read(1024))
+            try:
+                return is_binary_string(f.read(1024))
+            except UnicodeDecodeError:
+                # assume binary
+                return True
Kuree commented 4 years ago

Thanks. I will do an update from that diff.

Kuree commented 4 years ago

We probably also need some documentation on how to use their own coreir distribution, but that can be in a different PR.

leonardt commented 4 years ago

Merging this into a branch on this repo so I can push changes (easier than sending diffs)

leonardt commented 4 years ago

Arg, looks like it wouldn't let me merge to a branch that was identical and just sent this to master, but it should be okay for now until I release it, will push changes there.