Skip to content

Commit e7d1ea4

Browse files
committed
Use cache to prevent isa-l from building twice
1 parent b5c5886 commit e7d1ea4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
# SOFTWARE.
2020

21+
import functools
2122
import os
2223
import shutil
2324
import subprocess
@@ -42,6 +43,11 @@ def build_extension(self, ext):
4243
super().build_extension(ext)
4344

4445

46+
# Use a cache to prevent isa-l from being build twice. According to the
47+
# functools docs lru_cache with maxsize None is faster. The shortcut called
48+
# 'cache' is only available from python 3.9 onwards.
49+
# see: https://docs.python.org/3/library/functools.html#functools.cache
50+
@functools.lru_cache(maxsize=None)
4551
def build_isa_l():
4652
# Creating temporary directories
4753
unpack_dir = tempfile.mktemp()

0 commit comments

Comments
 (0)