diff options
| author | J08nY | 2024-05-16 14:12:18 +0200 |
|---|---|---|
| committer | J08nY | 2024-05-16 14:22:31 +0200 |
| commit | 61221c98f902fd53840d1f2f060e6f020c9f286b (patch) | |
| tree | 2b0b246b38d66fa1eea34b3e564d53e56aa02c05 /setup.py | |
| parent | c53294e69e366293a04a10cfd9331f504ceab0ce (diff) | |
| download | pyecsca-61221c98f902fd53840d1f2f060e6f020c9f286b.tar.gz pyecsca-61221c98f902fd53840d1f2f060e6f020c9f286b.tar.zst pyecsca-61221c98f902fd53840d1f2f060e6f020c9f286b.zip | |
Diffstat (limited to 'setup.py')
| -rw-r--r-- | setup.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..064398c --- /dev/null +++ b/setup.py @@ -0,0 +1,45 @@ +from pathlib import Path +from setuptools import Command, setup +from setuptools.command.sdist import sdist +from setuptools.command.build import build + + +class SubmoduleMissingException(Exception): + pass + + +class CustomSubmoduleCheck(Command): + def initialize_options(self) -> None: + pass + + def finalize_options(self) -> None: + pass + + def run(self) -> None: + efd_path = Path("pyecsca/ec/efd") + if not list(efd_path.iterdir()): + raise SubmoduleMissingException( + "The EFD submodule of pyecsca is missing, did you initialize the git submodules?" + ) + std_path = Path("pyecsca/ec/std") + if not list(std_path.iterdir()): + raise SubmoduleMissingException( + "The std-curves submodule of pyecsca is missing, did you initialize the git submodules?" + ) + + +class CustomSdist(sdist): + sub_commands = [("check_submodules", None)] + sdist.sub_commands + + +class CustomBuild(build): + sub_commands = [("check_submodules", None)] + build.sub_commands + + +setup( + cmdclass={ + "sdist": CustomSdist, + "build": CustomBuild, + "check_submodules": CustomSubmoduleCheck, + } +) |
