11#!/usr/bin/env python
22# -*- coding: utf-8 -*-
3- import struct
43import os
5- from os .path import join , dirname
4+ import platform
5+ import struct
66
77from setuptools import setup
88from setuptools .dist import Distribution
@@ -62,19 +62,21 @@ def get_system_bits():
6262 ]
6363 )
6464
65- # The "cibuildwheel" tool sets the variable below to
66- # something like x86_64, aarch64, i686, and so on.
67- TARGET_ARCH = os .environ .get ("AUDITWHEEL_ARCH" )
65+ # The "cibuildwheel" tool sets AUDITWHEEL_ARCH variable to architecture strings
66+ # such as 'x86_64', 'aarch64', 'i686', etc. If this variable is not set, we
67+ # assume that the build is not a CI build and target current machine
68+ # architecture.
69+ TARGET_ARCH = os .environ .get ("AUDITWHEEL_ARCH" , platform .machine ())
70+ print ("building for target architecture:" , TARGET_ARCH )
6871
69- if HAVE_SSE42 and (TARGET_ARCH in [ None , "x86_64" ] ) and (BITS == 64 ):
72+ if HAVE_SSE42 and (TARGET_ARCH == "x86_64" ) and (BITS == 64 ):
7073 print ("enabling SSE4.2 on compile" )
7174 if SYSTEM == "nt" :
7275 CXXFLAGS .append ("/D__SSE4_2__" )
7376 else :
7477 CXXFLAGS .append ("-msse4.2" )
7578
76-
77- if HAVE_AES and (TARGET_ARCH in [None , "x86_64" ]) and (BITS == 64 ):
79+ if HAVE_AES and (TARGET_ARCH == "x86_64" ) and (BITS == 64 ):
7880 print ("enabling AES on compile" )
7981 if SYSTEM == "nt" :
8082 CXXFLAGS .append ("/D__AES__" )
@@ -104,7 +106,6 @@ def get_system_bits():
104106 CMDCLASS = {}
105107 SRC_EXT = ".cpp"
106108
107-
108109EXT_MODULES = [
109110 Extension (
110111 "metrohash" ,
@@ -116,15 +117,15 @@ def get_system_bits():
116117 ),
117118]
118119
119- VERSION = "0.3.1 "
120+ VERSION = "0.3.2 "
120121URL = "https://github.com/escherba/python-metrohash"
121122
122123
123124def get_long_description (relpath , encoding = "utf-8" ):
124125 _long_desc = """
125126
126127 """
127- fname = join (dirname (__file__ ), relpath )
128+ fname = os . path . join (os . path . dirname (__file__ ), relpath )
128129 try :
129130 with open (fname , "rb" ) as fh :
130131 return fh .read ().decode (encoding )
0 commit comments