summarylogtreecommitdiffstats
path: root/0001-setup.py-option-to-disable-secp-build.patch
blob: 6920ed32568083482a9ec81f1134f3ca64e23d13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From 90bf467b564389ea93b1cb60d9971e9ddbbc0a16 Mon Sep 17 00:00:00 2001
From: Marcel O'Neil <marcel@marceloneil.com>
Date: Wed, 27 Mar 2019 22:45:05 -0400
Subject: [PATCH] setup.py: option to disable secp build

---
 setup.py | 34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/setup.py b/setup.py
index 2affc297..8b3fff86 100755
--- a/setup.py
+++ b/setup.py
@@ -62,17 +62,31 @@ if platform.system() in ['Linux', 'FreeBSD', 'DragonFly']:
     ]
 
 class MakeAllBeforeSdist(setuptools.command.sdist.sdist):
-  """Does some custom stuff before calling super().run()."""
+    """Does some custom stuff before calling super().run()."""
 
-  def run(self):
-    """Run command."""
-    #self.announce("Running make_locale...")
-    #0==os.system("contrib/make_locale") or sys.exit("Could not make locale, aborting")
-    #self.announce("Running make_packages...")
-    #0==os.system("contrib/make_packages") or sys.exit("Could not make locale, aborting")
-    self.announce("Running make_secp...")
-    0==os.system("contrib/make_secp") or sys.exit("Could not build libsecp256k1")
-    super().run()
+    user_options = setuptools.command.sdist.sdist.user_options + [
+        ("disable-secp", None, "Disable libsecp256k1 complilation.")
+    ]
+
+    def initialize_options(self):
+        self.disable_secp = None
+        super().initialize_options()
+
+    def finalize_options(self):
+        if self.disable_secp is None:
+            self.disable_secp = False # Default to build secp
+        super().finalize_options()
+
+    def run(self):
+        """Run command."""
+        #self.announce("Running make_locale...")
+        #0==os.system("contrib/make_locale") or sys.exit("Could not make locale, aborting")
+        #self.announce("Running make_packages...")
+        #0==os.system("contrib/make_packages") or sys.exit("Could not make locale, aborting")
+        if not self.disable_secp:
+            self.announce("Running make_secp...")
+            0==os.system("contrib/make_secp") or sys.exit("Could not build libsecp256k1")
+        super().run()
 
 setup(
     cmdclass={
-- 
2.21.0