Skip to content

Instantly share code, notes, and snippets.

@dhermes
Last active September 26, 2017 00:24
Show Gist options
  • Save dhermes/e7aa8cbf8c2f38eca0f899752c6022ca to your computer and use it in GitHub Desktop.
Save dhermes/e7aa8cbf8c2f38eca0f899752c6022ca to your computer and use it in GitHub Desktop.
import sys
def real_prefix():
return getattr(sys, 'real_prefix', sys.prefix)
def main():
# See: https://docs.python.org/3/library/platform.html#cross-platform
if sys.maxsize == 2**63 - 1:
print('Architecture: 64-bit')
elif sys.maxsize == 2**31 - 1:
print('Architecture: 32-bit')
else:
raise RuntimeError('Unexpected maxsize', sys.maxsize)
print(' Prefix: {}'.format(sys.prefix))
print(' Real prefix: {}'.format(real_prefix()))
if __name__ == '__main__':
main()
import sys
import nox
IS_MAC_OS_X = sys.platform == 'darwin'
# See: https://docs.python.org/3/library/platform.html#cross-platform
if sys.maxsize == 2**63 - 1:
IS_64_BIT = True
elif sys.maxsize == 2**31 - 1:
IS_64_BIT = False
else:
raise RuntimeError('Unexpected maxsize', sys.maxsize)
@nox.session
@nox.parametrize('do_hack', [True, False])
def check(session, do_hack):
session.interpreter = (
'/Library/Frameworks/Python.framework/Versions/3.6/bin/python')
cmd = ('python', 'check.py')
if do_hack and IS_MAC_OS_X:
if IS_64_BIT:
cmd = ('arch', '-64') + cmd
else:
cmd = ('arch', '-32') + cmd
session.run(*cmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment