robmcmullen / omnivore

Hex editor and debugging emulator, sponsored by the Player/Missile Podcast
Mozilla Public License 2.0
53 stars 7 forks source link

setup.py Should Check Exit Value of subprocess.run() -- e.g. parse_gen.py #258

Open TikiBill opened 4 years ago

TikiBill commented 4 years ago

(Let me know if you'd like pull requests.)

E.g. if an incompatible version of slugify is installed, parse_gen.py can fail causing other confusing downstream compile errors. Trying to build again will not resolve the issue nor repeat the error because it looks to setup.py like parse_gen.py ran. Suggested code in setup.py around line 84:

    if not os.path.exists(cputables_path):
        completed_process = subprocess.run([sys.executable, 'libudis/cpugen.py'])
        if completed_process.returncode != 0:
            if os.path.exists(cputables_path):
                os.remove(cputables_path)
            sys.exit("libudis/cpugen.py failed, stopping the build.")

And line 97:

    if not os.path.exists(parse_gen_path):
        completed_process = subprocess.run([sys.executable, 'libudis/parse_gen.py'])
        if completed_process.returncode != 0:
            if os.path.exists(parse_gen_path):
                os.remove(parse_gen_path)
            sys.exit("libudis/parse_gen.py failed, stopping the build (make sure you have python-slugify an not slugify).")

Obviously, the issue I was having is that I installed slugify (0.0.1) rather than python-slugify (4.0.0). Perhaps also make a note in the build docs about python-slugify vs. slugify.

robmcmullen commented 4 years ago

Sure, pull requests would be great as I'm not sure how many more weeks it's going to take to get a windows machine up and running for me.

TikiBill commented 4 years ago

I'm on it! I'm sure you are in no rush, regardless it'll be a few days. Thanks again.