instance_id
stringclasses
3 values
text
stringclasses
3 values
repo
stringclasses
1 value
base_commit
stringclasses
3 values
problem_statement
stringclasses
3 values
hints_text
stringclasses
1 value
created_at
stringclasses
3 values
patch
stringclasses
3 values
test_patch
stringclasses
1 value
version
stringclasses
1 value
FAIL_TO_PASS
stringclasses
1 value
PASS_TO_PASS
stringclasses
1 value
environment_setup_commit
stringclasses
1 value
numpy__numpy-13117
You will be provided with a partial code base and an issue statement explaining a problem to resolve. <issue> Imprecise docstring for np.pad Excerpt of the docstring for np.pad ``` constant_values : sequence or int, optional Used in 'constant'. The values to set the padded values for each axis. ((before_1, after_1), ... (before_N, after_N)) unique pad constants for each axis. ((before, after),) yields same before and after constants for each axis. (constant,) or int is a shortcut for before = after = constant for # <---- HERE all axes. Default is 0. end_values : sequence or int, optional Used in 'linear_ramp'. The values used for the ending value of the linear_ramp and that will form the edge of the padded array. ((before_1, after_1), ... (before_N, after_N)) unique end values for each axis. ((before, after),) yields same before and after end values for each axis. (constant,) or int is a shortcut for before = after = end value for # <---- PERHAPS TOO all axes. Default is 0. ``` Since #6026 has been fixed the first "int" should be replaced by "scalar" or "constant". Not sure about the second one. </issue> <code> [start of README.md] 1 # <img alt="NumPy" src="https://cdn.rawgit.com/numpy/numpy/master/branding/icons/numpylogo.svg" height="60"> 2 3 [![Travis](https://img.shields.io/travis/numpy/numpy/master.svg?label=Travis%20CI)]( 4 https://travis-ci.org/numpy/numpy) 5 [![AppVeyor](https://img.shields.io/appveyor/ci/charris/numpy/master.svg?label=AppVeyor)]( 6 https://ci.appveyor.com/project/charris/numpy) 7 [![Azure](https://dev.azure.com/numpy/numpy/_apis/build/status/azure-pipeline%20numpy.numpy)]( 8 https://dev.azure.com/numpy/numpy/_build/latest?definitionId=5) 9 [![codecov](https://codecov.io/gh/numpy/numpy/branch/master/graph/badge.svg)]( 10 https://codecov.io/gh/numpy/numpy) 11 12 NumPy is the fundamental package needed for scientific computing with Python. 13 14 - **Website (including documentation):** https://www.numpy.org 15 - **Mailing list:** https://mail.python.org/mailman/listinfo/numpy-discussion 16 - **Source:** https://github.com/numpy/numpy 17 - **Bug reports:** https://github.com/numpy/numpy/issues 18 - **Contributing:** https://www.numpy.org/devdocs/dev/index.html 19 20 It provides: 21 22 - a powerful N-dimensional array object 23 - sophisticated (broadcasting) functions 24 - tools for integrating C/C++ and Fortran code 25 - useful linear algebra, Fourier transform, and random number capabilities 26 27 Testing: 28 29 - NumPy versions &ge; 1.15 require `pytest` 30 - NumPy versions &lt; 1.15 require `nose` 31 32 Tests can then be run after installation with: 33 34 python -c 'import numpy; numpy.test()' 35 36 [![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org) 37 [end of README.md] </code> I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format. <patch> --- a/file.py +++ b/file.py @@ -1,27 +1,35 @@ def euclidean(a, b): - while b: - a, b = b, a % b - return a + if b == 0: + return a + return euclidean(b, a % b) def bresenham(x0, y0, x1, y1): points = [] dx = abs(x1 - x0) dy = abs(y1 - y0) - sx = 1 if x0 < x1 else -1 - sy = 1 if y0 < y1 else -1 - err = dx - dy + x, y = x0, y0 + sx = -1 if x0 > x1 else 1 + sy = -1 if y0 > y1 else 1 - while True: - points.append((x0, y0)) - if x0 == x1 and y0 == y1: - break - e2 = 2 * err - if e2 > -dy: + if dx > dy: + err = dx / 2.0 + while x != x1: + points.append((x, y)) err -= dy - x0 += sx - if e2 < dx: - err += dx - y0 += sy + if err < 0: + y += sy + err += dx + x += sx + else: + err = dy / 2.0 + while y != y1: + points.append((x, y)) + err -= dx + if err < 0: + x += sx + err += dy + y += sy + points.append((x, y)) return points </patch>
numpy/numpy
eea136ffadf75b92d8125678ce196367b1e3836c
Imprecise docstring for np.pad Excerpt of the docstring for np.pad ``` constant_values : sequence or int, optional Used in 'constant'. The values to set the padded values for each axis. ((before_1, after_1), ... (before_N, after_N)) unique pad constants for each axis. ((before, after),) yields same before and after constants for each axis. (constant,) or int is a shortcut for before = after = constant for # <---- HERE all axes. Default is 0. end_values : sequence or int, optional Used in 'linear_ramp'. The values used for the ending value of the linear_ramp and that will form the edge of the padded array. ((before_1, after_1), ... (before_N, after_N)) unique end values for each axis. ((before, after),) yields same before and after end values for each axis. (constant,) or int is a shortcut for before = after = end value for # <---- PERHAPS TOO all axes. Default is 0. ``` Since #6026 has been fixed the first "int" should be replaced by "scalar" or "constant". Not sure about the second one.
2019-03-13T23:42:20Z
<patch> diff --git a/numpy/lib/arraypad.py b/numpy/lib/arraypad.py --- a/numpy/lib/arraypad.py +++ b/numpy/lib/arraypad.py @@ -1026,31 +1026,31 @@ def pad(array, pad_width, mode, **kwargs): length for all axes. Default is ``None``, to use the entire axis. - constant_values : sequence or int, optional + constant_values : sequence or scalar, optional Used in 'constant'. The values to set the padded values for each axis. - ((before_1, after_1), ... (before_N, after_N)) unique pad constants + ``((before_1, after_1), ... (before_N, after_N))`` unique pad constants for each axis. - ((before, after),) yields same before and after constants for each + ``((before, after),)`` yields same before and after constants for each axis. - (constant,) or int is a shortcut for before = after = constant for + ``(constant,)`` or ``constant`` is a shortcut for ``before = after = constant`` for all axes. Default is 0. - end_values : sequence or int, optional + end_values : sequence or scalar, optional Used in 'linear_ramp'. The values used for the ending value of the linear_ramp and that will form the edge of the padded array. - ((before_1, after_1), ... (before_N, after_N)) unique end values + ``((before_1, after_1), ... (before_N, after_N))`` unique end values for each axis. - ((before, after),) yields same before and after end values for each + ``((before, after),)`` yields same before and after end values for each axis. - (constant,) or int is a shortcut for before = after = end value for + ``(constant,)`` or ``constant`` is a shortcut for ``before = after = constant`` for all axes. Default is 0. </patch>
[]
[]
numpy__numpy-260
You will be provided with a partial code base and an issue statement explaining a problem to resolve. <issue> Building Numpy / Scipy on AIX system (Trac #1419) _Original ticket http://projects.scipy.org/numpy/ticket/1419 on 2010-03-02 by trac user A_LARAS, assigned to unknown._ Hi,[[BR]] I wounder if somebody have success to build Numpy/Scipy on AIX system with any of the IBM compilers (XLC, XLF) or Gnu gcc, g++[[BR]] I have lot of issues make it installed on AIX 5.3, 64 bits machine[[BR]] vac 8.0[[BR]] xlf 10.1[[BR]] gcc-4.2.4-2[[BR]] AIX 5.3[[BR]] </issue> <code> [start of README.txt] 1 NumPy is the fundamental package needed for scientific computing with Python. 2 This package contains: 3 4 * a powerful N-dimensional array object 5 * sophisticated (broadcasting) functions 6 * tools for integrating C/C++ and Fortran code 7 * useful linear algebra, Fourier transform, and random number capabilities. 8 9 It derives from the old Numeric code base and can be used as a replacement for Numeric. It also adds the features introduced by numarray and can be used to replace numarray. 10 11 More information can be found at the website: 12 13 http://scipy.org/NumPy 14 15 After installation, tests can be run with: 16 17 python -c 'import numpy; numpy.test()' 18 19 When installing a new version of numpy for the first time or before upgrading 20 to a newer version, it is recommended to turn on deprecation warnings when 21 running the tests: 22 23 python -Wd -c 'import numpy; numpy.test()' 24 25 The most current development version is always available from our 26 git repository: 27 28 http://github.com/numpy/numpy 29 30 31 [end of README.txt] </code> I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format. <patch> --- a/file.py +++ b/file.py @@ -1,27 +1,35 @@ def euclidean(a, b): - while b: - a, b = b, a % b - return a + if b == 0: + return a + return euclidean(b, a % b) def bresenham(x0, y0, x1, y1): points = [] dx = abs(x1 - x0) dy = abs(y1 - y0) - sx = 1 if x0 < x1 else -1 - sy = 1 if y0 < y1 else -1 - err = dx - dy + x, y = x0, y0 + sx = -1 if x0 > x1 else 1 + sy = -1 if y0 > y1 else 1 - while True: - points.append((x0, y0)) - if x0 == x1 and y0 == y1: - break - e2 = 2 * err - if e2 > -dy: + if dx > dy: + err = dx / 2.0 + while x != x1: + points.append((x, y)) err -= dy - x0 += sx - if e2 < dx: - err += dx - y0 += sy + if err < 0: + y += sy + err += dx + x += sx + else: + err = dy / 2.0 + while y != y1: + points.append((x, y)) + err -= dx + if err < 0: + x += sx + err += dy + y += sy + points.append((x, y)) return points </patch>
numpy/numpy
addaf3e502484b18a5d91a6c625c946b20ff8dee
Building Numpy / Scipy on AIX system (Trac #1419) _Original ticket http://projects.scipy.org/numpy/ticket/1419 on 2010-03-02 by trac user A_LARAS, assigned to unknown._ Hi,[[BR]] I wounder if somebody have success to build Numpy/Scipy on AIX system with any of the IBM compilers (XLC, XLF) or Gnu gcc, g++[[BR]] I have lot of issues make it installed on AIX 5.3, 64 bits machine[[BR]] vac 8.0[[BR]] xlf 10.1[[BR]] gcc-4.2.4-2[[BR]] AIX 5.3[[BR]]
2012-04-29T23:24:33Z
<patch> diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py --- a/numpy/core/defchararray.py +++ b/numpy/core/defchararray.py @@ -1876,7 +1876,7 @@ def __array_finalize__(self, obj): def __getitem__(self, obj): val = ndarray.__getitem__(self, obj) - if issubclass(val.dtype.type, character): + if issubclass(val.dtype.type, character) and not _len(val) == 0: temp = val.rstrip() if _len(temp) == 0: val = '' diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1868,6 +1868,10 @@ def allclose(a, b, rtol=1.e-5, atol=1.e-8): `atol` are added together to compare against the absolute difference between `a` and `b`. + If either array contains one or more NaNs, False is returned. + Infs are treated as equal if they are in the same place and of the same + sign in both arrays. + Parameters ---------- a, b : array_like @@ -1881,8 +1885,7 @@ def allclose(a, b, rtol=1.e-5, atol=1.e-8): ------- y : bool Returns True if the two arrays are equal within the given - tolerance; False otherwise. If either array contains NaN, then - False is returned. + tolerance; False otherwise. See Also -------- @@ -1913,16 +1916,24 @@ def allclose(a, b, rtol=1.e-5, atol=1.e-8): """ x = array(a, copy=False, ndmin=1) y = array(b, copy=False, ndmin=1) - xinf = isinf(x) - if not all(xinf == isinf(y)): - return False - if not any(xinf): - return all(less_equal(absolute(x-y), atol + rtol * absolute(y))) - if not all(x[xinf] == y[xinf]): + + if any(isnan(x)) or any(isnan(y)): return False - x = x[~xinf] - y = y[~xinf] - return all(less_equal(absolute(x-y), atol + rtol * absolute(y))) + + xinf = isinf(x) + yinf = isinf(y) + if any(xinf) or any(yinf): + # Check that x and y have inf's only in the same positions + if not all(xinf == yinf): + return False + # Check that sign of inf's in x and y is the same + if not all(x[xinf] == y[xinf]): + return False + + x = x[~xinf] + y = y[~xinf] + + return all(less_equal(abs(x-y), atol + rtol * abs(y))) def array_equal(a1, a2): """ diff --git a/numpy/core/shape_base.py b/numpy/core/shape_base.py --- a/numpy/core/shape_base.py +++ b/numpy/core/shape_base.py @@ -199,10 +199,10 @@ def vstack(tup): concatenate : Join a sequence of arrays together. vsplit : Split array into a list of multiple sub-arrays vertically. - Notes ----- - Equivalent to ``np.concatenate(tup, axis=0)`` + Equivalent to ``np.concatenate(tup, axis=0)`` if `tup` contains arrays that + are at least 2-dimensional. Examples -------- diff --git a/numpy/lib/arraysetops.py b/numpy/lib/arraysetops.py --- a/numpy/lib/arraysetops.py +++ b/numpy/lib/arraysetops.py @@ -112,8 +112,8 @@ def unique(ar, return_index=False, return_inverse=False): unique : ndarray The sorted unique values. unique_indices : ndarray, optional - The indices of the unique values in the (flattened) original array. - Only provided if `return_index` is True. + The indices of the first occurrences of the unique values in the + (flattened) original array. Only provided if `return_index` is True. unique_inverse : ndarray, optional The indices to reconstruct the (flattened) original array from the unique array. Only provided if `return_inverse` is True. @@ -174,7 +174,10 @@ def unique(ar, return_index=False, return_inverse=False): return ar if return_inverse or return_index: - perm = ar.argsort() + if return_index: + perm = ar.argsort(kind='mergesort') + else: + perm = ar.argsort() aux = ar[perm] flag = np.concatenate(([True], aux[1:] != aux[:-1])) if return_inverse: diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -2868,14 +2868,14 @@ def median(a, axis=None, out=None, overwrite_input=False): ---------- a : array_like Input array or object that can be converted to an array. - axis : {None, int}, optional + axis : int, optional Axis along which the medians are computed. The default (axis=None) is to compute the median along a flattened version of the array. out : ndarray, optional Alternative output array in which to place the result. It must have the same shape and buffer length as the expected output, but the type (of the output) will be cast if necessary. - overwrite_input : {False, True}, optional + overwrite_input : bool optional If True, then allow use of memory of input array (a) for calculations. The input array will be modified by the call to median. This will save memory when you do not need to preserve @@ -2941,6 +2941,9 @@ def median(a, axis=None, out=None, overwrite_input=False): sorted = a else: sorted = sort(a, axis=axis) + if sorted.shape == (): + # make 0-D arrays work + return sorted.item() if axis is None: axis = 0 indexer = [slice(None)] * sorted.ndim </patch>
[]
[]
numpy__numpy-258
You will be provided with a partial code base and an issue statement explaining a problem to resolve. <issue> Error in linalg.norm() (Trac #785) _Original ticket http://projects.scipy.org/numpy/ticket/785 on 2008-05-09 by trac user nick, assigned to unknown._ While working on a unit test for linalg.norm() (see ticket #1361), I discovered that if a vector is passed into the norm() method with 'fro' as the argument for the ord, an error occurs. Example: ``` >>> from numpy import linalg >>> a = [1,2,3,4] >>> linalg.norm(a,'fro') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/tmp/lib/python2.5/site-packages/numpy/linalg/linalg.py", line 1262, in norm return ((abs(x)**ord).sum())**(1.0/ord) TypeError: unsupported operand type(s) for ** or pow(): 'numpy.ndarray' and 'str' >>> ``` Performing the same test but omiting the parameter 'fro' allows the method to execute normally. A test case that exposes this is available in ticket #1361. </issue> <code> [start of README.txt] 1 NumPy is the fundamental package needed for scientific computing with Python. 2 This package contains: 3 4 * a powerful N-dimensional array object 5 * sophisticated (broadcasting) functions 6 * tools for integrating C/C++ and Fortran code 7 * useful linear algebra, Fourier transform, and random number capabilities. 8 9 It derives from the old Numeric code base and can be used as a replacement for Numeric. It also adds the features introduced by numarray and can be used to replace numarray. 10 11 More information can be found at the website: 12 13 http://scipy.org/NumPy 14 15 After installation, tests can be run with: 16 17 python -c 'import numpy; numpy.test()' 18 19 When installing a new version of numpy for the first time or before upgrading 20 to a newer version, it is recommended to turn on deprecation warnings when 21 running the tests: 22 23 python -Wd -c 'import numpy; numpy.test()' 24 25 The most current development version is always available from our 26 git repository: 27 28 http://github.com/numpy/numpy 29 30 31 [end of README.txt] </code> I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format. <patch> --- a/file.py +++ b/file.py @@ -1,27 +1,35 @@ def euclidean(a, b): - while b: - a, b = b, a % b - return a + if b == 0: + return a + return euclidean(b, a % b) def bresenham(x0, y0, x1, y1): points = [] dx = abs(x1 - x0) dy = abs(y1 - y0) - sx = 1 if x0 < x1 else -1 - sy = 1 if y0 < y1 else -1 - err = dx - dy + x, y = x0, y0 + sx = -1 if x0 > x1 else 1 + sy = -1 if y0 > y1 else 1 - while True: - points.append((x0, y0)) - if x0 == x1 and y0 == y1: - break - e2 = 2 * err - if e2 > -dy: + if dx > dy: + err = dx / 2.0 + while x != x1: + points.append((x, y)) err -= dy - x0 += sx - if e2 < dx: - err += dx - y0 += sy + if err < 0: + y += sy + err += dx + x += sx + else: + err = dy / 2.0 + while y != y1: + points.append((x, y)) + err -= dx + if err < 0: + x += sx + err += dy + y += sy + points.append((x, y)) return points </patch>
numpy/numpy
b452014f0f9e8e6a69c6b95a62d70e3d99b9c0f9
Error in linalg.norm() (Trac #785) _Original ticket http://projects.scipy.org/numpy/ticket/785 on 2008-05-09 by trac user nick, assigned to unknown._ While working on a unit test for linalg.norm() (see ticket #1361), I discovered that if a vector is passed into the norm() method with 'fro' as the argument for the ord, an error occurs. Example: ``` >>> from numpy import linalg >>> a = [1,2,3,4] >>> linalg.norm(a,'fro') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/tmp/lib/python2.5/site-packages/numpy/linalg/linalg.py", line 1262, in norm return ((abs(x)**ord).sum())**(1.0/ord) TypeError: unsupported operand type(s) for ** or pow(): 'numpy.ndarray' and 'str' >>> ``` Performing the same test but omiting the parameter 'fro' allows the method to execute normally. A test case that exposes this is available in ticket #1361.
2012-04-22T11:18:04Z
<patch> diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py --- a/numpy/distutils/ccompiler.py +++ b/numpy/distutils/ccompiler.py @@ -58,7 +58,11 @@ def CCompiler_spawn(self, cmd, display=None): if s: if is_sequence(cmd): cmd = ' '.join(list(cmd)) - print(o) + try: + print(o) + except UnicodeError: + # When installing through pip, `o` can contain non-ascii chars + pass if re.search('Too many open files', o): msg = '\nTry rerunning setup command until build succeeds.' else: diff --git a/numpy/distutils/command/build_clib.py b/numpy/distutils/command/build_clib.py --- a/numpy/distutils/command/build_clib.py +++ b/numpy/distutils/command/build_clib.py @@ -81,21 +81,23 @@ def run(self): if self.have_f_sources(): from numpy.distutils.fcompiler import new_fcompiler - self.fcompiler = new_fcompiler(compiler=self.fcompiler, - verbose=self.verbose, - dry_run=self.dry_run, - force=self.force, - requiref90='f90' in languages, - c_compiler=self.compiler) - if self.fcompiler is not None: - self.fcompiler.customize(self.distribution) + self._f_compiler = new_fcompiler(compiler=self.fcompiler, + verbose=self.verbose, + dry_run=self.dry_run, + force=self.force, + requiref90='f90' in languages, + c_compiler=self.compiler) + if self._f_compiler is not None: + self._f_compiler.customize(self.distribution) libraries = self.libraries self.libraries = None - self.fcompiler.customize_cmd(self) + self._f_compiler.customize_cmd(self) self.libraries = libraries - self.fcompiler.show_customization() + self._f_compiler.show_customization() + else: + self._f_compiler = None self.build_libraries(self.libraries) @@ -121,7 +123,7 @@ def build_libraries(self, libraries): def build_a_library(self, build_info, lib_name, libraries): # default compilers compiler = self.compiler - fcompiler = self.fcompiler + fcompiler = self._f_compiler sources = build_info.get('sources') if sources is None or not is_sequence(sources): @@ -233,7 +235,7 @@ def build_a_library(self, build_info, lib_name, libraries): debug=self.debug, extra_postargs=extra_postargs) - if requiref90 and self.fcompiler.module_dir_switch is None: + if requiref90 and self._f_compiler.module_dir_switch is None: # move new compiled F90 module files to module_build_dir for f in glob('*.mod'): if f in existing_modules: diff --git a/numpy/distutils/fcompiler/hpux.py b/numpy/distutils/fcompiler/hpux.py --- a/numpy/distutils/fcompiler/hpux.py +++ b/numpy/distutils/fcompiler/hpux.py @@ -9,17 +9,17 @@ class HPUXFCompiler(FCompiler): version_pattern = r'HP F90 (?P<version>[^\s*,]*)' executables = { - 'version_cmd' : ["<F90>", "+version"], + 'version_cmd' : ["f90", "+version"], 'compiler_f77' : ["f90"], 'compiler_fix' : ["f90"], 'compiler_f90' : ["f90"], - 'linker_so' : None, + 'linker_so' : ["ld", "-b"], 'archiver' : ["ar", "-cr"], 'ranlib' : ["ranlib"] } module_dir_switch = None #XXX: fix me module_include_switch = None #XXX: fix me - pic_flags = ['+pic=long'] + pic_flags = ['+Z'] def get_flags(self): return self.pic_flags + ['+ppu', '+DD64'] def get_flags_opt(self): diff --git a/numpy/distutils/fcompiler/ibm.py b/numpy/distutils/fcompiler/ibm.py --- a/numpy/distutils/fcompiler/ibm.py +++ b/numpy/distutils/fcompiler/ibm.py @@ -12,7 +12,7 @@ class IBMFCompiler(FCompiler): compiler_type = 'ibm' description = 'IBM XL Fortran Compiler' - version_pattern = r'(xlf\(1\)\s*|)IBM XL Fortran ((Advanced Edition |)Version |Enterprise Edition V)(?P<version>[^\s*]*)' + version_pattern = r'(xlf\(1\)\s*|)IBM XL Fortran ((Advanced Edition |)Version |Enterprise Edition V|for AIX, V)(?P<version>[^\s*]*)' #IBM XL Fortran Enterprise Edition V10.1 for AIX \nVersion: 10.01.0000.0004 executables = { @@ -86,7 +86,7 @@ def get_flags_linker_so(self): return opt def get_flags_opt(self): - return ['-O5'] + return ['-O3'] if __name__ == '__main__': log.set_verbosity(2) diff --git a/numpy/distutils/fcompiler/pg.py b/numpy/distutils/fcompiler/pg.py --- a/numpy/distutils/fcompiler/pg.py +++ b/numpy/distutils/fcompiler/pg.py @@ -10,14 +10,14 @@ class PGroupFCompiler(FCompiler): compiler_type = 'pg' description = 'Portland Group Fortran Compiler' - version_pattern = r'\s*pg(f77|f90|hpf) (?P<version>[\d.-]+).*' + version_pattern = r'\s*pg(f77|f90|hpf|fortran) (?P<version>[\d.-]+).*' if platform == 'darwin': executables = { - 'version_cmd' : ["<F77>", "-V 2>/dev/null"], - 'compiler_f77' : ["pgf77", "-dynamiclib"], - 'compiler_fix' : ["pgf90", "-Mfixed", "-dynamiclib"], - 'compiler_f90' : ["pgf90", "-dynamiclib"], + 'version_cmd' : ["<F77>", "-V"], + 'compiler_f77' : ["pgfortran", "-dynamiclib"], + 'compiler_fix' : ["pgfortran", "-Mfixed", "-dynamiclib"], + 'compiler_f90' : ["pgfortran", "-dynamiclib"], 'linker_so' : ["libtool"], 'archiver' : ["ar", "-cr"], 'ranlib' : ["ranlib"] @@ -25,11 +25,11 @@ class PGroupFCompiler(FCompiler): pic_flags = [''] else: executables = { - 'version_cmd' : ["<F77>", "-V 2>/dev/null"], - 'compiler_f77' : ["pgf77"], - 'compiler_fix' : ["pgf90", "-Mfixed"], - 'compiler_f90' : ["pgf90"], - 'linker_so' : ["pgf90","-shared","-fpic"], + 'version_cmd' : ["<F77>", "-V"], + 'compiler_f77' : ["pgfortran"], + 'compiler_fix' : ["pgfortran", "-Mfixed"], + 'compiler_f90' : ["pgfortran"], + 'linker_so' : ["pgfortran","-shared","-fpic"], 'archiver' : ["ar", "-cr"], 'ranlib' : ["ranlib"] } diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py --- a/numpy/distutils/system_info.py +++ b/numpy/distutils/system_info.py @@ -125,6 +125,7 @@ from distutils.dist import Distribution import distutils.sysconfig from distutils import log +from distutils.util import get_platform from numpy.distutils.exec_command import \ find_executable, exec_command, get_pythonexe @@ -193,14 +194,23 @@ def libpaths(paths,bits): '/opt/local/lib','/sw/lib'], platform_bits) default_include_dirs = ['/usr/local/include', '/opt/include', '/usr/include', + # path of umfpack under macports + '/opt/local/include/ufsparse', '/opt/local/include', '/sw/include', '/usr/include/suitesparse'] default_src_dirs = ['.','/usr/local/src', '/opt/src','/sw/src'] - default_x11_lib_dirs = libpaths(['/usr/X11R6/lib','/usr/X11/lib', '/usr/lib'], platform_bits) default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include', '/usr/include'] + if os.path.exists('/usr/lib/X11'): + globbed_x11_dir = glob('/usr/lib/*/libX11.so') + if globbed_x11_dir: + x11_so_dir = os.path.split(globbed_x11_dir[0])[0] + default_x11_lib_dirs.extend([x11_so_dir, '/usr/lib/X11']) + default_x11_include_dirs.extend(['/usr/lib/X11/include', + '/usr/include/X11']) + if os.path.join(sys.prefix, 'lib') not in default_lib_dirs: default_lib_dirs.insert(0,os.path.join(sys.prefix, 'lib')) @@ -1273,7 +1283,6 @@ def get_atlas_version(**config): result = _cached_atlas_version[key] = atlas_version, info return result -from distutils.util import get_platform class lapack_opt_info(system_info): @@ -1284,7 +1293,8 @@ def calc_info(self): if sys.platform=='darwin' and not os.environ.get('ATLAS',None): args = [] link_args = [] - if get_platform()[-4:] == 'i386': + if get_platform()[-4:] == 'i386' or 'intel' in get_platform() or \ + 'i386' in platform.platform(): intel = 1 else: intel = 0 @@ -1371,7 +1381,8 @@ def calc_info(self): if sys.platform=='darwin' and not os.environ.get('ATLAS',None): args = [] link_args = [] - if get_platform()[-4:] == 'i386': + if get_platform()[-4:] == 'i386' or 'intel' in get_platform() or \ + 'i386' in platform.platform(): intel = 1 else: intel = 0 diff --git a/numpy/distutils/unixccompiler.py b/numpy/distutils/unixccompiler.py --- a/numpy/distutils/unixccompiler.py +++ b/numpy/distutils/unixccompiler.py @@ -17,6 +17,18 @@ # Note that UnixCCompiler._compile appeared in Python 2.3 def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): """Compile a single source files with a Unix-style compiler.""" + # HP ad-hoc fix, see ticket 1383 + ccomp = self.compiler_so + if ccomp[0] == 'aCC': + # remove flags that will trigger ANSI-C mode for aCC + if '-Ae' in ccomp: + ccomp.remove('-Ae') + if '-Aa' in ccomp: + ccomp.remove('-Aa') + # add flags for (almost) sane C++ handling + ccomp += ['-AA'] + self.compiler_so = ccomp + display = '%s: %s' % (os.path.basename(self.compiler_so[0]),src) try: self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -114,7 +114,12 @@ def write_version_py(filename='numpy/version.py'): GIT_REVISION = git_version() elif os.path.exists('numpy/version.py'): # must be a source distribution, use existing version file - from numpy.version import git_revision as GIT_REVISION + try: + from numpy.version import git_revision as GIT_REVISION + except ImportError: + raise ImportError("Unable to import git_revision. Try removing " \ + "numpy/version.py and the build directory " \ + "before building.") else: GIT_REVISION = "Unknown" @@ -162,6 +167,19 @@ def setup_package(): if os.path.isfile(site_cfg): shutil.copy(site_cfg, src_path) + # Ugly hack to make pip work with Python 3, see #1857. + # Explanation: pip messes with __file__ which interacts badly with the + # change in directory due to the 2to3 conversion. Therefore we restore + # __file__ to what it would have been otherwise. + global __file__ + __file__ = os.path.join(os.curdir, os.path.basename(__file__)) + if '--egg-base' in sys.argv: + # Change pip-egg-info entry to absolute path, so pip can find it + # after changing directory. + idx = sys.argv.index('--egg-base') + if sys.argv[idx + 1] == 'pip-egg-info': + sys.argv[idx + 1] = os.path.join(local_path, 'pip-egg-info') + old_path = os.getcwd() os.chdir(src_path) sys.path.insert(0, src_path) </patch>
[]
[]
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
30
Edit dataset card