Skip to content

Commit

Permalink
Check swig is installed
Browse files Browse the repository at this point in the history
Display an error message is swig is not installed.

I hope it will be clearer than the default error message:
error: command 'swig' failed: No such file or directory
  • Loading branch information
LudovicRousseau committed Aug 12, 2023
1 parent 1e9d416 commit cfcc306
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from sys import version_info as pyver
from os import path
import platform
from shutil import which


description = """A complete PKCS#11 wrapper for Python.
You can use any PKCS#11 (aka CryptoKi) module such as the PSM which
Expand Down Expand Up @@ -67,6 +69,10 @@

class MyBuild(build_py):
def run(self):
if which("swig") is None:
print("Install swig and try again")
print("")
exit(1)
self.run_command("build_ext")
shutil.copy("src/LowLevel.py", "PyKCS11")
build_py.run(self)
Expand Down

0 comments on commit cfcc306

Please sign in to comment.