Skip to content

Commit

Permalink
Update fix
Browse files Browse the repository at this point in the history
- Move fix to bootstrap for better compatibility
- Update int headers for later versions of Microsoft Visual C++
  • Loading branch information
bkpoon committed Nov 24, 2019
1 parent e7078e8 commit 0358c6a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 33 deletions.
6 changes: 6 additions & 0 deletions libtbx/auto_build/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,12 @@ def add_configure(self):
self.python_base, # default to using our python rather than system python
self.opjoin('..', 'modules', 'cctbx_project', 'libtbx', 'configure.py')
] + self.get_libtbx_configure() + self.config_flags
if self.isPlatformWindows() and sys.hexversion >= 0x03060000:
# new windows console in python >= 3.6 does not work with os.dup2
# https://bugs.python.org/issue30555
env = {
'PYTHONLEGACYWINDOWSSTDIO': '1'
}
self.add_step(self.shell(command=configcmd, workdir=[_BUILD_DIR],
description="run configure.py", env=env))
# Prepare saving configure.py command to file should user want to manually recompile Phenix
Expand Down
6 changes: 0 additions & 6 deletions libtbx/pkg_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,11 @@ def _silence():
'''Helper context which shuts up stdout.'''
sys.stdout.flush()
try:
if sys.platform == 'win32':
# new windows console in python >= 3.6 does not work with os.dup2
# https://bugs.python.org/issue30555
os.environ['PYTHONLEGACYWINDOWSSTDIO'] = '1'
oldstdout = os.dup(sys.stdout.fileno())
dest_file = open(os.devnull, 'w')
os.dup2(dest_file.fileno(), sys.stdout.fileno())
yield
finally:
if sys.platform == 'win32':
os.environ['PYTHONLEGACYWINDOWSSTDIO'] = ''
if oldstdout is not None:
os.dup2(oldstdout, sys.stdout.fileno())
if dest_file is not None:
Expand Down
13 changes: 3 additions & 10 deletions msvc9.0_include/inttypes.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2013 Alexander Chemeris
// Copyright (c) 2006 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
Expand All @@ -13,9 +13,8 @@
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the product nor the names of its contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
Expand All @@ -34,10 +33,6 @@
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]

#if _MSC_VER <= 1800



#ifndef _MSC_INTTYPES_H_ // [
#define _MSC_INTTYPES_H_

Expand Down Expand Up @@ -308,5 +303,3 @@ imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)


#endif // _MSC_INTTYPES_H_ ]

#endif // _MSC_VER <= 1800
22 changes: 5 additions & 17 deletions msvc9.0_include/stdint.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2013 Alexander Chemeris
// Copyright (c) 2006-2008 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
Expand All @@ -13,9 +13,8 @@
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the product nor the names of its contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
Expand All @@ -41,10 +40,6 @@
#pragma once
#endif

#if _MSC_VER > 1800 // [
#include <stdint.h>
#else // ] _MSC_VER > 1800 [

#include <limits.h>

// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
Expand Down Expand Up @@ -243,17 +238,10 @@ typedef uint64_t uintmax_t;
#define UINT64_C(val) val##ui64

// 7.18.4.2 Macros for greatest-width integer constants
// These #ifndef's are needed to prevent collisions with <boost/cstdint.hpp>.
// Check out Issue 9 for the details.
#ifndef INTMAX_C // [
# define INTMAX_C INT64_C
#endif // INTMAX_C ]
#ifndef UINTMAX_C // [
# define UINTMAX_C UINT64_C
#endif // UINTMAX_C ]
#define INTMAX_C INT64_C
#define UINTMAX_C UINT64_C

#endif // __STDC_CONSTANT_MACROS ]

#endif // _MSC_VER > 1800 ]

#endif // _MSC_STDINT_H_ ]

0 comments on commit 0358c6a

Please sign in to comment.