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,26 +62,27 @@ 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__" )
8183 else :
8284 CXXFLAGS .append ("-maes" )
8385
84-
8586if USE_CYTHON :
8687 print ("building extension using Cython" )
8788 CMDCLASS = {"build_ext" : build_ext }
@@ -91,7 +92,6 @@ def get_system_bits():
9192 CMDCLASS = {}
9293 SRC_EXT = ".cpp"
9394
94-
9595EXT_MODULES = [
9696 Extension (
9797 "cityhash" ,
@@ -111,7 +111,7 @@ def get_system_bits():
111111 ),
112112]
113113
114- if HAVE_SSE42 and (TARGET_ARCH in [ None , "x86_64" ] ) and (BITS == 64 ):
114+ if HAVE_SSE42 and (TARGET_ARCH == "x86_64" ) and (BITS == 64 ):
115115 EXT_MODULES .append (
116116 Extension (
117117 "cityhashcrc" ,
@@ -127,15 +127,15 @@ def get_system_bits():
127127 )
128128
129129
130- VERSION = "0.4.1 "
130+ VERSION = "0.4.2 "
131131URL = "https://github.com/escherba/python-cityhash"
132132
133133
134134def get_long_description (relpath , encoding = "utf-8" ):
135135 _long_desc = """
136136
137137 """
138- fname = join (dirname (__file__ ), relpath )
138+ fname = os . path . join (os . path . dirname (__file__ ), relpath )
139139 try :
140140 with open (fname , "rb" ) as fh :
141141 return fh .read ().decode (encoding )
0 commit comments