diff --git "a/partition_9.json" "b/partition_9.json" new file mode 100644--- /dev/null +++ "b/partition_9.json" @@ -0,0 +1,51019 @@ +[ + { + "hash": "c3a596e6fac543df144c46b0b99738177b241f9e", + "msg": "Removing obsolete scipy_test", + "author": { + "name": "Pearu Peterson", + "email": "pearu.peterson@gmail.com" + }, + "committer": { + "name": "Pearu Peterson", + "email": "pearu.peterson@gmail.com" + }, + "author_date": "2002-04-07T15:14:07+00:00", + "author_timezone": 0, + "committer_date": "2002-04-07T15:14:07+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "d7c565a17f40072c37ac746e46fae0e9d493731d" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 380, + "insertions": 0, + "lines": 380, + "files": 4, + "dmm_unit_size": 0.38596491228070173, + "dmm_unit_complexity": 0.2149122807017544, + "dmm_unit_interfacing": 0.6008771929824561, + "modified_files": [ + { + "old_path": "scipy_test/__init__.py", + "new_path": null, + "filename": "__init__.py", + "extension": "py", + "change_type": "DELETE", + "diff": "@@ -1 +0,0 @@\n-from scipy_test import *\n", + "added_lines": 0, + "deleted_lines": 1, + "source_code": null, + "source_code_before": "from scipy_test import *\n", + "methods": [], + "methods_before": [], + "changed_methods": [], + "nloc": null, + "complexity": null, + "token_count": null, + "diff_parsed": { + "added": [], + "deleted": [ + "from scipy_test import *" + ] + } + }, + { + "old_path": "scipy_test/scipy_test.py", + "new_path": null, + "filename": "scipy_test.py", + "extension": "py", + "change_type": "DELETE", + "diff": "@@ -1,334 +0,0 @@\n-\n-import os,sys,time\n-import unittest\n-\n-class ScipyTestCase (unittest.TestCase):\n-\n- def measure(self,code_str,times=1):\n- frame = sys._getframe(1)\n- locs,globs = frame.f_locals,frame.f_globals\n- code = compile(code_str,\n- 'ScipyTestCase runner for '+self.__class__.__name__,\n- 'exec')\n- i = 0\n- elapsed = time.time()\n- while i BSD license conversion", + "author": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "committer": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "author_date": "2002-04-07T22:19:56+00:00", + "author_timezone": 0, + "committer_date": "2002-04-07T22:19:56+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "17273e91cc84b6e9a38d0df7d4dcee1de46ecbd8" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 5, + "insertions": 11, + "lines": 16, + "files": 2, + "dmm_unit_size": null, + "dmm_unit_complexity": null, + "dmm_unit_interfacing": null, + "modified_files": [ + { + "old_path": "scipy_distutils/command/cpuinfo.py", + "new_path": "scipy_distutils/command/cpuinfo.py", + "filename": "cpuinfo.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -2,10 +2,11 @@\n \"\"\"\n cpuinfo\n \n-Copyright 2001 Pearu Peterson all rights reserved,\n+Copyright 2002 Pearu Peterson all rights reserved,\n Pearu Peterson \n-Permission to use, modify, and distribute this software is given under the\n-terms of the LGPL. See http://www.fsf.org\n+Permission to use, modify, and distribute this software is given under the \n+terms of the SciPy (BSD style) license. See LICENSE.txt that came with\n+this distribution for specifics.\n \n Note: This should be merged into proc at some point. Perhaps proc should\n be returning classes like this instead of using dictionaries.\n", + "added_lines": 4, + "deleted_lines": 3, + "source_code": "#!/usr/bin/env python\n\"\"\"\ncpuinfo\n\nCopyright 2002 Pearu Peterson all rights reserved,\nPearu Peterson \nPermission to use, modify, and distribute this software is given under the \nterms of the SciPy (BSD style) license. See LICENSE.txt that came with\nthis distribution for specifics.\n\nNote: This should be merged into proc at some point. Perhaps proc should\nbe returning classes like this instead of using dictionaries.\n\nNO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n$Revision$\n$Date$\nPearu Peterson\n\"\"\"\n\n__version__ = \"$Id$\"\n\n__all__ = ['cpuinfo']\n\nimport sys,string,re,types\n\nclass cpuinfo_base:\n \"\"\"Holds CPU information and provides methods for requiring\n the availability of various CPU features.\n \"\"\"\n\n def _try_call(self,func):\n try:\n return func()\n except:\n pass\n\n def __getattr__(self,name):\n if name[0]!='_':\n if hasattr(self,'_'+name):\n attr = getattr(self,'_'+name)\n if type(attr) is types.MethodType:\n return lambda func=self._try_call,attr=attr : func(attr)\n else:\n return lambda : None\n raise AttributeError,name \n\n\nclass linux_cpuinfo(cpuinfo_base):\n\n info = None\n \n def __init__(self):\n if self.info is not None:\n return\n info = []\n try:\n for line in open('/proc/cpuinfo').readlines():\n name_value = map(string.strip,string.split(line,':',1))\n if len(name_value)!=2:\n continue\n name,value = name_value\n if not info or info[-1].has_key(name): # next processor\n info.append({})\n info[-1][name] = value\n except:\n print sys.exc_value,'(ignoring)'\n self.__class__.info = info\n\n def _not_impl(self): pass\n\n # Athlon\n\n def _is_AMD(self):\n return self.info[0]['vendor_id']=='AuthenticAMD'\n\n def _is_AthlonK6(self):\n return re.match(r'.*?AMD-K6',self.info[0]['model name']) is not None\n\n def _is_AthlonK7(self):\n return re.match(r'.*?AMD-K7',self.info[0]['model name']) is not None\n\n # Alpha\n\n def _is_Alpha(self):\n return self.info[0]['cpu']=='Alpha'\n\n def _is_EV4(self):\n return self.is_Alpha() and self.info[0]['cpu model'] == 'EV4'\n\n def _is_EV5(self):\n return self.is_Alpha() and self.info[0]['cpu model'] == 'EV5'\n\n def _is_EV56(self):\n return self.is_Alpha() and self.info[0]['cpu model'] == 'EV56'\n\n def _is_PCA56(self):\n return self.is_Alpha() and self.info[0]['cpu model'] == 'PCA56'\n\n # Intel\n\n #XXX\n _is_i386 = _not_impl\n\n def _is_Intel(self):\n return self.info[0]['vendor_id']=='GenuineIntel'\n\n def _is_i486(self):\n return self.info[0]['cpu']=='i486'\n\n def _is_i586(self):\n return self.is_Intel() and self.info[0]['cpu family'] == '5'\n\n def _is_i686(self):\n return self.is_Intel() and self.info[0]['cpu family'] == '6'\n\n def _is_Celeron(self):\n return re.match(r'.*?Celeron',\n self.info[0]['model name']) is not None\n\n #XXX\n _is_Pentium = _is_PentiumPro = _is_PentiumIII = _is_PentiumIV = _not_impl\n\n def _is_PentiumII(self):\n return re.match(r'.*?Pentium II\\b',\n self.info[0]['model name']) is not None\n\n # Varia\n\n def _is_singleCPU(self):\n return len(self.info) == 1\n\n def _has_fdiv_bug(self):\n return self.info[0]['fdiv_bug']=='yes'\n\n def _has_f00f_bug(self):\n return self.info[0]['f00f_bug']=='yes'\n\n def _has_mmx(self):\n return re.match(r'.*?\\bmmx',self.info[0]['flags']) is not None\n\nif sys.platform[:5] == 'linux': # variations: linux2,linux-i386 (any others?)\n cpuinfo = linux_cpuinfo\n#XXX: other OS's. Eg. use _winreg on Win32. Or os.uname on unices.\nelse:\n cpuinfo = cpuinfo_base\n\n\n\"\"\"\nlaptop:\n[{'cache size': '256 KB', 'cpu MHz': '399.129', 'processor': '0', 'fdiv_bug': 'no', 'coma_bug': 'no', 'model': '6', 'cpuid level': '2', 'model name': 'Mobile Pentium II', 'fpu_exception': 'yes', 'hlt_bug': 'no', 'bogomips': '796.26', 'vendor_id': 'GenuineIntel', 'fpu': 'yes', 'wp': 'yes', 'cpu family': '6', 'f00f_bug': 'no', 'stepping': '13', 'flags': 'fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr'}]\n\nkev:\n[{'cache size': '512 KB', 'cpu MHz': '350.799', 'processor': '0', 'fdiv_bug': 'no', 'coma_bug': 'no', 'model': '5', 'cpuid level': '2', 'model name': 'Pentium II (Deschutes)', 'fpu_exception': 'yes', 'hlt_bug': 'no', 'bogomips': '699.59', 'vendor_id': 'GenuineIntel', 'fpu': 'yes', 'wp': 'yes', 'cpu family': '6', 'f00f_bug': 'no', 'stepping': '3', 'flags': 'fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr'}, {'cache size': '512 KB', 'cpu MHz': '350.799', 'processor': '1', 'fdiv_bug': 'no', 'coma_bug': 'no', 'model': '5', 'cpuid level': '2', 'model name': 'Pentium II (Deschutes)', 'fpu_exception': 'yes', 'hlt_bug': 'no', 'bogomips': '701.23', 'vendor_id': 'GenuineIntel', 'fpu': 'yes', 'wp': 'yes', 'cpu family': '6', 'f00f_bug': 'no', 'stepping': '3', 'flags': 'fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr'}]\n\nath:\n[{'cache size': '512 KB', 'cpu MHz': '503.542', 'processor': '0', 'fdiv_bug': 'no', 'coma_bug': 'no', 'model': '1', 'cpuid level': '1', 'model name': 'AMD-K7(tm) Processor', 'fpu_exception': 'yes', 'hlt_bug': 'no', 'bogomips': '1002.70', 'vendor_id': 'AuthenticAMD', 'fpu': 'yes', 'wp': 'yes', 'cpu family': '6', 'f00f_bug': 'no', 'stepping': '2', 'flags': 'fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat mmx syscall mmxext 3dnowext 3dnow'}]\n\nfiasco:\n[{'max. addr. space #': '127', 'cpu': 'Alpha', 'cpu serial number': 'Linux_is_Great!', 'kernel unaligned acc': '0 (pc=0,va=0)', 'system revision': '0', 'system variation': 'LX164', 'cycle frequency [Hz]': '533185472', 'system serial number': 'MILO-2.0.35-c5.', 'timer frequency [Hz]': '1024.00', 'cpu model': 'EV56', 'platform string': 'N/A', 'cpu revision': '0', 'BogoMIPS': '530.57', 'cpus detected': '0', 'phys. address bits': '40', 'user unaligned acc': '1340 (pc=2000000ec90,va=20001156da4)', 'page size [bytes]': '8192', 'system type': 'EB164', 'cpu variation': '0'}]\n\"\"\"\n\nif __name__ == \"__main__\":\n cpu = cpuinfo()\n\n cpu.is_blaa()\n cpu.is_Intel()\n cpu.is_Alpha()\n\n print 'CPU information:',\n for name in dir(cpuinfo):\n if name[0]=='_' and name[1]!='_' and getattr(cpu,name[1:])():\n print name[1:],\n print\n", + "source_code_before": "#!/usr/bin/env python\n\"\"\"\ncpuinfo\n\nCopyright 2001 Pearu Peterson all rights reserved,\nPearu Peterson \nPermission to use, modify, and distribute this software is given under the\nterms of the LGPL. See http://www.fsf.org\n\nNote: This should be merged into proc at some point. Perhaps proc should\nbe returning classes like this instead of using dictionaries.\n\nNO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n$Revision$\n$Date$\nPearu Peterson\n\"\"\"\n\n__version__ = \"$Id$\"\n\n__all__ = ['cpuinfo']\n\nimport sys,string,re,types\n\nclass cpuinfo_base:\n \"\"\"Holds CPU information and provides methods for requiring\n the availability of various CPU features.\n \"\"\"\n\n def _try_call(self,func):\n try:\n return func()\n except:\n pass\n\n def __getattr__(self,name):\n if name[0]!='_':\n if hasattr(self,'_'+name):\n attr = getattr(self,'_'+name)\n if type(attr) is types.MethodType:\n return lambda func=self._try_call,attr=attr : func(attr)\n else:\n return lambda : None\n raise AttributeError,name \n\n\nclass linux_cpuinfo(cpuinfo_base):\n\n info = None\n \n def __init__(self):\n if self.info is not None:\n return\n info = []\n try:\n for line in open('/proc/cpuinfo').readlines():\n name_value = map(string.strip,string.split(line,':',1))\n if len(name_value)!=2:\n continue\n name,value = name_value\n if not info or info[-1].has_key(name): # next processor\n info.append({})\n info[-1][name] = value\n except:\n print sys.exc_value,'(ignoring)'\n self.__class__.info = info\n\n def _not_impl(self): pass\n\n # Athlon\n\n def _is_AMD(self):\n return self.info[0]['vendor_id']=='AuthenticAMD'\n\n def _is_AthlonK6(self):\n return re.match(r'.*?AMD-K6',self.info[0]['model name']) is not None\n\n def _is_AthlonK7(self):\n return re.match(r'.*?AMD-K7',self.info[0]['model name']) is not None\n\n # Alpha\n\n def _is_Alpha(self):\n return self.info[0]['cpu']=='Alpha'\n\n def _is_EV4(self):\n return self.is_Alpha() and self.info[0]['cpu model'] == 'EV4'\n\n def _is_EV5(self):\n return self.is_Alpha() and self.info[0]['cpu model'] == 'EV5'\n\n def _is_EV56(self):\n return self.is_Alpha() and self.info[0]['cpu model'] == 'EV56'\n\n def _is_PCA56(self):\n return self.is_Alpha() and self.info[0]['cpu model'] == 'PCA56'\n\n # Intel\n\n #XXX\n _is_i386 = _not_impl\n\n def _is_Intel(self):\n return self.info[0]['vendor_id']=='GenuineIntel'\n\n def _is_i486(self):\n return self.info[0]['cpu']=='i486'\n\n def _is_i586(self):\n return self.is_Intel() and self.info[0]['cpu family'] == '5'\n\n def _is_i686(self):\n return self.is_Intel() and self.info[0]['cpu family'] == '6'\n\n def _is_Celeron(self):\n return re.match(r'.*?Celeron',\n self.info[0]['model name']) is not None\n\n #XXX\n _is_Pentium = _is_PentiumPro = _is_PentiumIII = _is_PentiumIV = _not_impl\n\n def _is_PentiumII(self):\n return re.match(r'.*?Pentium II\\b',\n self.info[0]['model name']) is not None\n\n # Varia\n\n def _is_singleCPU(self):\n return len(self.info) == 1\n\n def _has_fdiv_bug(self):\n return self.info[0]['fdiv_bug']=='yes'\n\n def _has_f00f_bug(self):\n return self.info[0]['f00f_bug']=='yes'\n\n def _has_mmx(self):\n return re.match(r'.*?\\bmmx',self.info[0]['flags']) is not None\n\nif sys.platform[:5] == 'linux': # variations: linux2,linux-i386 (any others?)\n cpuinfo = linux_cpuinfo\n#XXX: other OS's. Eg. use _winreg on Win32. Or os.uname on unices.\nelse:\n cpuinfo = cpuinfo_base\n\n\n\"\"\"\nlaptop:\n[{'cache size': '256 KB', 'cpu MHz': '399.129', 'processor': '0', 'fdiv_bug': 'no', 'coma_bug': 'no', 'model': '6', 'cpuid level': '2', 'model name': 'Mobile Pentium II', 'fpu_exception': 'yes', 'hlt_bug': 'no', 'bogomips': '796.26', 'vendor_id': 'GenuineIntel', 'fpu': 'yes', 'wp': 'yes', 'cpu family': '6', 'f00f_bug': 'no', 'stepping': '13', 'flags': 'fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr'}]\n\nkev:\n[{'cache size': '512 KB', 'cpu MHz': '350.799', 'processor': '0', 'fdiv_bug': 'no', 'coma_bug': 'no', 'model': '5', 'cpuid level': '2', 'model name': 'Pentium II (Deschutes)', 'fpu_exception': 'yes', 'hlt_bug': 'no', 'bogomips': '699.59', 'vendor_id': 'GenuineIntel', 'fpu': 'yes', 'wp': 'yes', 'cpu family': '6', 'f00f_bug': 'no', 'stepping': '3', 'flags': 'fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr'}, {'cache size': '512 KB', 'cpu MHz': '350.799', 'processor': '1', 'fdiv_bug': 'no', 'coma_bug': 'no', 'model': '5', 'cpuid level': '2', 'model name': 'Pentium II (Deschutes)', 'fpu_exception': 'yes', 'hlt_bug': 'no', 'bogomips': '701.23', 'vendor_id': 'GenuineIntel', 'fpu': 'yes', 'wp': 'yes', 'cpu family': '6', 'f00f_bug': 'no', 'stepping': '3', 'flags': 'fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr'}]\n\nath:\n[{'cache size': '512 KB', 'cpu MHz': '503.542', 'processor': '0', 'fdiv_bug': 'no', 'coma_bug': 'no', 'model': '1', 'cpuid level': '1', 'model name': 'AMD-K7(tm) Processor', 'fpu_exception': 'yes', 'hlt_bug': 'no', 'bogomips': '1002.70', 'vendor_id': 'AuthenticAMD', 'fpu': 'yes', 'wp': 'yes', 'cpu family': '6', 'f00f_bug': 'no', 'stepping': '2', 'flags': 'fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat mmx syscall mmxext 3dnowext 3dnow'}]\n\nfiasco:\n[{'max. addr. space #': '127', 'cpu': 'Alpha', 'cpu serial number': 'Linux_is_Great!', 'kernel unaligned acc': '0 (pc=0,va=0)', 'system revision': '0', 'system variation': 'LX164', 'cycle frequency [Hz]': '533185472', 'system serial number': 'MILO-2.0.35-c5.', 'timer frequency [Hz]': '1024.00', 'cpu model': 'EV56', 'platform string': 'N/A', 'cpu revision': '0', 'BogoMIPS': '530.57', 'cpus detected': '0', 'phys. address bits': '40', 'user unaligned acc': '1340 (pc=2000000ec90,va=20001156da4)', 'page size [bytes]': '8192', 'system type': 'EB164', 'cpu variation': '0'}]\n\"\"\"\n\nif __name__ == \"__main__\":\n cpu = cpuinfo()\n\n cpu.is_blaa()\n cpu.is_Intel()\n cpu.is_Alpha()\n\n print 'CPU information:',\n for name in dir(cpuinfo):\n if name[0]=='_' and name[1]!='_' and getattr(cpu,name[1:])():\n print name[1:],\n print\n", + "methods": [ + { + "name": "_try_call", + "long_name": "_try_call( self , func )", + "filename": "cpuinfo.py", + "nloc": 5, + "complexity": 2, + "token_count": 16, + "parameters": [ + "self", + "func" + ], + "start_line": 31, + "end_line": 35, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__getattr__", + "long_name": "__getattr__( self , name )", + "filename": "cpuinfo.py", + "nloc": 9, + "complexity": 4, + "token_count": 71, + "parameters": [ + "self", + "name" + ], + "start_line": 37, + "end_line": 45, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "cpuinfo.py", + "nloc": 16, + "complexity": 7, + "token_count": 112, + "parameters": [ + "self" + ], + "start_line": 52, + "end_line": 67, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "_is_AMD", + "long_name": "_is_AMD( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 73, + "end_line": 74, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_AthlonK6", + "long_name": "_is_AthlonK6( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 76, + "end_line": 77, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_AthlonK7", + "long_name": "_is_AthlonK7( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 79, + "end_line": 80, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_Alpha", + "long_name": "_is_Alpha( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 84, + "end_line": 85, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_EV4", + "long_name": "_is_EV4( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 87, + "end_line": 88, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_EV5", + "long_name": "_is_EV5( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 90, + "end_line": 91, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_EV56", + "long_name": "_is_EV56( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 93, + "end_line": 94, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_PCA56", + "long_name": "_is_PCA56( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 96, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_Intel", + "long_name": "_is_Intel( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 104, + "end_line": 105, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_i486", + "long_name": "_is_i486( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 107, + "end_line": 108, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_i586", + "long_name": "_is_i586( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 110, + "end_line": 111, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_i686", + "long_name": "_is_i686( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 113, + "end_line": 114, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_Celeron", + "long_name": "_is_Celeron( self )", + "filename": "cpuinfo.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 116, + "end_line": 118, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_is_PentiumII", + "long_name": "_is_PentiumII( self )", + "filename": "cpuinfo.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 123, + "end_line": 125, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_is_singleCPU", + "long_name": "_is_singleCPU( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 14, + "parameters": [ + "self" + ], + "start_line": 129, + "end_line": 130, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_has_fdiv_bug", + "long_name": "_has_fdiv_bug( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 132, + "end_line": 133, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_has_f00f_bug", + "long_name": "_has_f00f_bug( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 135, + "end_line": 136, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_has_mmx", + "long_name": "_has_mmx( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 138, + "end_line": 139, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + } + ], + "methods_before": [ + { + "name": "_try_call", + "long_name": "_try_call( self , func )", + "filename": "cpuinfo.py", + "nloc": 5, + "complexity": 2, + "token_count": 16, + "parameters": [ + "self", + "func" + ], + "start_line": 30, + "end_line": 34, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__getattr__", + "long_name": "__getattr__( self , name )", + "filename": "cpuinfo.py", + "nloc": 9, + "complexity": 4, + "token_count": 71, + "parameters": [ + "self", + "name" + ], + "start_line": 36, + "end_line": 44, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "cpuinfo.py", + "nloc": 16, + "complexity": 7, + "token_count": 112, + "parameters": [ + "self" + ], + "start_line": 51, + "end_line": 66, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "_is_AMD", + "long_name": "_is_AMD( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 72, + "end_line": 73, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_AthlonK6", + "long_name": "_is_AthlonK6( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 75, + "end_line": 76, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_AthlonK7", + "long_name": "_is_AthlonK7( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 78, + "end_line": 79, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_Alpha", + "long_name": "_is_Alpha( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 83, + "end_line": 84, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_EV4", + "long_name": "_is_EV4( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 86, + "end_line": 87, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_EV5", + "long_name": "_is_EV5( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 89, + "end_line": 90, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_EV56", + "long_name": "_is_EV56( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 92, + "end_line": 93, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_PCA56", + "long_name": "_is_PCA56( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 95, + "end_line": 96, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_Intel", + "long_name": "_is_Intel( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 103, + "end_line": 104, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_i486", + "long_name": "_is_i486( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 106, + "end_line": 107, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_i586", + "long_name": "_is_i586( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 109, + "end_line": 110, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_i686", + "long_name": "_is_i686( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 112, + "end_line": 113, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_is_Celeron", + "long_name": "_is_Celeron( self )", + "filename": "cpuinfo.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 115, + "end_line": 117, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_is_PentiumII", + "long_name": "_is_PentiumII( self )", + "filename": "cpuinfo.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 122, + "end_line": 124, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_is_singleCPU", + "long_name": "_is_singleCPU( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 14, + "parameters": [ + "self" + ], + "start_line": 128, + "end_line": 129, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_has_fdiv_bug", + "long_name": "_has_fdiv_bug( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 131, + "end_line": 132, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_has_f00f_bug", + "long_name": "_has_f00f_bug( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 134, + "end_line": 135, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_has_mmx", + "long_name": "_has_mmx( self )", + "filename": "cpuinfo.py", + "nloc": 2, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 137, + "end_line": 138, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + } + ], + "changed_methods": [], + "nloc": 124, + "complexity": 37, + "token_count": 745, + "diff_parsed": { + "added": [ + "Copyright 2002 Pearu Peterson all rights reserved,", + "Permission to use, modify, and distribute this software is given under the", + "terms of the SciPy (BSD style) license. See LICENSE.txt that came with", + "this distribution for specifics." + ], + "deleted": [ + "Copyright 2001 Pearu Peterson all rights reserved,", + "Permission to use, modify, and distribute this software is given under the", + "terms of the LGPL. See http://www.fsf.org" + ] + } + }, + { + "old_path": "scipy_distutils/system_info.py", + "new_path": "scipy_distutils/system_info.py", + "filename": "system_info.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -54,8 +54,13 @@\n Authors:\n Pearu Peterson , February 2002\n David M. Cooke , April 2002\n-Permission to use, modify, and distribute this software is given under the\n-terms of the LGPL. See http://www.fsf.org\n+\n+Copyright 2002 Pearu Peterson all rights reserved,\n+Pearu Peterson \n+Permission to use, modify, and distribute this software is given under the \n+terms of the SciPy (BSD style) license. See LICENSE.txt that came with\n+this distribution for specifics.\n+\n NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n \"\"\"\n \n", + "added_lines": 7, + "deleted_lines": 2, + "source_code": "#!/usr/bin/env python\n\"\"\"\nThis file defines a set of system_info classes for getting\ninformation about various resources (libraries, library directories,\ninclude directories, etc.) in the system. Currently, the following\nclasses are available:\n atlas_info\n fftw_info\n x11_info\n\nUsage:\n info_dict = get_info()\n where is a string 'atlas','x11','fftw'.\n\n Returned info_dict is a dictionary which is compatible with\n distutils.setup keyword arguments. If info_dict == {}, then the\n asked resource is not available (or system_info could not find it).\n\nGlobal parameters:\n system_info.static_first - a flag for indicating that static\n libraries are searched first than shared ones.\n system_info.verbose - show the results if set.\n\nThe file 'site.cfg' in the same directory as this module is read\nfor configuration options. The format is that used by ConfigParser (i.e.,\nWindows .INI style). The section DEFAULT has options that are the default\nfor each section. The available sections are fftw, atlas, and x11. Appropiate\ndefaults are used if nothing is specified.\n\nExample:\n----------\n[DEFAULT]\nlib_dir = /usr/lib:/usr/local/lib:/opt/lib\ninclude_dir = /usr/include:/usr/local/include:/opt/include\n# use static libraries in preference to shared ones\nstatic_first = 1\n\n[fftw]\nfftw_libs = fftw, rfftw\nfftw_opt_libs = fftw_threaded, rfftw_threaded\n# if the above aren't found, look for {s,d}fftw_libs and {s,d}fftw_opt_libs\n\n[atlas]\nlib_dir = /usr/lib/3dnow:/usr/lib/3dnow/atlas\n# for overriding the names of the atlas libraries\natlas_libs = f77blas, cblas, atlas\nlapack_libs = lapack\n\n[x11]\nlib_dir = /usr/X11R6/lib\ninclude_dir = /usr/X11R6/include\n----------\n\nAuthors:\n Pearu Peterson , February 2002\n David M. Cooke , April 2002\n\nCopyright 2002 Pearu Peterson all rights reserved,\nPearu Peterson \nPermission to use, modify, and distribute this software is given under the \nterms of the SciPy (BSD style) license. See LICENSE.txt that came with\nthis distribution for specifics.\n\nNO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n\"\"\"\n\nimport sys,os,re,types\nfrom distutils.errors import DistutilsError\nfrom glob import glob\nimport ConfigParser\n\nfrom distutils.sysconfig import get_config_vars\n\nif sys.platform == 'win32':\n default_lib_dirs = ['C:\\\\'] # probably not very helpful...\n default_include_dirs = []\n default_x11_lib_dirs = []\n default_x11_include_dirs = []\nelse:\n default_lib_dirs = ['/usr/local/lib', '/opt/lib', '/usr/lib']\n default_include_dirs = ['/usr/local/include',\n '/opt/include', '/usr/include']\n default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib']\n default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include']\n\nif os.path.join(sys.prefix, 'lib') not in default_lib_dirs:\n default_lib_dirs.append(os.path.join(sys.prefix, 'lib'))\n default_include_dirs.append(os.path.join(sys.prefix, 'include'))\ndefault_lib_dirs = filter(os.path.isdir, default_lib_dirs)\ndefault_include_dirs = filter(os.path.isdir, default_include_dirs)\n\nso_ext = get_config_vars('SO')[0] or ''\n\ndef get_info(name):\n cl = {'atlas':atlas_info,\n 'x11':x11_info,\n 'fftw':fftw_info}.get(name.lower(),system_info)\n return cl().get_info()\n\nclass NotFoundError(DistutilsError):\n \"\"\"Some third-party program or library is not found.\"\"\"\n\nclass AtlasNotFoundError(NotFoundError):\n \"\"\"\n Atlas (http://math-atlas.sourceforge.net/) libraries not found.\n Either install them in /usr/local/lib/atlas or /usr/lib/atlas\n and retry setup.py. One can use also ATLAS environment variable\n to indicate the location of Atlas libraries.\"\"\"\n\nclass FFTWNotFoundError(NotFoundError):\n \"\"\"\n FFTW (http://www.fftw.org/) libraries not found.\n Either install them in /usr/local/lib or /usr/lib and retry setup.py.\n One can use also FFTW environment variable to indicate\n the location of FFTW libraries.\"\"\"\n\nclass F2pyNotFoundError(NotFoundError):\n \"\"\"\n f2py2e (http://cens.ioc.ee/projects/f2py2e/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass NumericNotFoundError(NotFoundError):\n \"\"\"\n Numeric (http://www.numpy.org/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass X11NotFoundError(NotFoundError):\n \"\"\"X11 libraries not found.\"\"\"\n\nclass system_info:\n\n \"\"\" get_info() is the only public method. Don't use others.\n \"\"\"\n section = 'DEFAULT'\n\n static_first = 1\n verbose = 1\n need_refresh = 1\n saved_results = {}\n\n def __init__ (self,\n default_lib_dirs=default_lib_dirs,\n default_include_dirs=default_include_dirs,\n ):\n self.__class__.info = {}\n self.local_prefixes = []\n defaults = {}\n defaults['lib_dir'] = os.pathsep.join(default_lib_dirs)\n defaults['include_dir'] = os.pathsep.join(default_include_dirs)\n defaults['static_first'] = '1'\n self.cp = ConfigParser.ConfigParser(defaults)\n cf = os.path.join(os.path.split(os.path.abspath(__file__))[0],\n 'site.cfg')\n self.cp.read([cf])\n if not self.cp.has_section(self.section):\n self.cp.add_section(self.section)\n self.static_first = self.cp.getboolean(self.section, 'static_first')\n\n def set_info(self,**info):\n self.saved_results[self.__class__.__name__] = info\n def has_info(self):\n return self.saved_results.has_key(self.__class__.__name__)\n def get_info(self):\n \"\"\" Return a dictonary with items that are compatible\n with scipy_distutils.setup keyword arguments.\n \"\"\"\n flag = 0\n if not self.has_info():\n flag = 1\n if self.verbose:\n print self.__class__.__name__ + ':'\n if hasattr(self, 'calc_info'):\n self.calc_info()\n if self.verbose:\n if not self.has_info():\n print ' NOT AVAILABLE'\n self.set_info()\n else:\n print ' FOUND:'\n res = self.saved_results.get(self.__class__.__name__)\n if self.verbose and flag:\n for k,v in res.items():\n print ' %s = %s'%(k,v)\n print\n return res\n\n def calc_info_template(self,prefix):\n \"\"\" Calculate info dictionary. \"\"\"\n\n def get_paths(self, section, key):\n dirs = self.cp.get(section, key).split(os.pathsep)\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs.extend(default_dirs)\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def get_lib_dirs(self, key='lib_dir'):\n return self.get_paths(self.section, key)\n def get_include_dirs(self, key='include_dir'):\n return self.get_paths(self.section, key)\n\n def get_libs(self, key, default):\n try:\n libs = self.cp.get(self.section, key)\n except ConfigParser.NoOptionError:\n return default\n return [a.strip() for a in libs.split(',')]\n\n def check_libs(self,lib_dir,libs,opt_libs =[]):\n \"\"\" If static or shared libraries are available then return\n their info dictionary. \"\"\"\n mths = [self.check_static_libs,self.check_shared_libs]\n if not self.static_first:\n mths.reverse() # if one prefers shared libraries\n for m in mths:\n info = m(lib_dir,libs,opt_libs)\n if info is not None: return info\n\n def check_static_libs(self,lib_dir,libs,opt_libs =[]):\n #XXX: what are .lib and .dll files under win32?\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs])) == len(libs):\n info = {'libraries':libs,'library_dirs':[lib_dir]}\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs]))\\\n ==len(opt_libs):\n info['libraries'].extend(opt_libs)\n return info\n\n def check_shared_libs(self,lib_dir,libs,opt_libs =[]):\n shared_libs = []\n for l in libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: shared_libs.append(p)\n if len(shared_libs) == len(libs):\n info = {'extra_objects':shared_libs}\n opt_shared_libs = []\n for l in opt_libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: opt_shared_libs.append(p)\n info['extra_objects'].extend(opt_shared_libs)\n return info\n\n\nclass fftw_info(system_info):\n section = 'fftw'\n\n def __init__(self):\n system_info.__init__(self)\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n incl_dirs = self.get_include_dirs()\n incl_dir = None\n\n libs = self.get_libs('fftw_libs', ['fftw','rfftw'])\n opt_libs = self.get_libs('fftw_opt_libs',\n ['fftw_threads','rfftw_threads'])\n info = None\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['fftw.h','rfftw.h']))==2:\n dict_append(info,include_dirs=[d])\n flag = 1\n incl_dirs = [d]\n incl_dir = d\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_FFTW_H',1)])\n else:\n info = None\n\n if info is None:\n libs = self.get_libs('dfftw_libs', ['dfftw', 'drfftw'])\n opt_libs = self.get_libs('dfftw_opt_libs',\n ['dfftw_threads', 'drfftw_threads'])\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['dfftw.h','drfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n incl_dirs = [d]\n incl_dir = d\n flag = 1\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_DFFTW_H',1)])\n else:\n info = None\n\n libs = self.get_libs('sfftw_libs', ['sfftw', 'srfftw'])\n opt_libs = self.get_libs('sfftw_opt_libs',\n ['sfftw_threads', 'srfftw_threads'])\n flag = 0\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n if info is None: info = r\n else: dict_append(info,**r)\n flag = 1\n break\n if info is not None and flag:\n for d in incl_dirs:\n if len(combine_paths(d,['sfftw.h','srfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n dict_append(info,define_macros=[('SCIPY_SFFTW_H',1)])\n break\n if info is not None:\n self.set_info(**info)\n\n\nclass atlas_info(system_info):\n section = 'atlas'\n\n def get_paths(self, section, key):\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs = []\n for d in self.cp.get(section, key).split(os.pathsep) + default_dirs:\n dirs.extend([d]+combine_paths(d,['atlas*','ATLAS*']))\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n\n h = (combine_paths(lib_dirs+include_dirs,'cblas.h') or [None])[0]\n if h: h = os.path.dirname(h)\n info = None\n # lapack must appear before atlas\n lapack_libs = self.get_libs('lapack_libs', ['lapack'])\n for d in lib_dirs:\n lapack = self.check_libs(d,lapack_libs,[])\n if lapack is not None:\n info = lapack \n break\n else:\n return\n atlas_libs = self.get_libs('atlas_libs', ['f77blas', 'cblas', 'atlas'])\n for d in lib_dirs:\n atlas = self.check_libs(d,atlas_libs,[])\n if atlas is not None:\n dict_append(info, **atlas)\n break\n else:\n return\n\n if h: dict_append(info,include_dirs=[h])\n self.set_info(**info)\n\n## class blas_info(system_info):\n## # For Fortran or optimized blas, not atlas.\n## pass\n\n\n## class lapack_info(system_info):\n## # For Fortran or optimized lapack, not atlas\n## pass\n\n\nclass x11_info(system_info):\n section = 'x11'\n\n def __init__(self):\n system_info.__init__(self,\n default_lib_dirs=default_x11_lib_dirs,\n default_include_dirs=default_x11_include_dirs)\n\n def calc_info(self):\n if sys.platform == 'win32':\n return\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n x11_libs = self.get_libs('x11_libs', ['X11'])\n for lib_dir in lib_dirs:\n info = self.check_libs(lib_dir, x11_libs, [])\n if info is not None:\n break\n else:\n return\n inc_dir = None\n for d in include_dirs:\n if combine_paths(d, 'X11/X.h'):\n inc_dir = d\n break\n if inc_dir is not None:\n dict_append(info, include_dirs=[inc_dir])\n self.set_info(**info)\n\ndef shortest_path(pths):\n pths.sort()\n if pths: return pths[0]\n\ndef combine_paths(*args):\n \"\"\" Return a list of existing paths composed by all combinations of\n items from arguments.\n \"\"\"\n r = []\n for a in args:\n if not a: continue\n if type(a) is types.StringType:\n a = [a]\n r.append(a)\n args = r\n if not args: return []\n if len(args)==1:\n result = reduce(lambda a,b:a+b,map(glob,args[0]),[])\n elif len (args)==2:\n result = []\n for a0 in args[0]:\n for a1 in args[1]:\n result.extend(glob(os.path.join(a0,a1)))\n else:\n result = combine_paths(*(combine_paths(args[0],args[1])+args[2:]))\n return result\n\ndef dict_append(d,**kws):\n for k,v in kws.items():\n if d.has_key(k):\n d[k].extend(v)\n else:\n d[k] = v\n\ndef show_all():\n import system_info\n import pprint\n match_info = re.compile(r'.*?_info').match\n for n in filter(match_info,dir(system_info)):\n if n in ['system_info','get_info']: continue\n c = getattr(system_info,n)()\n r = c.get_info()\n\nif __name__ == \"__main__\":\n show_all()\n", + "source_code_before": "#!/usr/bin/env python\n\"\"\"\nThis file defines a set of system_info classes for getting\ninformation about various resources (libraries, library directories,\ninclude directories, etc.) in the system. Currently, the following\nclasses are available:\n atlas_info\n fftw_info\n x11_info\n\nUsage:\n info_dict = get_info()\n where is a string 'atlas','x11','fftw'.\n\n Returned info_dict is a dictionary which is compatible with\n distutils.setup keyword arguments. If info_dict == {}, then the\n asked resource is not available (or system_info could not find it).\n\nGlobal parameters:\n system_info.static_first - a flag for indicating that static\n libraries are searched first than shared ones.\n system_info.verbose - show the results if set.\n\nThe file 'site.cfg' in the same directory as this module is read\nfor configuration options. The format is that used by ConfigParser (i.e.,\nWindows .INI style). The section DEFAULT has options that are the default\nfor each section. The available sections are fftw, atlas, and x11. Appropiate\ndefaults are used if nothing is specified.\n\nExample:\n----------\n[DEFAULT]\nlib_dir = /usr/lib:/usr/local/lib:/opt/lib\ninclude_dir = /usr/include:/usr/local/include:/opt/include\n# use static libraries in preference to shared ones\nstatic_first = 1\n\n[fftw]\nfftw_libs = fftw, rfftw\nfftw_opt_libs = fftw_threaded, rfftw_threaded\n# if the above aren't found, look for {s,d}fftw_libs and {s,d}fftw_opt_libs\n\n[atlas]\nlib_dir = /usr/lib/3dnow:/usr/lib/3dnow/atlas\n# for overriding the names of the atlas libraries\natlas_libs = f77blas, cblas, atlas\nlapack_libs = lapack\n\n[x11]\nlib_dir = /usr/X11R6/lib\ninclude_dir = /usr/X11R6/include\n----------\n\nAuthors:\n Pearu Peterson , February 2002\n David M. Cooke , April 2002\nPermission to use, modify, and distribute this software is given under the\nterms of the LGPL. See http://www.fsf.org\nNO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n\"\"\"\n\nimport sys,os,re,types\nfrom distutils.errors import DistutilsError\nfrom glob import glob\nimport ConfigParser\n\nfrom distutils.sysconfig import get_config_vars\n\nif sys.platform == 'win32':\n default_lib_dirs = ['C:\\\\'] # probably not very helpful...\n default_include_dirs = []\n default_x11_lib_dirs = []\n default_x11_include_dirs = []\nelse:\n default_lib_dirs = ['/usr/local/lib', '/opt/lib', '/usr/lib']\n default_include_dirs = ['/usr/local/include',\n '/opt/include', '/usr/include']\n default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib']\n default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include']\n\nif os.path.join(sys.prefix, 'lib') not in default_lib_dirs:\n default_lib_dirs.append(os.path.join(sys.prefix, 'lib'))\n default_include_dirs.append(os.path.join(sys.prefix, 'include'))\ndefault_lib_dirs = filter(os.path.isdir, default_lib_dirs)\ndefault_include_dirs = filter(os.path.isdir, default_include_dirs)\n\nso_ext = get_config_vars('SO')[0] or ''\n\ndef get_info(name):\n cl = {'atlas':atlas_info,\n 'x11':x11_info,\n 'fftw':fftw_info}.get(name.lower(),system_info)\n return cl().get_info()\n\nclass NotFoundError(DistutilsError):\n \"\"\"Some third-party program or library is not found.\"\"\"\n\nclass AtlasNotFoundError(NotFoundError):\n \"\"\"\n Atlas (http://math-atlas.sourceforge.net/) libraries not found.\n Either install them in /usr/local/lib/atlas or /usr/lib/atlas\n and retry setup.py. One can use also ATLAS environment variable\n to indicate the location of Atlas libraries.\"\"\"\n\nclass FFTWNotFoundError(NotFoundError):\n \"\"\"\n FFTW (http://www.fftw.org/) libraries not found.\n Either install them in /usr/local/lib or /usr/lib and retry setup.py.\n One can use also FFTW environment variable to indicate\n the location of FFTW libraries.\"\"\"\n\nclass F2pyNotFoundError(NotFoundError):\n \"\"\"\n f2py2e (http://cens.ioc.ee/projects/f2py2e/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass NumericNotFoundError(NotFoundError):\n \"\"\"\n Numeric (http://www.numpy.org/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass X11NotFoundError(NotFoundError):\n \"\"\"X11 libraries not found.\"\"\"\n\nclass system_info:\n\n \"\"\" get_info() is the only public method. Don't use others.\n \"\"\"\n section = 'DEFAULT'\n\n static_first = 1\n verbose = 1\n need_refresh = 1\n saved_results = {}\n\n def __init__ (self,\n default_lib_dirs=default_lib_dirs,\n default_include_dirs=default_include_dirs,\n ):\n self.__class__.info = {}\n self.local_prefixes = []\n defaults = {}\n defaults['lib_dir'] = os.pathsep.join(default_lib_dirs)\n defaults['include_dir'] = os.pathsep.join(default_include_dirs)\n defaults['static_first'] = '1'\n self.cp = ConfigParser.ConfigParser(defaults)\n cf = os.path.join(os.path.split(os.path.abspath(__file__))[0],\n 'site.cfg')\n self.cp.read([cf])\n if not self.cp.has_section(self.section):\n self.cp.add_section(self.section)\n self.static_first = self.cp.getboolean(self.section, 'static_first')\n\n def set_info(self,**info):\n self.saved_results[self.__class__.__name__] = info\n def has_info(self):\n return self.saved_results.has_key(self.__class__.__name__)\n def get_info(self):\n \"\"\" Return a dictonary with items that are compatible\n with scipy_distutils.setup keyword arguments.\n \"\"\"\n flag = 0\n if not self.has_info():\n flag = 1\n if self.verbose:\n print self.__class__.__name__ + ':'\n if hasattr(self, 'calc_info'):\n self.calc_info()\n if self.verbose:\n if not self.has_info():\n print ' NOT AVAILABLE'\n self.set_info()\n else:\n print ' FOUND:'\n res = self.saved_results.get(self.__class__.__name__)\n if self.verbose and flag:\n for k,v in res.items():\n print ' %s = %s'%(k,v)\n print\n return res\n\n def calc_info_template(self,prefix):\n \"\"\" Calculate info dictionary. \"\"\"\n\n def get_paths(self, section, key):\n dirs = self.cp.get(section, key).split(os.pathsep)\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs.extend(default_dirs)\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def get_lib_dirs(self, key='lib_dir'):\n return self.get_paths(self.section, key)\n def get_include_dirs(self, key='include_dir'):\n return self.get_paths(self.section, key)\n\n def get_libs(self, key, default):\n try:\n libs = self.cp.get(self.section, key)\n except ConfigParser.NoOptionError:\n return default\n return [a.strip() for a in libs.split(',')]\n\n def check_libs(self,lib_dir,libs,opt_libs =[]):\n \"\"\" If static or shared libraries are available then return\n their info dictionary. \"\"\"\n mths = [self.check_static_libs,self.check_shared_libs]\n if not self.static_first:\n mths.reverse() # if one prefers shared libraries\n for m in mths:\n info = m(lib_dir,libs,opt_libs)\n if info is not None: return info\n\n def check_static_libs(self,lib_dir,libs,opt_libs =[]):\n #XXX: what are .lib and .dll files under win32?\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs])) == len(libs):\n info = {'libraries':libs,'library_dirs':[lib_dir]}\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs]))\\\n ==len(opt_libs):\n info['libraries'].extend(opt_libs)\n return info\n\n def check_shared_libs(self,lib_dir,libs,opt_libs =[]):\n shared_libs = []\n for l in libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: shared_libs.append(p)\n if len(shared_libs) == len(libs):\n info = {'extra_objects':shared_libs}\n opt_shared_libs = []\n for l in opt_libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: opt_shared_libs.append(p)\n info['extra_objects'].extend(opt_shared_libs)\n return info\n\n\nclass fftw_info(system_info):\n section = 'fftw'\n\n def __init__(self):\n system_info.__init__(self)\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n incl_dirs = self.get_include_dirs()\n incl_dir = None\n\n libs = self.get_libs('fftw_libs', ['fftw','rfftw'])\n opt_libs = self.get_libs('fftw_opt_libs',\n ['fftw_threads','rfftw_threads'])\n info = None\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['fftw.h','rfftw.h']))==2:\n dict_append(info,include_dirs=[d])\n flag = 1\n incl_dirs = [d]\n incl_dir = d\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_FFTW_H',1)])\n else:\n info = None\n\n if info is None:\n libs = self.get_libs('dfftw_libs', ['dfftw', 'drfftw'])\n opt_libs = self.get_libs('dfftw_opt_libs',\n ['dfftw_threads', 'drfftw_threads'])\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['dfftw.h','drfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n incl_dirs = [d]\n incl_dir = d\n flag = 1\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_DFFTW_H',1)])\n else:\n info = None\n\n libs = self.get_libs('sfftw_libs', ['sfftw', 'srfftw'])\n opt_libs = self.get_libs('sfftw_opt_libs',\n ['sfftw_threads', 'srfftw_threads'])\n flag = 0\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n if info is None: info = r\n else: dict_append(info,**r)\n flag = 1\n break\n if info is not None and flag:\n for d in incl_dirs:\n if len(combine_paths(d,['sfftw.h','srfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n dict_append(info,define_macros=[('SCIPY_SFFTW_H',1)])\n break\n if info is not None:\n self.set_info(**info)\n\n\nclass atlas_info(system_info):\n section = 'atlas'\n\n def get_paths(self, section, key):\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs = []\n for d in self.cp.get(section, key).split(os.pathsep) + default_dirs:\n dirs.extend([d]+combine_paths(d,['atlas*','ATLAS*']))\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n\n h = (combine_paths(lib_dirs+include_dirs,'cblas.h') or [None])[0]\n if h: h = os.path.dirname(h)\n info = None\n # lapack must appear before atlas\n lapack_libs = self.get_libs('lapack_libs', ['lapack'])\n for d in lib_dirs:\n lapack = self.check_libs(d,lapack_libs,[])\n if lapack is not None:\n info = lapack \n break\n else:\n return\n atlas_libs = self.get_libs('atlas_libs', ['f77blas', 'cblas', 'atlas'])\n for d in lib_dirs:\n atlas = self.check_libs(d,atlas_libs,[])\n if atlas is not None:\n dict_append(info, **atlas)\n break\n else:\n return\n\n if h: dict_append(info,include_dirs=[h])\n self.set_info(**info)\n\n## class blas_info(system_info):\n## # For Fortran or optimized blas, not atlas.\n## pass\n\n\n## class lapack_info(system_info):\n## # For Fortran or optimized lapack, not atlas\n## pass\n\n\nclass x11_info(system_info):\n section = 'x11'\n\n def __init__(self):\n system_info.__init__(self,\n default_lib_dirs=default_x11_lib_dirs,\n default_include_dirs=default_x11_include_dirs)\n\n def calc_info(self):\n if sys.platform == 'win32':\n return\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n x11_libs = self.get_libs('x11_libs', ['X11'])\n for lib_dir in lib_dirs:\n info = self.check_libs(lib_dir, x11_libs, [])\n if info is not None:\n break\n else:\n return\n inc_dir = None\n for d in include_dirs:\n if combine_paths(d, 'X11/X.h'):\n inc_dir = d\n break\n if inc_dir is not None:\n dict_append(info, include_dirs=[inc_dir])\n self.set_info(**info)\n\ndef shortest_path(pths):\n pths.sort()\n if pths: return pths[0]\n\ndef combine_paths(*args):\n \"\"\" Return a list of existing paths composed by all combinations of\n items from arguments.\n \"\"\"\n r = []\n for a in args:\n if not a: continue\n if type(a) is types.StringType:\n a = [a]\n r.append(a)\n args = r\n if not args: return []\n if len(args)==1:\n result = reduce(lambda a,b:a+b,map(glob,args[0]),[])\n elif len (args)==2:\n result = []\n for a0 in args[0]:\n for a1 in args[1]:\n result.extend(glob(os.path.join(a0,a1)))\n else:\n result = combine_paths(*(combine_paths(args[0],args[1])+args[2:]))\n return result\n\ndef dict_append(d,**kws):\n for k,v in kws.items():\n if d.has_key(k):\n d[k].extend(v)\n else:\n d[k] = v\n\ndef show_all():\n import system_info\n import pprint\n match_info = re.compile(r'.*?_info').match\n for n in filter(match_info,dir(system_info)):\n if n in ['system_info','get_info']: continue\n c = getattr(system_info,n)()\n r = c.get_info()\n\nif __name__ == \"__main__\":\n show_all()\n", + "methods": [ + { + "name": "get_info", + "long_name": "get_info( name )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 1, + "token_count": 39, + "parameters": [ + "name" + ], + "start_line": 94, + "end_line": 98, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , default_lib_dirs = default_lib_dirs , default_include_dirs = default_include_dirs , )", + "filename": "system_info.py", + "nloc": 17, + "complexity": 2, + "token_count": 152, + "parameters": [ + "self", + "default_lib_dirs", + "default_include_dirs" + ], + "start_line": 141, + "end_line": 157, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "set_info", + "long_name": "set_info( self , ** info )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "info" + ], + "start_line": 159, + "end_line": 160, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "has_info", + "long_name": "has_info( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self" + ], + "start_line": 161, + "end_line": 162, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_info", + "long_name": "get_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 9, + "token_count": 113, + "parameters": [ + "self" + ], + "start_line": 163, + "end_line": 185, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "calc_info_template", + "long_name": "calc_info_template( self , prefix )", + "filename": "system_info.py", + "nloc": 1, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self", + "prefix" + ], + "start_line": 187, + "end_line": 188, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 3, + "token_count": 70, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 190, + "end_line": 194, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "get_lib_dirs", + "long_name": "get_lib_dirs( self , key = 'lib_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 196, + "end_line": 197, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_include_dirs", + "long_name": "get_include_dirs( self , key = 'include_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 198, + "end_line": 199, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_libs", + "long_name": "get_libs( self , key , default )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "key", + "default" + ], + "start_line": 201, + "end_line": 206, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "check_libs", + "long_name": "check_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 4, + "token_count": 60, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 208, + "end_line": 216, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "check_static_libs", + "long_name": "check_static_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 5, + "token_count": 91, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 218, + "end_line": 225, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "check_shared_libs", + "long_name": "check_shared_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 13, + "complexity": 6, + "token_count": 119, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 227, + "end_line": 239, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 245, + "end_line": 246, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 69, + "complexity": 24, + "token_count": 443, + "parameters": [ + "self" + ], + "start_line": 248, + "end_line": 319, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 72, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 4, + "token_count": 91, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 325, + "end_line": 330, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 24, + "complexity": 8, + "token_count": 168, + "parameters": [ + "self" + ], + "start_line": 332, + "end_line": 358, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 27, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 4, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 373, + "end_line": 376, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 7, + "token_count": 110, + "parameters": [ + "self" + ], + "start_line": 378, + "end_line": 397, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "shortest_path", + "long_name": "shortest_path( pths )", + "filename": "system_info.py", + "nloc": 3, + "complexity": 2, + "token_count": 18, + "parameters": [ + "pths" + ], + "start_line": 399, + "end_line": 401, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "combine_paths", + "long_name": "combine_paths( * args )", + "filename": "system_info.py", + "nloc": 19, + "complexity": 9, + "token_count": 162, + "parameters": [ + "args" + ], + "start_line": 403, + "end_line": 424, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "dict_append", + "long_name": "dict_append( d , ** kws )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 44, + "parameters": [ + "d", + "kws" + ], + "start_line": 426, + "end_line": 431, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "show_all", + "long_name": "show_all( )", + "filename": "system_info.py", + "nloc": 8, + "complexity": 3, + "token_count": 59, + "parameters": [], + "start_line": 433, + "end_line": 440, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "get_info", + "long_name": "get_info( name )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 1, + "token_count": 39, + "parameters": [ + "name" + ], + "start_line": 89, + "end_line": 93, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , default_lib_dirs = default_lib_dirs , default_include_dirs = default_include_dirs , )", + "filename": "system_info.py", + "nloc": 17, + "complexity": 2, + "token_count": 152, + "parameters": [ + "self", + "default_lib_dirs", + "default_include_dirs" + ], + "start_line": 136, + "end_line": 152, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "set_info", + "long_name": "set_info( self , ** info )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "info" + ], + "start_line": 154, + "end_line": 155, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "has_info", + "long_name": "has_info( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self" + ], + "start_line": 156, + "end_line": 157, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_info", + "long_name": "get_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 9, + "token_count": 113, + "parameters": [ + "self" + ], + "start_line": 158, + "end_line": 180, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "calc_info_template", + "long_name": "calc_info_template( self , prefix )", + "filename": "system_info.py", + "nloc": 1, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self", + "prefix" + ], + "start_line": 182, + "end_line": 183, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 3, + "token_count": 70, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 185, + "end_line": 189, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "get_lib_dirs", + "long_name": "get_lib_dirs( self , key = 'lib_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 191, + "end_line": 192, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_include_dirs", + "long_name": "get_include_dirs( self , key = 'include_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 193, + "end_line": 194, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_libs", + "long_name": "get_libs( self , key , default )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "key", + "default" + ], + "start_line": 196, + "end_line": 201, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "check_libs", + "long_name": "check_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 4, + "token_count": 60, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 203, + "end_line": 211, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "check_static_libs", + "long_name": "check_static_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 5, + "token_count": 91, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 213, + "end_line": 220, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "check_shared_libs", + "long_name": "check_shared_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 13, + "complexity": 6, + "token_count": 119, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 222, + "end_line": 234, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 240, + "end_line": 241, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 69, + "complexity": 24, + "token_count": 443, + "parameters": [ + "self" + ], + "start_line": 243, + "end_line": 314, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 72, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 4, + "token_count": 91, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 320, + "end_line": 325, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 24, + "complexity": 8, + "token_count": 168, + "parameters": [ + "self" + ], + "start_line": 327, + "end_line": 353, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 27, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 4, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 368, + "end_line": 371, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 7, + "token_count": 110, + "parameters": [ + "self" + ], + "start_line": 373, + "end_line": 392, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "shortest_path", + "long_name": "shortest_path( pths )", + "filename": "system_info.py", + "nloc": 3, + "complexity": 2, + "token_count": 18, + "parameters": [ + "pths" + ], + "start_line": 394, + "end_line": 396, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "combine_paths", + "long_name": "combine_paths( * args )", + "filename": "system_info.py", + "nloc": 19, + "complexity": 9, + "token_count": 162, + "parameters": [ + "args" + ], + "start_line": 398, + "end_line": 419, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "dict_append", + "long_name": "dict_append( d , ** kws )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 44, + "parameters": [ + "d", + "kws" + ], + "start_line": 421, + "end_line": 426, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "show_all", + "long_name": "show_all( )", + "filename": "system_info.py", + "nloc": 8, + "complexity": 3, + "token_count": 59, + "parameters": [], + "start_line": 428, + "end_line": 435, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + } + ], + "changed_methods": [], + "nloc": 376, + "complexity": 100, + "token_count": 2195, + "diff_parsed": { + "added": [ + "", + "Copyright 2002 Pearu Peterson all rights reserved,", + "Pearu Peterson ", + "Permission to use, modify, and distribute this software is given under the", + "terms of the SciPy (BSD style) license. See LICENSE.txt that came with", + "this distribution for specifics.", + "" + ], + "deleted": [ + "Permission to use, modify, and distribute this software is given under the", + "terms of the LGPL. See http://www.fsf.org" + ] + } + } + ] + }, + { + "hash": "5e2f226d1ef47f124f4b529bcf5ba71b3829e4b4", + "msg": "setup atlas directory search path so that prefix path is searched before /usr/lib so that \"locally\" installed atlas libraries are found before system libraries. Note this only works if python is also locally installed.", + "author": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "committer": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "author_date": "2002-04-07T23:41:48+00:00", + "author_timezone": 0, + "committer_date": "2002-04-07T23:41:48+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "35da74a23035d8ea5d2e0236fab7f376e44f0baa" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 1, + "insertions": 2, + "lines": 3, + "files": 1, + "dmm_unit_size": null, + "dmm_unit_complexity": null, + "dmm_unit_interfacing": null, + "modified_files": [ + { + "old_path": "scipy_distutils/system_info.py", + "new_path": "scipy_distutils/system_info.py", + "filename": "system_info.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -84,7 +84,8 @@\n default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include']\n \n if os.path.join(sys.prefix, 'lib') not in default_lib_dirs:\n- default_lib_dirs.append(os.path.join(sys.prefix, 'lib'))\n+ default_lib_dirs.insert(0,os.path.join(sys.prefix, 'lib'))\n+# default_lib_dirs.append(os.path.join(sys.prefix, 'lib'))\n default_include_dirs.append(os.path.join(sys.prefix, 'include'))\n default_lib_dirs = filter(os.path.isdir, default_lib_dirs)\n default_include_dirs = filter(os.path.isdir, default_include_dirs)\n", + "added_lines": 2, + "deleted_lines": 1, + "source_code": "#!/usr/bin/env python\n\"\"\"\nThis file defines a set of system_info classes for getting\ninformation about various resources (libraries, library directories,\ninclude directories, etc.) in the system. Currently, the following\nclasses are available:\n atlas_info\n fftw_info\n x11_info\n\nUsage:\n info_dict = get_info()\n where is a string 'atlas','x11','fftw'.\n\n Returned info_dict is a dictionary which is compatible with\n distutils.setup keyword arguments. If info_dict == {}, then the\n asked resource is not available (or system_info could not find it).\n\nGlobal parameters:\n system_info.static_first - a flag for indicating that static\n libraries are searched first than shared ones.\n system_info.verbose - show the results if set.\n\nThe file 'site.cfg' in the same directory as this module is read\nfor configuration options. The format is that used by ConfigParser (i.e.,\nWindows .INI style). The section DEFAULT has options that are the default\nfor each section. The available sections are fftw, atlas, and x11. Appropiate\ndefaults are used if nothing is specified.\n\nExample:\n----------\n[DEFAULT]\nlib_dir = /usr/lib:/usr/local/lib:/opt/lib\ninclude_dir = /usr/include:/usr/local/include:/opt/include\n# use static libraries in preference to shared ones\nstatic_first = 1\n\n[fftw]\nfftw_libs = fftw, rfftw\nfftw_opt_libs = fftw_threaded, rfftw_threaded\n# if the above aren't found, look for {s,d}fftw_libs and {s,d}fftw_opt_libs\n\n[atlas]\nlib_dir = /usr/lib/3dnow:/usr/lib/3dnow/atlas\n# for overriding the names of the atlas libraries\natlas_libs = f77blas, cblas, atlas\nlapack_libs = lapack\n\n[x11]\nlib_dir = /usr/X11R6/lib\ninclude_dir = /usr/X11R6/include\n----------\n\nAuthors:\n Pearu Peterson , February 2002\n David M. Cooke , April 2002\n\nCopyright 2002 Pearu Peterson all rights reserved,\nPearu Peterson \nPermission to use, modify, and distribute this software is given under the \nterms of the SciPy (BSD style) license. See LICENSE.txt that came with\nthis distribution for specifics.\n\nNO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n\"\"\"\n\nimport sys,os,re,types\nfrom distutils.errors import DistutilsError\nfrom glob import glob\nimport ConfigParser\n\nfrom distutils.sysconfig import get_config_vars\n\nif sys.platform == 'win32':\n default_lib_dirs = ['C:\\\\'] # probably not very helpful...\n default_include_dirs = []\n default_x11_lib_dirs = []\n default_x11_include_dirs = []\nelse:\n default_lib_dirs = ['/usr/local/lib', '/opt/lib', '/usr/lib']\n default_include_dirs = ['/usr/local/include',\n '/opt/include', '/usr/include']\n default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib']\n default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include']\n\nif os.path.join(sys.prefix, 'lib') not in default_lib_dirs:\n default_lib_dirs.insert(0,os.path.join(sys.prefix, 'lib'))\n# default_lib_dirs.append(os.path.join(sys.prefix, 'lib'))\n default_include_dirs.append(os.path.join(sys.prefix, 'include'))\ndefault_lib_dirs = filter(os.path.isdir, default_lib_dirs)\ndefault_include_dirs = filter(os.path.isdir, default_include_dirs)\n\nso_ext = get_config_vars('SO')[0] or ''\n\ndef get_info(name):\n cl = {'atlas':atlas_info,\n 'x11':x11_info,\n 'fftw':fftw_info}.get(name.lower(),system_info)\n return cl().get_info()\n\nclass NotFoundError(DistutilsError):\n \"\"\"Some third-party program or library is not found.\"\"\"\n\nclass AtlasNotFoundError(NotFoundError):\n \"\"\"\n Atlas (http://math-atlas.sourceforge.net/) libraries not found.\n Either install them in /usr/local/lib/atlas or /usr/lib/atlas\n and retry setup.py. One can use also ATLAS environment variable\n to indicate the location of Atlas libraries.\"\"\"\n\nclass FFTWNotFoundError(NotFoundError):\n \"\"\"\n FFTW (http://www.fftw.org/) libraries not found.\n Either install them in /usr/local/lib or /usr/lib and retry setup.py.\n One can use also FFTW environment variable to indicate\n the location of FFTW libraries.\"\"\"\n\nclass F2pyNotFoundError(NotFoundError):\n \"\"\"\n f2py2e (http://cens.ioc.ee/projects/f2py2e/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass NumericNotFoundError(NotFoundError):\n \"\"\"\n Numeric (http://www.numpy.org/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass X11NotFoundError(NotFoundError):\n \"\"\"X11 libraries not found.\"\"\"\n\nclass system_info:\n\n \"\"\" get_info() is the only public method. Don't use others.\n \"\"\"\n section = 'DEFAULT'\n\n static_first = 1\n verbose = 1\n need_refresh = 1\n saved_results = {}\n\n def __init__ (self,\n default_lib_dirs=default_lib_dirs,\n default_include_dirs=default_include_dirs,\n ):\n self.__class__.info = {}\n self.local_prefixes = []\n defaults = {}\n defaults['lib_dir'] = os.pathsep.join(default_lib_dirs)\n defaults['include_dir'] = os.pathsep.join(default_include_dirs)\n defaults['static_first'] = '1'\n self.cp = ConfigParser.ConfigParser(defaults)\n cf = os.path.join(os.path.split(os.path.abspath(__file__))[0],\n 'site.cfg')\n self.cp.read([cf])\n if not self.cp.has_section(self.section):\n self.cp.add_section(self.section)\n self.static_first = self.cp.getboolean(self.section, 'static_first')\n\n def set_info(self,**info):\n self.saved_results[self.__class__.__name__] = info\n def has_info(self):\n return self.saved_results.has_key(self.__class__.__name__)\n def get_info(self):\n \"\"\" Return a dictonary with items that are compatible\n with scipy_distutils.setup keyword arguments.\n \"\"\"\n flag = 0\n if not self.has_info():\n flag = 1\n if self.verbose:\n print self.__class__.__name__ + ':'\n if hasattr(self, 'calc_info'):\n self.calc_info()\n if self.verbose:\n if not self.has_info():\n print ' NOT AVAILABLE'\n self.set_info()\n else:\n print ' FOUND:'\n res = self.saved_results.get(self.__class__.__name__)\n if self.verbose and flag:\n for k,v in res.items():\n print ' %s = %s'%(k,v)\n print\n return res\n\n def calc_info_template(self,prefix):\n \"\"\" Calculate info dictionary. \"\"\"\n\n def get_paths(self, section, key):\n dirs = self.cp.get(section, key).split(os.pathsep)\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs.extend(default_dirs)\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def get_lib_dirs(self, key='lib_dir'):\n return self.get_paths(self.section, key)\n def get_include_dirs(self, key='include_dir'):\n return self.get_paths(self.section, key)\n\n def get_libs(self, key, default):\n try:\n libs = self.cp.get(self.section, key)\n except ConfigParser.NoOptionError:\n return default\n return [a.strip() for a in libs.split(',')]\n\n def check_libs(self,lib_dir,libs,opt_libs =[]):\n \"\"\" If static or shared libraries are available then return\n their info dictionary. \"\"\"\n mths = [self.check_static_libs,self.check_shared_libs]\n if not self.static_first:\n mths.reverse() # if one prefers shared libraries\n for m in mths:\n info = m(lib_dir,libs,opt_libs)\n if info is not None: return info\n\n def check_static_libs(self,lib_dir,libs,opt_libs =[]):\n #XXX: what are .lib and .dll files under win32?\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs])) == len(libs):\n info = {'libraries':libs,'library_dirs':[lib_dir]}\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs]))\\\n ==len(opt_libs):\n info['libraries'].extend(opt_libs)\n return info\n\n def check_shared_libs(self,lib_dir,libs,opt_libs =[]):\n shared_libs = []\n for l in libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: shared_libs.append(p)\n if len(shared_libs) == len(libs):\n info = {'extra_objects':shared_libs}\n opt_shared_libs = []\n for l in opt_libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: opt_shared_libs.append(p)\n info['extra_objects'].extend(opt_shared_libs)\n return info\n\n\nclass fftw_info(system_info):\n section = 'fftw'\n\n def __init__(self):\n system_info.__init__(self)\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n incl_dirs = self.get_include_dirs()\n incl_dir = None\n\n libs = self.get_libs('fftw_libs', ['fftw','rfftw'])\n opt_libs = self.get_libs('fftw_opt_libs',\n ['fftw_threads','rfftw_threads'])\n info = None\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['fftw.h','rfftw.h']))==2:\n dict_append(info,include_dirs=[d])\n flag = 1\n incl_dirs = [d]\n incl_dir = d\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_FFTW_H',1)])\n else:\n info = None\n\n if info is None:\n libs = self.get_libs('dfftw_libs', ['dfftw', 'drfftw'])\n opt_libs = self.get_libs('dfftw_opt_libs',\n ['dfftw_threads', 'drfftw_threads'])\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['dfftw.h','drfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n incl_dirs = [d]\n incl_dir = d\n flag = 1\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_DFFTW_H',1)])\n else:\n info = None\n\n libs = self.get_libs('sfftw_libs', ['sfftw', 'srfftw'])\n opt_libs = self.get_libs('sfftw_opt_libs',\n ['sfftw_threads', 'srfftw_threads'])\n flag = 0\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n if info is None: info = r\n else: dict_append(info,**r)\n flag = 1\n break\n if info is not None and flag:\n for d in incl_dirs:\n if len(combine_paths(d,['sfftw.h','srfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n dict_append(info,define_macros=[('SCIPY_SFFTW_H',1)])\n break\n if info is not None:\n self.set_info(**info)\n\n\nclass atlas_info(system_info):\n section = 'atlas'\n\n def get_paths(self, section, key):\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs = []\n for d in self.cp.get(section, key).split(os.pathsep) + default_dirs:\n dirs.extend([d]+combine_paths(d,['atlas*','ATLAS*']))\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n\n h = (combine_paths(lib_dirs+include_dirs,'cblas.h') or [None])[0]\n if h: h = os.path.dirname(h)\n info = None\n # lapack must appear before atlas\n lapack_libs = self.get_libs('lapack_libs', ['lapack'])\n for d in lib_dirs:\n lapack = self.check_libs(d,lapack_libs,[])\n if lapack is not None:\n info = lapack \n break\n else:\n return\n atlas_libs = self.get_libs('atlas_libs', ['f77blas', 'cblas', 'atlas'])\n for d in lib_dirs:\n atlas = self.check_libs(d,atlas_libs,[])\n if atlas is not None:\n dict_append(info, **atlas)\n break\n else:\n return\n\n if h: dict_append(info,include_dirs=[h])\n self.set_info(**info)\n\n## class blas_info(system_info):\n## # For Fortran or optimized blas, not atlas.\n## pass\n\n\n## class lapack_info(system_info):\n## # For Fortran or optimized lapack, not atlas\n## pass\n\n\nclass x11_info(system_info):\n section = 'x11'\n\n def __init__(self):\n system_info.__init__(self,\n default_lib_dirs=default_x11_lib_dirs,\n default_include_dirs=default_x11_include_dirs)\n\n def calc_info(self):\n if sys.platform == 'win32':\n return\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n x11_libs = self.get_libs('x11_libs', ['X11'])\n for lib_dir in lib_dirs:\n info = self.check_libs(lib_dir, x11_libs, [])\n if info is not None:\n break\n else:\n return\n inc_dir = None\n for d in include_dirs:\n if combine_paths(d, 'X11/X.h'):\n inc_dir = d\n break\n if inc_dir is not None:\n dict_append(info, include_dirs=[inc_dir])\n self.set_info(**info)\n\ndef shortest_path(pths):\n pths.sort()\n if pths: return pths[0]\n\ndef combine_paths(*args):\n \"\"\" Return a list of existing paths composed by all combinations of\n items from arguments.\n \"\"\"\n r = []\n for a in args:\n if not a: continue\n if type(a) is types.StringType:\n a = [a]\n r.append(a)\n args = r\n if not args: return []\n if len(args)==1:\n result = reduce(lambda a,b:a+b,map(glob,args[0]),[])\n elif len (args)==2:\n result = []\n for a0 in args[0]:\n for a1 in args[1]:\n result.extend(glob(os.path.join(a0,a1)))\n else:\n result = combine_paths(*(combine_paths(args[0],args[1])+args[2:]))\n return result\n\ndef dict_append(d,**kws):\n for k,v in kws.items():\n if d.has_key(k):\n d[k].extend(v)\n else:\n d[k] = v\n\ndef show_all():\n import system_info\n import pprint\n match_info = re.compile(r'.*?_info').match\n for n in filter(match_info,dir(system_info)):\n if n in ['system_info','get_info']: continue\n c = getattr(system_info,n)()\n r = c.get_info()\n\nif __name__ == \"__main__\":\n show_all()\n", + "source_code_before": "#!/usr/bin/env python\n\"\"\"\nThis file defines a set of system_info classes for getting\ninformation about various resources (libraries, library directories,\ninclude directories, etc.) in the system. Currently, the following\nclasses are available:\n atlas_info\n fftw_info\n x11_info\n\nUsage:\n info_dict = get_info()\n where is a string 'atlas','x11','fftw'.\n\n Returned info_dict is a dictionary which is compatible with\n distutils.setup keyword arguments. If info_dict == {}, then the\n asked resource is not available (or system_info could not find it).\n\nGlobal parameters:\n system_info.static_first - a flag for indicating that static\n libraries are searched first than shared ones.\n system_info.verbose - show the results if set.\n\nThe file 'site.cfg' in the same directory as this module is read\nfor configuration options. The format is that used by ConfigParser (i.e.,\nWindows .INI style). The section DEFAULT has options that are the default\nfor each section. The available sections are fftw, atlas, and x11. Appropiate\ndefaults are used if nothing is specified.\n\nExample:\n----------\n[DEFAULT]\nlib_dir = /usr/lib:/usr/local/lib:/opt/lib\ninclude_dir = /usr/include:/usr/local/include:/opt/include\n# use static libraries in preference to shared ones\nstatic_first = 1\n\n[fftw]\nfftw_libs = fftw, rfftw\nfftw_opt_libs = fftw_threaded, rfftw_threaded\n# if the above aren't found, look for {s,d}fftw_libs and {s,d}fftw_opt_libs\n\n[atlas]\nlib_dir = /usr/lib/3dnow:/usr/lib/3dnow/atlas\n# for overriding the names of the atlas libraries\natlas_libs = f77blas, cblas, atlas\nlapack_libs = lapack\n\n[x11]\nlib_dir = /usr/X11R6/lib\ninclude_dir = /usr/X11R6/include\n----------\n\nAuthors:\n Pearu Peterson , February 2002\n David M. Cooke , April 2002\n\nCopyright 2002 Pearu Peterson all rights reserved,\nPearu Peterson \nPermission to use, modify, and distribute this software is given under the \nterms of the SciPy (BSD style) license. See LICENSE.txt that came with\nthis distribution for specifics.\n\nNO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n\"\"\"\n\nimport sys,os,re,types\nfrom distutils.errors import DistutilsError\nfrom glob import glob\nimport ConfigParser\n\nfrom distutils.sysconfig import get_config_vars\n\nif sys.platform == 'win32':\n default_lib_dirs = ['C:\\\\'] # probably not very helpful...\n default_include_dirs = []\n default_x11_lib_dirs = []\n default_x11_include_dirs = []\nelse:\n default_lib_dirs = ['/usr/local/lib', '/opt/lib', '/usr/lib']\n default_include_dirs = ['/usr/local/include',\n '/opt/include', '/usr/include']\n default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib']\n default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include']\n\nif os.path.join(sys.prefix, 'lib') not in default_lib_dirs:\n default_lib_dirs.append(os.path.join(sys.prefix, 'lib'))\n default_include_dirs.append(os.path.join(sys.prefix, 'include'))\ndefault_lib_dirs = filter(os.path.isdir, default_lib_dirs)\ndefault_include_dirs = filter(os.path.isdir, default_include_dirs)\n\nso_ext = get_config_vars('SO')[0] or ''\n\ndef get_info(name):\n cl = {'atlas':atlas_info,\n 'x11':x11_info,\n 'fftw':fftw_info}.get(name.lower(),system_info)\n return cl().get_info()\n\nclass NotFoundError(DistutilsError):\n \"\"\"Some third-party program or library is not found.\"\"\"\n\nclass AtlasNotFoundError(NotFoundError):\n \"\"\"\n Atlas (http://math-atlas.sourceforge.net/) libraries not found.\n Either install them in /usr/local/lib/atlas or /usr/lib/atlas\n and retry setup.py. One can use also ATLAS environment variable\n to indicate the location of Atlas libraries.\"\"\"\n\nclass FFTWNotFoundError(NotFoundError):\n \"\"\"\n FFTW (http://www.fftw.org/) libraries not found.\n Either install them in /usr/local/lib or /usr/lib and retry setup.py.\n One can use also FFTW environment variable to indicate\n the location of FFTW libraries.\"\"\"\n\nclass F2pyNotFoundError(NotFoundError):\n \"\"\"\n f2py2e (http://cens.ioc.ee/projects/f2py2e/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass NumericNotFoundError(NotFoundError):\n \"\"\"\n Numeric (http://www.numpy.org/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass X11NotFoundError(NotFoundError):\n \"\"\"X11 libraries not found.\"\"\"\n\nclass system_info:\n\n \"\"\" get_info() is the only public method. Don't use others.\n \"\"\"\n section = 'DEFAULT'\n\n static_first = 1\n verbose = 1\n need_refresh = 1\n saved_results = {}\n\n def __init__ (self,\n default_lib_dirs=default_lib_dirs,\n default_include_dirs=default_include_dirs,\n ):\n self.__class__.info = {}\n self.local_prefixes = []\n defaults = {}\n defaults['lib_dir'] = os.pathsep.join(default_lib_dirs)\n defaults['include_dir'] = os.pathsep.join(default_include_dirs)\n defaults['static_first'] = '1'\n self.cp = ConfigParser.ConfigParser(defaults)\n cf = os.path.join(os.path.split(os.path.abspath(__file__))[0],\n 'site.cfg')\n self.cp.read([cf])\n if not self.cp.has_section(self.section):\n self.cp.add_section(self.section)\n self.static_first = self.cp.getboolean(self.section, 'static_first')\n\n def set_info(self,**info):\n self.saved_results[self.__class__.__name__] = info\n def has_info(self):\n return self.saved_results.has_key(self.__class__.__name__)\n def get_info(self):\n \"\"\" Return a dictonary with items that are compatible\n with scipy_distutils.setup keyword arguments.\n \"\"\"\n flag = 0\n if not self.has_info():\n flag = 1\n if self.verbose:\n print self.__class__.__name__ + ':'\n if hasattr(self, 'calc_info'):\n self.calc_info()\n if self.verbose:\n if not self.has_info():\n print ' NOT AVAILABLE'\n self.set_info()\n else:\n print ' FOUND:'\n res = self.saved_results.get(self.__class__.__name__)\n if self.verbose and flag:\n for k,v in res.items():\n print ' %s = %s'%(k,v)\n print\n return res\n\n def calc_info_template(self,prefix):\n \"\"\" Calculate info dictionary. \"\"\"\n\n def get_paths(self, section, key):\n dirs = self.cp.get(section, key).split(os.pathsep)\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs.extend(default_dirs)\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def get_lib_dirs(self, key='lib_dir'):\n return self.get_paths(self.section, key)\n def get_include_dirs(self, key='include_dir'):\n return self.get_paths(self.section, key)\n\n def get_libs(self, key, default):\n try:\n libs = self.cp.get(self.section, key)\n except ConfigParser.NoOptionError:\n return default\n return [a.strip() for a in libs.split(',')]\n\n def check_libs(self,lib_dir,libs,opt_libs =[]):\n \"\"\" If static or shared libraries are available then return\n their info dictionary. \"\"\"\n mths = [self.check_static_libs,self.check_shared_libs]\n if not self.static_first:\n mths.reverse() # if one prefers shared libraries\n for m in mths:\n info = m(lib_dir,libs,opt_libs)\n if info is not None: return info\n\n def check_static_libs(self,lib_dir,libs,opt_libs =[]):\n #XXX: what are .lib and .dll files under win32?\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs])) == len(libs):\n info = {'libraries':libs,'library_dirs':[lib_dir]}\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs]))\\\n ==len(opt_libs):\n info['libraries'].extend(opt_libs)\n return info\n\n def check_shared_libs(self,lib_dir,libs,opt_libs =[]):\n shared_libs = []\n for l in libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: shared_libs.append(p)\n if len(shared_libs) == len(libs):\n info = {'extra_objects':shared_libs}\n opt_shared_libs = []\n for l in opt_libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: opt_shared_libs.append(p)\n info['extra_objects'].extend(opt_shared_libs)\n return info\n\n\nclass fftw_info(system_info):\n section = 'fftw'\n\n def __init__(self):\n system_info.__init__(self)\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n incl_dirs = self.get_include_dirs()\n incl_dir = None\n\n libs = self.get_libs('fftw_libs', ['fftw','rfftw'])\n opt_libs = self.get_libs('fftw_opt_libs',\n ['fftw_threads','rfftw_threads'])\n info = None\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['fftw.h','rfftw.h']))==2:\n dict_append(info,include_dirs=[d])\n flag = 1\n incl_dirs = [d]\n incl_dir = d\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_FFTW_H',1)])\n else:\n info = None\n\n if info is None:\n libs = self.get_libs('dfftw_libs', ['dfftw', 'drfftw'])\n opt_libs = self.get_libs('dfftw_opt_libs',\n ['dfftw_threads', 'drfftw_threads'])\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['dfftw.h','drfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n incl_dirs = [d]\n incl_dir = d\n flag = 1\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_DFFTW_H',1)])\n else:\n info = None\n\n libs = self.get_libs('sfftw_libs', ['sfftw', 'srfftw'])\n opt_libs = self.get_libs('sfftw_opt_libs',\n ['sfftw_threads', 'srfftw_threads'])\n flag = 0\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n if info is None: info = r\n else: dict_append(info,**r)\n flag = 1\n break\n if info is not None and flag:\n for d in incl_dirs:\n if len(combine_paths(d,['sfftw.h','srfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n dict_append(info,define_macros=[('SCIPY_SFFTW_H',1)])\n break\n if info is not None:\n self.set_info(**info)\n\n\nclass atlas_info(system_info):\n section = 'atlas'\n\n def get_paths(self, section, key):\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs = []\n for d in self.cp.get(section, key).split(os.pathsep) + default_dirs:\n dirs.extend([d]+combine_paths(d,['atlas*','ATLAS*']))\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n\n h = (combine_paths(lib_dirs+include_dirs,'cblas.h') or [None])[0]\n if h: h = os.path.dirname(h)\n info = None\n # lapack must appear before atlas\n lapack_libs = self.get_libs('lapack_libs', ['lapack'])\n for d in lib_dirs:\n lapack = self.check_libs(d,lapack_libs,[])\n if lapack is not None:\n info = lapack \n break\n else:\n return\n atlas_libs = self.get_libs('atlas_libs', ['f77blas', 'cblas', 'atlas'])\n for d in lib_dirs:\n atlas = self.check_libs(d,atlas_libs,[])\n if atlas is not None:\n dict_append(info, **atlas)\n break\n else:\n return\n\n if h: dict_append(info,include_dirs=[h])\n self.set_info(**info)\n\n## class blas_info(system_info):\n## # For Fortran or optimized blas, not atlas.\n## pass\n\n\n## class lapack_info(system_info):\n## # For Fortran or optimized lapack, not atlas\n## pass\n\n\nclass x11_info(system_info):\n section = 'x11'\n\n def __init__(self):\n system_info.__init__(self,\n default_lib_dirs=default_x11_lib_dirs,\n default_include_dirs=default_x11_include_dirs)\n\n def calc_info(self):\n if sys.platform == 'win32':\n return\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n x11_libs = self.get_libs('x11_libs', ['X11'])\n for lib_dir in lib_dirs:\n info = self.check_libs(lib_dir, x11_libs, [])\n if info is not None:\n break\n else:\n return\n inc_dir = None\n for d in include_dirs:\n if combine_paths(d, 'X11/X.h'):\n inc_dir = d\n break\n if inc_dir is not None:\n dict_append(info, include_dirs=[inc_dir])\n self.set_info(**info)\n\ndef shortest_path(pths):\n pths.sort()\n if pths: return pths[0]\n\ndef combine_paths(*args):\n \"\"\" Return a list of existing paths composed by all combinations of\n items from arguments.\n \"\"\"\n r = []\n for a in args:\n if not a: continue\n if type(a) is types.StringType:\n a = [a]\n r.append(a)\n args = r\n if not args: return []\n if len(args)==1:\n result = reduce(lambda a,b:a+b,map(glob,args[0]),[])\n elif len (args)==2:\n result = []\n for a0 in args[0]:\n for a1 in args[1]:\n result.extend(glob(os.path.join(a0,a1)))\n else:\n result = combine_paths(*(combine_paths(args[0],args[1])+args[2:]))\n return result\n\ndef dict_append(d,**kws):\n for k,v in kws.items():\n if d.has_key(k):\n d[k].extend(v)\n else:\n d[k] = v\n\ndef show_all():\n import system_info\n import pprint\n match_info = re.compile(r'.*?_info').match\n for n in filter(match_info,dir(system_info)):\n if n in ['system_info','get_info']: continue\n c = getattr(system_info,n)()\n r = c.get_info()\n\nif __name__ == \"__main__\":\n show_all()\n", + "methods": [ + { + "name": "get_info", + "long_name": "get_info( name )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 1, + "token_count": 39, + "parameters": [ + "name" + ], + "start_line": 95, + "end_line": 99, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , default_lib_dirs = default_lib_dirs , default_include_dirs = default_include_dirs , )", + "filename": "system_info.py", + "nloc": 17, + "complexity": 2, + "token_count": 152, + "parameters": [ + "self", + "default_lib_dirs", + "default_include_dirs" + ], + "start_line": 142, + "end_line": 158, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "set_info", + "long_name": "set_info( self , ** info )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "info" + ], + "start_line": 160, + "end_line": 161, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "has_info", + "long_name": "has_info( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self" + ], + "start_line": 162, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_info", + "long_name": "get_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 9, + "token_count": 113, + "parameters": [ + "self" + ], + "start_line": 164, + "end_line": 186, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "calc_info_template", + "long_name": "calc_info_template( self , prefix )", + "filename": "system_info.py", + "nloc": 1, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self", + "prefix" + ], + "start_line": 188, + "end_line": 189, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 3, + "token_count": 70, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 191, + "end_line": 195, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "get_lib_dirs", + "long_name": "get_lib_dirs( self , key = 'lib_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 197, + "end_line": 198, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_include_dirs", + "long_name": "get_include_dirs( self , key = 'include_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 199, + "end_line": 200, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_libs", + "long_name": "get_libs( self , key , default )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "key", + "default" + ], + "start_line": 202, + "end_line": 207, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "check_libs", + "long_name": "check_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 4, + "token_count": 60, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 209, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "check_static_libs", + "long_name": "check_static_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 5, + "token_count": 91, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 219, + "end_line": 226, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "check_shared_libs", + "long_name": "check_shared_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 13, + "complexity": 6, + "token_count": 119, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 228, + "end_line": 240, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 246, + "end_line": 247, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 69, + "complexity": 24, + "token_count": 443, + "parameters": [ + "self" + ], + "start_line": 249, + "end_line": 320, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 72, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 4, + "token_count": 91, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 326, + "end_line": 331, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 24, + "complexity": 8, + "token_count": 168, + "parameters": [ + "self" + ], + "start_line": 333, + "end_line": 359, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 27, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 4, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 374, + "end_line": 377, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 7, + "token_count": 110, + "parameters": [ + "self" + ], + "start_line": 379, + "end_line": 398, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "shortest_path", + "long_name": "shortest_path( pths )", + "filename": "system_info.py", + "nloc": 3, + "complexity": 2, + "token_count": 18, + "parameters": [ + "pths" + ], + "start_line": 400, + "end_line": 402, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "combine_paths", + "long_name": "combine_paths( * args )", + "filename": "system_info.py", + "nloc": 19, + "complexity": 9, + "token_count": 162, + "parameters": [ + "args" + ], + "start_line": 404, + "end_line": 425, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "dict_append", + "long_name": "dict_append( d , ** kws )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 44, + "parameters": [ + "d", + "kws" + ], + "start_line": 427, + "end_line": 432, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "show_all", + "long_name": "show_all( )", + "filename": "system_info.py", + "nloc": 8, + "complexity": 3, + "token_count": 59, + "parameters": [], + "start_line": 434, + "end_line": 441, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "get_info", + "long_name": "get_info( name )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 1, + "token_count": 39, + "parameters": [ + "name" + ], + "start_line": 94, + "end_line": 98, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , default_lib_dirs = default_lib_dirs , default_include_dirs = default_include_dirs , )", + "filename": "system_info.py", + "nloc": 17, + "complexity": 2, + "token_count": 152, + "parameters": [ + "self", + "default_lib_dirs", + "default_include_dirs" + ], + "start_line": 141, + "end_line": 157, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "set_info", + "long_name": "set_info( self , ** info )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "info" + ], + "start_line": 159, + "end_line": 160, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "has_info", + "long_name": "has_info( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self" + ], + "start_line": 161, + "end_line": 162, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_info", + "long_name": "get_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 9, + "token_count": 113, + "parameters": [ + "self" + ], + "start_line": 163, + "end_line": 185, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "calc_info_template", + "long_name": "calc_info_template( self , prefix )", + "filename": "system_info.py", + "nloc": 1, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self", + "prefix" + ], + "start_line": 187, + "end_line": 188, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 3, + "token_count": 70, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 190, + "end_line": 194, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "get_lib_dirs", + "long_name": "get_lib_dirs( self , key = 'lib_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 196, + "end_line": 197, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_include_dirs", + "long_name": "get_include_dirs( self , key = 'include_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 198, + "end_line": 199, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_libs", + "long_name": "get_libs( self , key , default )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "key", + "default" + ], + "start_line": 201, + "end_line": 206, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "check_libs", + "long_name": "check_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 4, + "token_count": 60, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 208, + "end_line": 216, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "check_static_libs", + "long_name": "check_static_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 5, + "token_count": 91, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 218, + "end_line": 225, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "check_shared_libs", + "long_name": "check_shared_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 13, + "complexity": 6, + "token_count": 119, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 227, + "end_line": 239, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 245, + "end_line": 246, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 69, + "complexity": 24, + "token_count": 443, + "parameters": [ + "self" + ], + "start_line": 248, + "end_line": 319, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 72, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 4, + "token_count": 91, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 325, + "end_line": 330, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 24, + "complexity": 8, + "token_count": 168, + "parameters": [ + "self" + ], + "start_line": 332, + "end_line": 358, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 27, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 4, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 373, + "end_line": 376, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 7, + "token_count": 110, + "parameters": [ + "self" + ], + "start_line": 378, + "end_line": 397, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "shortest_path", + "long_name": "shortest_path( pths )", + "filename": "system_info.py", + "nloc": 3, + "complexity": 2, + "token_count": 18, + "parameters": [ + "pths" + ], + "start_line": 399, + "end_line": 401, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "combine_paths", + "long_name": "combine_paths( * args )", + "filename": "system_info.py", + "nloc": 19, + "complexity": 9, + "token_count": 162, + "parameters": [ + "args" + ], + "start_line": 403, + "end_line": 424, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "dict_append", + "long_name": "dict_append( d , ** kws )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 44, + "parameters": [ + "d", + "kws" + ], + "start_line": 426, + "end_line": 431, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "show_all", + "long_name": "show_all( )", + "filename": "system_info.py", + "nloc": 8, + "complexity": 3, + "token_count": 59, + "parameters": [], + "start_line": 433, + "end_line": 440, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + } + ], + "changed_methods": [], + "nloc": 376, + "complexity": 100, + "token_count": 2197, + "diff_parsed": { + "added": [ + " default_lib_dirs.insert(0,os.path.join(sys.prefix, 'lib'))", + "# default_lib_dirs.append(os.path.join(sys.prefix, 'lib'))" + ], + "deleted": [ + " default_lib_dirs.append(os.path.join(sys.prefix, 'lib'))" + ] + } + } + ] + }, + { + "hash": "f12841acc066ac7ea8db9d6ccccbfeddb2be29ca", + "msg": "Fixed typo in mconf_BE.h and limits import in plt", + "author": { + "name": "Pearu Peterson", + "email": "pearu.peterson@gmail.com" + }, + "committer": { + "name": "Pearu Peterson", + "email": "pearu.peterson@gmail.com" + }, + "author_date": "2002-04-09T17:38:40+00:00", + "author_timezone": 0, + "committer_date": "2002-04-09T17:38:40+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "5e2f226d1ef47f124f4b529bcf5ba71b3829e4b4" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 1, + "insertions": 1, + "lines": 2, + "files": 1, + "dmm_unit_size": null, + "dmm_unit_complexity": null, + "dmm_unit_interfacing": null, + "modified_files": [ + { + "old_path": "scipy_base/mconf_lite_BE.h", + "new_path": "scipy_base/mconf_lite_BE.h", + "filename": "mconf_lite_BE.h", + "extension": "h", + "change_type": "MODIFY", + "diff": "@@ -86,7 +86,7 @@ Modified to handle just the parts necessary for isnan to work.\n defined(__convex__) || defined(DGUX) || defined(hppa) || \\\n defined(apollo) || defined(_CRAY) || defined(__hppa) || \\\n defined(__hp9000) || defined(__hp9000s300) || \\\n- defined(__hp9000s700) || defined(__AIX) || defined(_AIX) \\\n+ defined(__hp9000s700) || defined(__AIX) || defined(_AIX) || \\\n defined(__pyr__) || defined(__mc68000__) || defined(__sparc) ||\\\n defined(_IBMR2) || defined (BIT_ZERO_ON_LEFT) \n #define MIEEE 1 /* Motorola IEEE, high order words come first */\n", + "added_lines": 1, + "deleted_lines": 1, + "source_code": "/*\t\t\t\t\t\t\tmconf_lite.h\n *\n *\tCommon include file for math routines\n *\n *\n *\n * SYNOPSIS:\n *\n * #include \"mconf_lite.h\"\n *\n *\n *\n * DESCRIPTION:\n *\n * The file also includes a conditional assembly definition\n * for the type of computer arithmetic (IEEE, DEC, Motorola\n * IEEE, or UNKnown).\n * \n * For Digital Equipment PDP-11 and VAX computers, certain\n * IBM systems, and others that use numbers with a 56-bit\n * significand, the symbol DEC should be defined. In this\n * mode, most floating point constants are given as arrays\n * of octal integers to eliminate decimal to binary conversion\n * errors that might be introduced by the compiler.\n *\n * For little-endian computers, such as IBM PC, that follow the\n * IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE\n * Std 754-1985), the symbol IBMPC should be defined. These\n * numbers have 53-bit significands. In this mode, constants\n * are provided as arrays of hexadecimal 16 bit integers.\n *\n * Big-endian IEEE format is denoted MIEEE. On some RISC\n * systems such as Sun SPARC, double precision constants\n * must be stored on 8-byte address boundaries. Since integer\n * arrays may be aligned differently, the MIEEE configuration\n * may fail on such machines.\n *\n * To accommodate other types of computer arithmetic, all\n * constants are also provided in a normal decimal radix\n * which one can hope are correctly converted to a suitable\n * format by the available C language compiler. To invoke\n * this mode, define the symbol UNK.\n *\n * An important difference among these modes is a predefined\n * set of machine arithmetic constants for each. The numbers\n * MACHEP (the machine roundoff error), MAXNUM (largest number\n * represented), and several other parameters are preset by\n * the configuration symbol. Check the file const.c to\n * ensure that these values are correct for your computer.\n *\n * Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL\n * may fail on many systems. Verify that they are supposed\n * to work on your computer.\n */\n\f\n/*\nCephes Math Library Release 2.3: June, 1995\nCopyright 1984, 1987, 1989, 1995 by Stephen L. Moshier\n\nModified to handle just the parts necessary for isnan to work.\n*/\n\n\n/* Type of computer arithmetic */\n\n/* PDP-11, Pro350, VAX:\n */\n/* #define DEC 1 */\n\n/* Not sure about these pdp defines */\n#if defined(vax) || defined(__vax__) || defined(decvax) || \\\n defined(__decvax__) || defined(pro350) || defined(pdp11)\n#define DEC 1 \n\n#elif defined(ns32000) || defined(sun386) || \\\n defined(i386) || defined(MIPSEL) || defined(_MIPSEL) || \\\n defined(BIT_ZERO_ON_RIGHT) || defined(__alpha__) || defined(__alpha) || \\\n defined(sequent) || defined(i386) || \\\n defined(__ns32000__) || defined(__sun386__) || defined(__i386__)\n#define IBMPC 1 /* Intel IEEE, low order words come first */\n#define BIGENDIAN 0\n\n#elif defined(sel) || defined(pyr) || defined(mc68000) || defined (m68k) || \\\n defined(is68k) || defined(tahoe) || defined(ibm032) || \\\n defined(ibm370) || defined(MIPSEB) || defined(_MIPSEB) || \\\n defined(__convex__) || defined(DGUX) || defined(hppa) || \\\n defined(apollo) || defined(_CRAY) || defined(__hppa) || \\\n defined(__hp9000) || defined(__hp9000s300) || \\\n defined(__hp9000s700) || defined(__AIX) || defined(_AIX) || \\\n defined(__pyr__) || defined(__mc68000__) || defined(__sparc) ||\\\n defined(_IBMR2) || defined (BIT_ZERO_ON_LEFT) \n#define MIEEE 1 /* Motorola IEEE, high order words come first */\n#define BIGENDIAN 1\n\n#else \n#define UNK 1 /* Machine not known */\n#define BIGENDIAN 1 /* This is a BE file */\n#endif\n\n\n/* Define to ask for infinity support, else undefine. */\n#define INFINITIES 1\n\n/* Define to ask for support of numbers that are Not-a-Number,\n else undefine. This may automatically define INFINITIES in some files. */\n#define NANS 1\n\n/* Define to distinguish between -0.0 and +0.0. */\n#define MINUSZERO 1\n\n#if !defined(signbit)\nint signbit(double);\n#endif\n#if !defined(isnan)\nint isnan(double);\n#endif\n#if !defined(isfinite)\nint isfinite(double);\n#endif\n", + "source_code_before": "/*\t\t\t\t\t\t\tmconf_lite.h\n *\n *\tCommon include file for math routines\n *\n *\n *\n * SYNOPSIS:\n *\n * #include \"mconf_lite.h\"\n *\n *\n *\n * DESCRIPTION:\n *\n * The file also includes a conditional assembly definition\n * for the type of computer arithmetic (IEEE, DEC, Motorola\n * IEEE, or UNKnown).\n * \n * For Digital Equipment PDP-11 and VAX computers, certain\n * IBM systems, and others that use numbers with a 56-bit\n * significand, the symbol DEC should be defined. In this\n * mode, most floating point constants are given as arrays\n * of octal integers to eliminate decimal to binary conversion\n * errors that might be introduced by the compiler.\n *\n * For little-endian computers, such as IBM PC, that follow the\n * IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE\n * Std 754-1985), the symbol IBMPC should be defined. These\n * numbers have 53-bit significands. In this mode, constants\n * are provided as arrays of hexadecimal 16 bit integers.\n *\n * Big-endian IEEE format is denoted MIEEE. On some RISC\n * systems such as Sun SPARC, double precision constants\n * must be stored on 8-byte address boundaries. Since integer\n * arrays may be aligned differently, the MIEEE configuration\n * may fail on such machines.\n *\n * To accommodate other types of computer arithmetic, all\n * constants are also provided in a normal decimal radix\n * which one can hope are correctly converted to a suitable\n * format by the available C language compiler. To invoke\n * this mode, define the symbol UNK.\n *\n * An important difference among these modes is a predefined\n * set of machine arithmetic constants for each. The numbers\n * MACHEP (the machine roundoff error), MAXNUM (largest number\n * represented), and several other parameters are preset by\n * the configuration symbol. Check the file const.c to\n * ensure that these values are correct for your computer.\n *\n * Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL\n * may fail on many systems. Verify that they are supposed\n * to work on your computer.\n */\n\f\n/*\nCephes Math Library Release 2.3: June, 1995\nCopyright 1984, 1987, 1989, 1995 by Stephen L. Moshier\n\nModified to handle just the parts necessary for isnan to work.\n*/\n\n\n/* Type of computer arithmetic */\n\n/* PDP-11, Pro350, VAX:\n */\n/* #define DEC 1 */\n\n/* Not sure about these pdp defines */\n#if defined(vax) || defined(__vax__) || defined(decvax) || \\\n defined(__decvax__) || defined(pro350) || defined(pdp11)\n#define DEC 1 \n\n#elif defined(ns32000) || defined(sun386) || \\\n defined(i386) || defined(MIPSEL) || defined(_MIPSEL) || \\\n defined(BIT_ZERO_ON_RIGHT) || defined(__alpha__) || defined(__alpha) || \\\n defined(sequent) || defined(i386) || \\\n defined(__ns32000__) || defined(__sun386__) || defined(__i386__)\n#define IBMPC 1 /* Intel IEEE, low order words come first */\n#define BIGENDIAN 0\n\n#elif defined(sel) || defined(pyr) || defined(mc68000) || defined (m68k) || \\\n defined(is68k) || defined(tahoe) || defined(ibm032) || \\\n defined(ibm370) || defined(MIPSEB) || defined(_MIPSEB) || \\\n defined(__convex__) || defined(DGUX) || defined(hppa) || \\\n defined(apollo) || defined(_CRAY) || defined(__hppa) || \\\n defined(__hp9000) || defined(__hp9000s300) || \\\n defined(__hp9000s700) || defined(__AIX) || defined(_AIX) \\\n defined(__pyr__) || defined(__mc68000__) || defined(__sparc) ||\\\n defined(_IBMR2) || defined (BIT_ZERO_ON_LEFT) \n#define MIEEE 1 /* Motorola IEEE, high order words come first */\n#define BIGENDIAN 1\n\n#else \n#define UNK 1 /* Machine not known */\n#define BIGENDIAN 1 /* This is a BE file */\n#endif\n\n\n/* Define to ask for infinity support, else undefine. */\n#define INFINITIES 1\n\n/* Define to ask for support of numbers that are Not-a-Number,\n else undefine. This may automatically define INFINITIES in some files. */\n#define NANS 1\n\n/* Define to distinguish between -0.0 and +0.0. */\n#define MINUSZERO 1\n\n#if !defined(signbit)\nint signbit(double);\n#endif\n#if !defined(isnan)\nint isnan(double);\n#endif\n#if !defined(isfinite)\nint isfinite(double);\n#endif\n", + "methods": [], + "methods_before": [], + "changed_methods": [], + "nloc": 3, + "complexity": 0, + "token_count": 18, + "diff_parsed": { + "added": [ + " defined(__hp9000s700) || defined(__AIX) || defined(_AIX) || \\" + ], + "deleted": [ + " defined(__hp9000s700) || defined(__AIX) || defined(_AIX) \\" + ] + } + } + ] + }, + { + "hash": "52a0610b4cd42a5e278b08340fcf375e090a4e32", + "msg": "fixed a test that was broken. The test also points out that exceptions can be skipped with when the C++ code isn't constructed correctly.", + "author": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "committer": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "author_date": "2002-04-11T13:34:18+00:00", + "author_timezone": 0, + "committer_date": "2002-04-11T13:34:18+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "f12841acc066ac7ea8db9d6ccccbfeddb2be29ca" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 4, + "insertions": 5, + "lines": 9, + "files": 1, + "dmm_unit_size": 0.0, + "dmm_unit_complexity": 1.0, + "dmm_unit_interfacing": 1.0, + "modified_files": [ + { + "old_path": "weave/tests/test_inline_tools.py", + "new_path": "weave/tests/test_inline_tools.py", + "filename": "test_inline_tools.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -14,17 +14,18 @@ class test_inline(unittest.TestCase):\n I'd like to benchmark these things somehow.\n \"\"\"\n def check_exceptions(self):\n- a = 1 \n+ a = 3 \n code = \"\"\"\n if (a < 2)\n Py::ValueError(\"the variable 'a' should not be less than 2\");\n- return_val = Py::new_reference_to(Py::Int(a+1));\n+ else \n+ return_val = Py::new_reference_to(Py::Int(a+1));\n \"\"\"\n result = inline_tools.inline(code,['a'])\n- assert(result == 2)\n+ assert(result == 4)\n \n try:\n- a = 3\n+ a = 1\n result = inline_tools.inline(code,['a'])\n assert(1) # should've thrown a ValueError\n except ValueError:\n", + "added_lines": 5, + "deleted_lines": 4, + "source_code": "import unittest\nfrom Numeric import *\n\nfrom scipy_distutils.misc_util import add_grandparent_to_path,restore_path\nfrom scipy_distutils.misc_util import add_local_to_path\n\nadd_grandparent_to_path(__name__)\nimport inline_tools\nrestore_path()\n\nclass test_inline(unittest.TestCase):\n \"\"\" These are long running tests...\n \n I'd like to benchmark these things somehow.\n \"\"\"\n def check_exceptions(self):\n a = 3 \n code = \"\"\"\n if (a < 2)\n Py::ValueError(\"the variable 'a' should not be less than 2\");\n else \n return_val = Py::new_reference_to(Py::Int(a+1));\n \"\"\"\n result = inline_tools.inline(code,['a'])\n assert(result == 4)\n \n try:\n a = 1\n result = inline_tools.inline(code,['a'])\n assert(1) # should've thrown a ValueError\n except ValueError:\n pass\n \n from distutils.errors import DistutilsError, CompileError \n try:\n a = 'string'\n result = inline_tools.inline(code,['a'])\n assert(1) # should've gotten an error\n except: \n # ?CompileError is the error reported, but catching it doesn't work\n pass\n \ndef test_suite(level=1):\n suites = []\n if level >= 5:\n suites.append( unittest.makeSuite(test_inline,'check_') ) \n total_suite = unittest.TestSuite(suites)\n return total_suite\n\ndef test(level=10):\n all_tests = test_suite(level)\n runner = unittest.TextTestRunner()\n runner.run(all_tests)\n return runner\n\nif __name__ == \"__main__\":\n test()\n", + "source_code_before": "import unittest\nfrom Numeric import *\n\nfrom scipy_distutils.misc_util import add_grandparent_to_path,restore_path\nfrom scipy_distutils.misc_util import add_local_to_path\n\nadd_grandparent_to_path(__name__)\nimport inline_tools\nrestore_path()\n\nclass test_inline(unittest.TestCase):\n \"\"\" These are long running tests...\n \n I'd like to benchmark these things somehow.\n \"\"\"\n def check_exceptions(self):\n a = 1 \n code = \"\"\"\n if (a < 2)\n Py::ValueError(\"the variable 'a' should not be less than 2\");\n return_val = Py::new_reference_to(Py::Int(a+1));\n \"\"\"\n result = inline_tools.inline(code,['a'])\n assert(result == 2)\n \n try:\n a = 3\n result = inline_tools.inline(code,['a'])\n assert(1) # should've thrown a ValueError\n except ValueError:\n pass\n \n from distutils.errors import DistutilsError, CompileError \n try:\n a = 'string'\n result = inline_tools.inline(code,['a'])\n assert(1) # should've gotten an error\n except: \n # ?CompileError is the error reported, but catching it doesn't work\n pass\n \ndef test_suite(level=1):\n suites = []\n if level >= 5:\n suites.append( unittest.makeSuite(test_inline,'check_') ) \n total_suite = unittest.TestSuite(suites)\n return total_suite\n\ndef test(level=10):\n all_tests = test_suite(level)\n runner = unittest.TextTestRunner()\n runner.run(all_tests)\n return runner\n\nif __name__ == \"__main__\":\n test()\n", + "methods": [ + { + "name": "check_exceptions", + "long_name": "check_exceptions( self )", + "filename": "test_inline_tools.py", + "nloc": 23, + "complexity": 3, + "token_count": 86, + "parameters": [ + "self" + ], + "start_line": 16, + "end_line": 41, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "test_suite", + "long_name": "test_suite( level = 1 )", + "filename": "test_inline_tools.py", + "nloc": 6, + "complexity": 2, + "token_count": 39, + "parameters": [ + "level" + ], + "start_line": 43, + "end_line": 48, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "test", + "long_name": "test( level = 10 )", + "filename": "test_inline_tools.py", + "nloc": 5, + "complexity": 1, + "token_count": 28, + "parameters": [ + "level" + ], + "start_line": 50, + "end_line": 54, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "check_exceptions", + "long_name": "check_exceptions( self )", + "filename": "test_inline_tools.py", + "nloc": 22, + "complexity": 3, + "token_count": 86, + "parameters": [ + "self" + ], + "start_line": 16, + "end_line": 40, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 1 + }, + { + "name": "test_suite", + "long_name": "test_suite( level = 1 )", + "filename": "test_inline_tools.py", + "nloc": 6, + "complexity": 2, + "token_count": 39, + "parameters": [ + "level" + ], + "start_line": 42, + "end_line": 47, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "test", + "long_name": "test( level = 10 )", + "filename": "test_inline_tools.py", + "nloc": 5, + "complexity": 1, + "token_count": 28, + "parameters": [ + "level" + ], + "start_line": 49, + "end_line": 53, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + } + ], + "changed_methods": [ + { + "name": "check_exceptions", + "long_name": "check_exceptions( self )", + "filename": "test_inline_tools.py", + "nloc": 23, + "complexity": 3, + "token_count": 86, + "parameters": [ + "self" + ], + "start_line": 16, + "end_line": 41, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + } + ], + "nloc": 48, + "complexity": 6, + "token_count": 202, + "diff_parsed": { + "added": [ + " a = 3", + " else", + " return_val = Py::new_reference_to(Py::Int(a+1));", + " assert(result == 4)", + " a = 1" + ], + "deleted": [ + " a = 1", + " return_val = Py::new_reference_to(Py::Int(a+1));", + " assert(result == 2)", + " a = 3" + ] + } + } + ] + }, + { + "hash": "ec4b02730139956f1c3963238958fc7c71fb7a6c", + "msg": "improved how error is thrown in test", + "author": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "committer": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "author_date": "2002-04-11T13:46:54+00:00", + "author_timezone": 0, + "committer_date": "2002-04-11T13:46:54+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "52a0610b4cd42a5e278b08340fcf375e090a4e32" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 1, + "insertions": 2, + "lines": 3, + "files": 1, + "dmm_unit_size": 0.0, + "dmm_unit_complexity": 1.0, + "dmm_unit_interfacing": 1.0, + "modified_files": [ + { + "old_path": "weave/tests/test_inline_tools.py", + "new_path": "weave/tests/test_inline_tools.py", + "filename": "test_inline_tools.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -17,7 +17,8 @@ def check_exceptions(self):\n a = 3 \n code = \"\"\"\n if (a < 2)\n- Py::ValueError(\"the variable 'a' should not be less than 2\");\n+ throw throw_error(PyExc_ValueError,\n+ \"the variable 'a' should not be less than 2\");\n else \n return_val = Py::new_reference_to(Py::Int(a+1));\n \"\"\"\n", + "added_lines": 2, + "deleted_lines": 1, + "source_code": "import unittest\nfrom Numeric import *\n\nfrom scipy_distutils.misc_util import add_grandparent_to_path,restore_path\nfrom scipy_distutils.misc_util import add_local_to_path\n\nadd_grandparent_to_path(__name__)\nimport inline_tools\nrestore_path()\n\nclass test_inline(unittest.TestCase):\n \"\"\" These are long running tests...\n \n I'd like to benchmark these things somehow.\n \"\"\"\n def check_exceptions(self):\n a = 3 \n code = \"\"\"\n if (a < 2)\n throw throw_error(PyExc_ValueError,\n \"the variable 'a' should not be less than 2\");\n else \n return_val = Py::new_reference_to(Py::Int(a+1));\n \"\"\"\n result = inline_tools.inline(code,['a'])\n assert(result == 4)\n \n try:\n a = 1\n result = inline_tools.inline(code,['a'])\n assert(1) # should've thrown a ValueError\n except ValueError:\n pass\n \n from distutils.errors import DistutilsError, CompileError \n try:\n a = 'string'\n result = inline_tools.inline(code,['a'])\n assert(1) # should've gotten an error\n except: \n # ?CompileError is the error reported, but catching it doesn't work\n pass\n \ndef test_suite(level=1):\n suites = []\n if level >= 5:\n suites.append( unittest.makeSuite(test_inline,'check_') ) \n total_suite = unittest.TestSuite(suites)\n return total_suite\n\ndef test(level=10):\n all_tests = test_suite(level)\n runner = unittest.TextTestRunner()\n runner.run(all_tests)\n return runner\n\nif __name__ == \"__main__\":\n test()\n", + "source_code_before": "import unittest\nfrom Numeric import *\n\nfrom scipy_distutils.misc_util import add_grandparent_to_path,restore_path\nfrom scipy_distutils.misc_util import add_local_to_path\n\nadd_grandparent_to_path(__name__)\nimport inline_tools\nrestore_path()\n\nclass test_inline(unittest.TestCase):\n \"\"\" These are long running tests...\n \n I'd like to benchmark these things somehow.\n \"\"\"\n def check_exceptions(self):\n a = 3 \n code = \"\"\"\n if (a < 2)\n Py::ValueError(\"the variable 'a' should not be less than 2\");\n else \n return_val = Py::new_reference_to(Py::Int(a+1));\n \"\"\"\n result = inline_tools.inline(code,['a'])\n assert(result == 4)\n \n try:\n a = 1\n result = inline_tools.inline(code,['a'])\n assert(1) # should've thrown a ValueError\n except ValueError:\n pass\n \n from distutils.errors import DistutilsError, CompileError \n try:\n a = 'string'\n result = inline_tools.inline(code,['a'])\n assert(1) # should've gotten an error\n except: \n # ?CompileError is the error reported, but catching it doesn't work\n pass\n \ndef test_suite(level=1):\n suites = []\n if level >= 5:\n suites.append( unittest.makeSuite(test_inline,'check_') ) \n total_suite = unittest.TestSuite(suites)\n return total_suite\n\ndef test(level=10):\n all_tests = test_suite(level)\n runner = unittest.TextTestRunner()\n runner.run(all_tests)\n return runner\n\nif __name__ == \"__main__\":\n test()\n", + "methods": [ + { + "name": "check_exceptions", + "long_name": "check_exceptions( self )", + "filename": "test_inline_tools.py", + "nloc": 24, + "complexity": 3, + "token_count": 86, + "parameters": [ + "self" + ], + "start_line": 16, + "end_line": 42, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 27, + "top_nesting_level": 1 + }, + { + "name": "test_suite", + "long_name": "test_suite( level = 1 )", + "filename": "test_inline_tools.py", + "nloc": 6, + "complexity": 2, + "token_count": 39, + "parameters": [ + "level" + ], + "start_line": 44, + "end_line": 49, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "test", + "long_name": "test( level = 10 )", + "filename": "test_inline_tools.py", + "nloc": 5, + "complexity": 1, + "token_count": 28, + "parameters": [ + "level" + ], + "start_line": 51, + "end_line": 55, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "check_exceptions", + "long_name": "check_exceptions( self )", + "filename": "test_inline_tools.py", + "nloc": 23, + "complexity": 3, + "token_count": 86, + "parameters": [ + "self" + ], + "start_line": 16, + "end_line": 41, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "test_suite", + "long_name": "test_suite( level = 1 )", + "filename": "test_inline_tools.py", + "nloc": 6, + "complexity": 2, + "token_count": 39, + "parameters": [ + "level" + ], + "start_line": 43, + "end_line": 48, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "test", + "long_name": "test( level = 10 )", + "filename": "test_inline_tools.py", + "nloc": 5, + "complexity": 1, + "token_count": 28, + "parameters": [ + "level" + ], + "start_line": 50, + "end_line": 54, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + } + ], + "changed_methods": [ + { + "name": "check_exceptions", + "long_name": "check_exceptions( self )", + "filename": "test_inline_tools.py", + "nloc": 24, + "complexity": 3, + "token_count": 86, + "parameters": [ + "self" + ], + "start_line": 16, + "end_line": 42, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 27, + "top_nesting_level": 1 + } + ], + "nloc": 49, + "complexity": 6, + "token_count": 202, + "diff_parsed": { + "added": [ + " throw throw_error(PyExc_ValueError,", + " \"the variable 'a' should not be less than 2\");" + ], + "deleted": [ + " Py::ValueError(\"the variable 'a' should not be less than 2\");" + ] + } + } + ] + }, + { + "hash": "577d7613c5e1b6ad60772ff7509d81dd40720188", + "msg": "Enabled using ATLAS env.var. again and fixed typo in stats tests", + "author": { + "name": "Pearu Peterson", + "email": "pearu.peterson@gmail.com" + }, + "committer": { + "name": "Pearu Peterson", + "email": "pearu.peterson@gmail.com" + }, + "author_date": "2002-04-11T18:20:15+00:00", + "author_timezone": 0, + "committer_date": "2002-04-11T18:20:15+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "ec4b02730139956f1c3963238958fc7c71fb7a6c" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 0, + "insertions": 2, + "lines": 2, + "files": 1, + "dmm_unit_size": 1.0, + "dmm_unit_complexity": 1.0, + "dmm_unit_interfacing": 0.0, + "modified_files": [ + { + "old_path": "scipy_distutils/system_info.py", + "new_path": "scipy_distutils/system_info.py", + "filename": "system_info.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -325,6 +325,8 @@ class atlas_info(system_info):\n \n def get_paths(self, section, key):\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n+ if os.environ.has_key('ATLAS'):\n+ default_dirs.append(os.environ['ATLAS'])\n dirs = []\n for d in self.cp.get(section, key).split(os.pathsep) + default_dirs:\n dirs.extend([d]+combine_paths(d,['atlas*','ATLAS*']))\n", + "added_lines": 2, + "deleted_lines": 0, + "source_code": "#!/usr/bin/env python\n\"\"\"\nThis file defines a set of system_info classes for getting\ninformation about various resources (libraries, library directories,\ninclude directories, etc.) in the system. Currently, the following\nclasses are available:\n atlas_info\n fftw_info\n x11_info\n\nUsage:\n info_dict = get_info()\n where is a string 'atlas','x11','fftw'.\n\n Returned info_dict is a dictionary which is compatible with\n distutils.setup keyword arguments. If info_dict == {}, then the\n asked resource is not available (or system_info could not find it).\n\nGlobal parameters:\n system_info.static_first - a flag for indicating that static\n libraries are searched first than shared ones.\n system_info.verbose - show the results if set.\n\nThe file 'site.cfg' in the same directory as this module is read\nfor configuration options. The format is that used by ConfigParser (i.e.,\nWindows .INI style). The section DEFAULT has options that are the default\nfor each section. The available sections are fftw, atlas, and x11. Appropiate\ndefaults are used if nothing is specified.\n\nExample:\n----------\n[DEFAULT]\nlib_dir = /usr/lib:/usr/local/lib:/opt/lib\ninclude_dir = /usr/include:/usr/local/include:/opt/include\n# use static libraries in preference to shared ones\nstatic_first = 1\n\n[fftw]\nfftw_libs = fftw, rfftw\nfftw_opt_libs = fftw_threaded, rfftw_threaded\n# if the above aren't found, look for {s,d}fftw_libs and {s,d}fftw_opt_libs\n\n[atlas]\nlib_dir = /usr/lib/3dnow:/usr/lib/3dnow/atlas\n# for overriding the names of the atlas libraries\natlas_libs = f77blas, cblas, atlas\nlapack_libs = lapack\n\n[x11]\nlib_dir = /usr/X11R6/lib\ninclude_dir = /usr/X11R6/include\n----------\n\nAuthors:\n Pearu Peterson , February 2002\n David M. Cooke , April 2002\n\nCopyright 2002 Pearu Peterson all rights reserved,\nPearu Peterson \nPermission to use, modify, and distribute this software is given under the \nterms of the SciPy (BSD style) license. See LICENSE.txt that came with\nthis distribution for specifics.\n\nNO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n\"\"\"\n\nimport sys,os,re,types\nfrom distutils.errors import DistutilsError\nfrom glob import glob\nimport ConfigParser\n\nfrom distutils.sysconfig import get_config_vars\n\nif sys.platform == 'win32':\n default_lib_dirs = ['C:\\\\'] # probably not very helpful...\n default_include_dirs = []\n default_x11_lib_dirs = []\n default_x11_include_dirs = []\nelse:\n default_lib_dirs = ['/usr/local/lib', '/opt/lib', '/usr/lib']\n default_include_dirs = ['/usr/local/include',\n '/opt/include', '/usr/include']\n default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib']\n default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include']\n\nif os.path.join(sys.prefix, 'lib') not in default_lib_dirs:\n default_lib_dirs.insert(0,os.path.join(sys.prefix, 'lib'))\n# default_lib_dirs.append(os.path.join(sys.prefix, 'lib'))\n default_include_dirs.append(os.path.join(sys.prefix, 'include'))\ndefault_lib_dirs = filter(os.path.isdir, default_lib_dirs)\ndefault_include_dirs = filter(os.path.isdir, default_include_dirs)\n\nso_ext = get_config_vars('SO')[0] or ''\n\ndef get_info(name):\n cl = {'atlas':atlas_info,\n 'x11':x11_info,\n 'fftw':fftw_info}.get(name.lower(),system_info)\n return cl().get_info()\n\nclass NotFoundError(DistutilsError):\n \"\"\"Some third-party program or library is not found.\"\"\"\n\nclass AtlasNotFoundError(NotFoundError):\n \"\"\"\n Atlas (http://math-atlas.sourceforge.net/) libraries not found.\n Either install them in /usr/local/lib/atlas or /usr/lib/atlas\n and retry setup.py. One can use also ATLAS environment variable\n to indicate the location of Atlas libraries.\"\"\"\n\nclass FFTWNotFoundError(NotFoundError):\n \"\"\"\n FFTW (http://www.fftw.org/) libraries not found.\n Either install them in /usr/local/lib or /usr/lib and retry setup.py.\n One can use also FFTW environment variable to indicate\n the location of FFTW libraries.\"\"\"\n\nclass F2pyNotFoundError(NotFoundError):\n \"\"\"\n f2py2e (http://cens.ioc.ee/projects/f2py2e/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass NumericNotFoundError(NotFoundError):\n \"\"\"\n Numeric (http://www.numpy.org/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass X11NotFoundError(NotFoundError):\n \"\"\"X11 libraries not found.\"\"\"\n\nclass system_info:\n\n \"\"\" get_info() is the only public method. Don't use others.\n \"\"\"\n section = 'DEFAULT'\n\n static_first = 1\n verbose = 1\n need_refresh = 1\n saved_results = {}\n\n def __init__ (self,\n default_lib_dirs=default_lib_dirs,\n default_include_dirs=default_include_dirs,\n ):\n self.__class__.info = {}\n self.local_prefixes = []\n defaults = {}\n defaults['lib_dir'] = os.pathsep.join(default_lib_dirs)\n defaults['include_dir'] = os.pathsep.join(default_include_dirs)\n defaults['static_first'] = '1'\n self.cp = ConfigParser.ConfigParser(defaults)\n cf = os.path.join(os.path.split(os.path.abspath(__file__))[0],\n 'site.cfg')\n self.cp.read([cf])\n if not self.cp.has_section(self.section):\n self.cp.add_section(self.section)\n self.static_first = self.cp.getboolean(self.section, 'static_first')\n\n def set_info(self,**info):\n self.saved_results[self.__class__.__name__] = info\n def has_info(self):\n return self.saved_results.has_key(self.__class__.__name__)\n def get_info(self):\n \"\"\" Return a dictonary with items that are compatible\n with scipy_distutils.setup keyword arguments.\n \"\"\"\n flag = 0\n if not self.has_info():\n flag = 1\n if self.verbose:\n print self.__class__.__name__ + ':'\n if hasattr(self, 'calc_info'):\n self.calc_info()\n if self.verbose:\n if not self.has_info():\n print ' NOT AVAILABLE'\n self.set_info()\n else:\n print ' FOUND:'\n res = self.saved_results.get(self.__class__.__name__)\n if self.verbose and flag:\n for k,v in res.items():\n print ' %s = %s'%(k,v)\n print\n return res\n\n def calc_info_template(self,prefix):\n \"\"\" Calculate info dictionary. \"\"\"\n\n def get_paths(self, section, key):\n dirs = self.cp.get(section, key).split(os.pathsep)\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs.extend(default_dirs)\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def get_lib_dirs(self, key='lib_dir'):\n return self.get_paths(self.section, key)\n def get_include_dirs(self, key='include_dir'):\n return self.get_paths(self.section, key)\n\n def get_libs(self, key, default):\n try:\n libs = self.cp.get(self.section, key)\n except ConfigParser.NoOptionError:\n return default\n return [a.strip() for a in libs.split(',')]\n\n def check_libs(self,lib_dir,libs,opt_libs =[]):\n \"\"\" If static or shared libraries are available then return\n their info dictionary. \"\"\"\n mths = [self.check_static_libs,self.check_shared_libs]\n if not self.static_first:\n mths.reverse() # if one prefers shared libraries\n for m in mths:\n info = m(lib_dir,libs,opt_libs)\n if info is not None: return info\n\n def check_static_libs(self,lib_dir,libs,opt_libs =[]):\n #XXX: what are .lib and .dll files under win32?\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs])) == len(libs):\n info = {'libraries':libs,'library_dirs':[lib_dir]}\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs]))\\\n ==len(opt_libs):\n info['libraries'].extend(opt_libs)\n return info\n\n def check_shared_libs(self,lib_dir,libs,opt_libs =[]):\n shared_libs = []\n for l in libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: shared_libs.append(p)\n if len(shared_libs) == len(libs):\n info = {'extra_objects':shared_libs}\n opt_shared_libs = []\n for l in opt_libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: opt_shared_libs.append(p)\n info['extra_objects'].extend(opt_shared_libs)\n return info\n\n\nclass fftw_info(system_info):\n section = 'fftw'\n\n def __init__(self):\n system_info.__init__(self)\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n incl_dirs = self.get_include_dirs()\n incl_dir = None\n\n libs = self.get_libs('fftw_libs', ['fftw','rfftw'])\n opt_libs = self.get_libs('fftw_opt_libs',\n ['fftw_threads','rfftw_threads'])\n info = None\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['fftw.h','rfftw.h']))==2:\n dict_append(info,include_dirs=[d])\n flag = 1\n incl_dirs = [d]\n incl_dir = d\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_FFTW_H',1)])\n else:\n info = None\n\n if info is None:\n libs = self.get_libs('dfftw_libs', ['dfftw', 'drfftw'])\n opt_libs = self.get_libs('dfftw_opt_libs',\n ['dfftw_threads', 'drfftw_threads'])\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['dfftw.h','drfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n incl_dirs = [d]\n incl_dir = d\n flag = 1\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_DFFTW_H',1)])\n else:\n info = None\n\n libs = self.get_libs('sfftw_libs', ['sfftw', 'srfftw'])\n opt_libs = self.get_libs('sfftw_opt_libs',\n ['sfftw_threads', 'srfftw_threads'])\n flag = 0\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n if info is None: info = r\n else: dict_append(info,**r)\n flag = 1\n break\n if info is not None and flag:\n for d in incl_dirs:\n if len(combine_paths(d,['sfftw.h','srfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n dict_append(info,define_macros=[('SCIPY_SFFTW_H',1)])\n break\n if info is not None:\n self.set_info(**info)\n\n\nclass atlas_info(system_info):\n section = 'atlas'\n\n def get_paths(self, section, key):\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n if os.environ.has_key('ATLAS'):\n default_dirs.append(os.environ['ATLAS'])\n dirs = []\n for d in self.cp.get(section, key).split(os.pathsep) + default_dirs:\n dirs.extend([d]+combine_paths(d,['atlas*','ATLAS*']))\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n\n h = (combine_paths(lib_dirs+include_dirs,'cblas.h') or [None])[0]\n if h: h = os.path.dirname(h)\n info = None\n # lapack must appear before atlas\n lapack_libs = self.get_libs('lapack_libs', ['lapack'])\n for d in lib_dirs:\n lapack = self.check_libs(d,lapack_libs,[])\n if lapack is not None:\n info = lapack \n break\n else:\n return\n atlas_libs = self.get_libs('atlas_libs', ['f77blas', 'cblas', 'atlas'])\n for d in lib_dirs:\n atlas = self.check_libs(d,atlas_libs,[])\n if atlas is not None:\n dict_append(info, **atlas)\n break\n else:\n return\n\n if h: dict_append(info,include_dirs=[h])\n self.set_info(**info)\n\n## class blas_info(system_info):\n## # For Fortran or optimized blas, not atlas.\n## pass\n\n\n## class lapack_info(system_info):\n## # For Fortran or optimized lapack, not atlas\n## pass\n\n\nclass x11_info(system_info):\n section = 'x11'\n\n def __init__(self):\n system_info.__init__(self,\n default_lib_dirs=default_x11_lib_dirs,\n default_include_dirs=default_x11_include_dirs)\n\n def calc_info(self):\n if sys.platform == 'win32':\n return\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n x11_libs = self.get_libs('x11_libs', ['X11'])\n for lib_dir in lib_dirs:\n info = self.check_libs(lib_dir, x11_libs, [])\n if info is not None:\n break\n else:\n return\n inc_dir = None\n for d in include_dirs:\n if combine_paths(d, 'X11/X.h'):\n inc_dir = d\n break\n if inc_dir is not None:\n dict_append(info, include_dirs=[inc_dir])\n self.set_info(**info)\n\ndef shortest_path(pths):\n pths.sort()\n if pths: return pths[0]\n\ndef combine_paths(*args):\n \"\"\" Return a list of existing paths composed by all combinations of\n items from arguments.\n \"\"\"\n r = []\n for a in args:\n if not a: continue\n if type(a) is types.StringType:\n a = [a]\n r.append(a)\n args = r\n if not args: return []\n if len(args)==1:\n result = reduce(lambda a,b:a+b,map(glob,args[0]),[])\n elif len (args)==2:\n result = []\n for a0 in args[0]:\n for a1 in args[1]:\n result.extend(glob(os.path.join(a0,a1)))\n else:\n result = combine_paths(*(combine_paths(args[0],args[1])+args[2:]))\n return result\n\ndef dict_append(d,**kws):\n for k,v in kws.items():\n if d.has_key(k):\n d[k].extend(v)\n else:\n d[k] = v\n\ndef show_all():\n import system_info\n import pprint\n match_info = re.compile(r'.*?_info').match\n for n in filter(match_info,dir(system_info)):\n if n in ['system_info','get_info']: continue\n c = getattr(system_info,n)()\n r = c.get_info()\n\nif __name__ == \"__main__\":\n show_all()\n", + "source_code_before": "#!/usr/bin/env python\n\"\"\"\nThis file defines a set of system_info classes for getting\ninformation about various resources (libraries, library directories,\ninclude directories, etc.) in the system. Currently, the following\nclasses are available:\n atlas_info\n fftw_info\n x11_info\n\nUsage:\n info_dict = get_info()\n where is a string 'atlas','x11','fftw'.\n\n Returned info_dict is a dictionary which is compatible with\n distutils.setup keyword arguments. If info_dict == {}, then the\n asked resource is not available (or system_info could not find it).\n\nGlobal parameters:\n system_info.static_first - a flag for indicating that static\n libraries are searched first than shared ones.\n system_info.verbose - show the results if set.\n\nThe file 'site.cfg' in the same directory as this module is read\nfor configuration options. The format is that used by ConfigParser (i.e.,\nWindows .INI style). The section DEFAULT has options that are the default\nfor each section. The available sections are fftw, atlas, and x11. Appropiate\ndefaults are used if nothing is specified.\n\nExample:\n----------\n[DEFAULT]\nlib_dir = /usr/lib:/usr/local/lib:/opt/lib\ninclude_dir = /usr/include:/usr/local/include:/opt/include\n# use static libraries in preference to shared ones\nstatic_first = 1\n\n[fftw]\nfftw_libs = fftw, rfftw\nfftw_opt_libs = fftw_threaded, rfftw_threaded\n# if the above aren't found, look for {s,d}fftw_libs and {s,d}fftw_opt_libs\n\n[atlas]\nlib_dir = /usr/lib/3dnow:/usr/lib/3dnow/atlas\n# for overriding the names of the atlas libraries\natlas_libs = f77blas, cblas, atlas\nlapack_libs = lapack\n\n[x11]\nlib_dir = /usr/X11R6/lib\ninclude_dir = /usr/X11R6/include\n----------\n\nAuthors:\n Pearu Peterson , February 2002\n David M. Cooke , April 2002\n\nCopyright 2002 Pearu Peterson all rights reserved,\nPearu Peterson \nPermission to use, modify, and distribute this software is given under the \nterms of the SciPy (BSD style) license. See LICENSE.txt that came with\nthis distribution for specifics.\n\nNO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n\"\"\"\n\nimport sys,os,re,types\nfrom distutils.errors import DistutilsError\nfrom glob import glob\nimport ConfigParser\n\nfrom distutils.sysconfig import get_config_vars\n\nif sys.platform == 'win32':\n default_lib_dirs = ['C:\\\\'] # probably not very helpful...\n default_include_dirs = []\n default_x11_lib_dirs = []\n default_x11_include_dirs = []\nelse:\n default_lib_dirs = ['/usr/local/lib', '/opt/lib', '/usr/lib']\n default_include_dirs = ['/usr/local/include',\n '/opt/include', '/usr/include']\n default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib']\n default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include']\n\nif os.path.join(sys.prefix, 'lib') not in default_lib_dirs:\n default_lib_dirs.insert(0,os.path.join(sys.prefix, 'lib'))\n# default_lib_dirs.append(os.path.join(sys.prefix, 'lib'))\n default_include_dirs.append(os.path.join(sys.prefix, 'include'))\ndefault_lib_dirs = filter(os.path.isdir, default_lib_dirs)\ndefault_include_dirs = filter(os.path.isdir, default_include_dirs)\n\nso_ext = get_config_vars('SO')[0] or ''\n\ndef get_info(name):\n cl = {'atlas':atlas_info,\n 'x11':x11_info,\n 'fftw':fftw_info}.get(name.lower(),system_info)\n return cl().get_info()\n\nclass NotFoundError(DistutilsError):\n \"\"\"Some third-party program or library is not found.\"\"\"\n\nclass AtlasNotFoundError(NotFoundError):\n \"\"\"\n Atlas (http://math-atlas.sourceforge.net/) libraries not found.\n Either install them in /usr/local/lib/atlas or /usr/lib/atlas\n and retry setup.py. One can use also ATLAS environment variable\n to indicate the location of Atlas libraries.\"\"\"\n\nclass FFTWNotFoundError(NotFoundError):\n \"\"\"\n FFTW (http://www.fftw.org/) libraries not found.\n Either install them in /usr/local/lib or /usr/lib and retry setup.py.\n One can use also FFTW environment variable to indicate\n the location of FFTW libraries.\"\"\"\n\nclass F2pyNotFoundError(NotFoundError):\n \"\"\"\n f2py2e (http://cens.ioc.ee/projects/f2py2e/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass NumericNotFoundError(NotFoundError):\n \"\"\"\n Numeric (http://www.numpy.org/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass X11NotFoundError(NotFoundError):\n \"\"\"X11 libraries not found.\"\"\"\n\nclass system_info:\n\n \"\"\" get_info() is the only public method. Don't use others.\n \"\"\"\n section = 'DEFAULT'\n\n static_first = 1\n verbose = 1\n need_refresh = 1\n saved_results = {}\n\n def __init__ (self,\n default_lib_dirs=default_lib_dirs,\n default_include_dirs=default_include_dirs,\n ):\n self.__class__.info = {}\n self.local_prefixes = []\n defaults = {}\n defaults['lib_dir'] = os.pathsep.join(default_lib_dirs)\n defaults['include_dir'] = os.pathsep.join(default_include_dirs)\n defaults['static_first'] = '1'\n self.cp = ConfigParser.ConfigParser(defaults)\n cf = os.path.join(os.path.split(os.path.abspath(__file__))[0],\n 'site.cfg')\n self.cp.read([cf])\n if not self.cp.has_section(self.section):\n self.cp.add_section(self.section)\n self.static_first = self.cp.getboolean(self.section, 'static_first')\n\n def set_info(self,**info):\n self.saved_results[self.__class__.__name__] = info\n def has_info(self):\n return self.saved_results.has_key(self.__class__.__name__)\n def get_info(self):\n \"\"\" Return a dictonary with items that are compatible\n with scipy_distutils.setup keyword arguments.\n \"\"\"\n flag = 0\n if not self.has_info():\n flag = 1\n if self.verbose:\n print self.__class__.__name__ + ':'\n if hasattr(self, 'calc_info'):\n self.calc_info()\n if self.verbose:\n if not self.has_info():\n print ' NOT AVAILABLE'\n self.set_info()\n else:\n print ' FOUND:'\n res = self.saved_results.get(self.__class__.__name__)\n if self.verbose and flag:\n for k,v in res.items():\n print ' %s = %s'%(k,v)\n print\n return res\n\n def calc_info_template(self,prefix):\n \"\"\" Calculate info dictionary. \"\"\"\n\n def get_paths(self, section, key):\n dirs = self.cp.get(section, key).split(os.pathsep)\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs.extend(default_dirs)\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def get_lib_dirs(self, key='lib_dir'):\n return self.get_paths(self.section, key)\n def get_include_dirs(self, key='include_dir'):\n return self.get_paths(self.section, key)\n\n def get_libs(self, key, default):\n try:\n libs = self.cp.get(self.section, key)\n except ConfigParser.NoOptionError:\n return default\n return [a.strip() for a in libs.split(',')]\n\n def check_libs(self,lib_dir,libs,opt_libs =[]):\n \"\"\" If static or shared libraries are available then return\n their info dictionary. \"\"\"\n mths = [self.check_static_libs,self.check_shared_libs]\n if not self.static_first:\n mths.reverse() # if one prefers shared libraries\n for m in mths:\n info = m(lib_dir,libs,opt_libs)\n if info is not None: return info\n\n def check_static_libs(self,lib_dir,libs,opt_libs =[]):\n #XXX: what are .lib and .dll files under win32?\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs])) == len(libs):\n info = {'libraries':libs,'library_dirs':[lib_dir]}\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs]))\\\n ==len(opt_libs):\n info['libraries'].extend(opt_libs)\n return info\n\n def check_shared_libs(self,lib_dir,libs,opt_libs =[]):\n shared_libs = []\n for l in libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: shared_libs.append(p)\n if len(shared_libs) == len(libs):\n info = {'extra_objects':shared_libs}\n opt_shared_libs = []\n for l in opt_libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: opt_shared_libs.append(p)\n info['extra_objects'].extend(opt_shared_libs)\n return info\n\n\nclass fftw_info(system_info):\n section = 'fftw'\n\n def __init__(self):\n system_info.__init__(self)\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n incl_dirs = self.get_include_dirs()\n incl_dir = None\n\n libs = self.get_libs('fftw_libs', ['fftw','rfftw'])\n opt_libs = self.get_libs('fftw_opt_libs',\n ['fftw_threads','rfftw_threads'])\n info = None\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['fftw.h','rfftw.h']))==2:\n dict_append(info,include_dirs=[d])\n flag = 1\n incl_dirs = [d]\n incl_dir = d\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_FFTW_H',1)])\n else:\n info = None\n\n if info is None:\n libs = self.get_libs('dfftw_libs', ['dfftw', 'drfftw'])\n opt_libs = self.get_libs('dfftw_opt_libs',\n ['dfftw_threads', 'drfftw_threads'])\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['dfftw.h','drfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n incl_dirs = [d]\n incl_dir = d\n flag = 1\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_DFFTW_H',1)])\n else:\n info = None\n\n libs = self.get_libs('sfftw_libs', ['sfftw', 'srfftw'])\n opt_libs = self.get_libs('sfftw_opt_libs',\n ['sfftw_threads', 'srfftw_threads'])\n flag = 0\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n if info is None: info = r\n else: dict_append(info,**r)\n flag = 1\n break\n if info is not None and flag:\n for d in incl_dirs:\n if len(combine_paths(d,['sfftw.h','srfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n dict_append(info,define_macros=[('SCIPY_SFFTW_H',1)])\n break\n if info is not None:\n self.set_info(**info)\n\n\nclass atlas_info(system_info):\n section = 'atlas'\n\n def get_paths(self, section, key):\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs = []\n for d in self.cp.get(section, key).split(os.pathsep) + default_dirs:\n dirs.extend([d]+combine_paths(d,['atlas*','ATLAS*']))\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n\n h = (combine_paths(lib_dirs+include_dirs,'cblas.h') or [None])[0]\n if h: h = os.path.dirname(h)\n info = None\n # lapack must appear before atlas\n lapack_libs = self.get_libs('lapack_libs', ['lapack'])\n for d in lib_dirs:\n lapack = self.check_libs(d,lapack_libs,[])\n if lapack is not None:\n info = lapack \n break\n else:\n return\n atlas_libs = self.get_libs('atlas_libs', ['f77blas', 'cblas', 'atlas'])\n for d in lib_dirs:\n atlas = self.check_libs(d,atlas_libs,[])\n if atlas is not None:\n dict_append(info, **atlas)\n break\n else:\n return\n\n if h: dict_append(info,include_dirs=[h])\n self.set_info(**info)\n\n## class blas_info(system_info):\n## # For Fortran or optimized blas, not atlas.\n## pass\n\n\n## class lapack_info(system_info):\n## # For Fortran or optimized lapack, not atlas\n## pass\n\n\nclass x11_info(system_info):\n section = 'x11'\n\n def __init__(self):\n system_info.__init__(self,\n default_lib_dirs=default_x11_lib_dirs,\n default_include_dirs=default_x11_include_dirs)\n\n def calc_info(self):\n if sys.platform == 'win32':\n return\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n x11_libs = self.get_libs('x11_libs', ['X11'])\n for lib_dir in lib_dirs:\n info = self.check_libs(lib_dir, x11_libs, [])\n if info is not None:\n break\n else:\n return\n inc_dir = None\n for d in include_dirs:\n if combine_paths(d, 'X11/X.h'):\n inc_dir = d\n break\n if inc_dir is not None:\n dict_append(info, include_dirs=[inc_dir])\n self.set_info(**info)\n\ndef shortest_path(pths):\n pths.sort()\n if pths: return pths[0]\n\ndef combine_paths(*args):\n \"\"\" Return a list of existing paths composed by all combinations of\n items from arguments.\n \"\"\"\n r = []\n for a in args:\n if not a: continue\n if type(a) is types.StringType:\n a = [a]\n r.append(a)\n args = r\n if not args: return []\n if len(args)==1:\n result = reduce(lambda a,b:a+b,map(glob,args[0]),[])\n elif len (args)==2:\n result = []\n for a0 in args[0]:\n for a1 in args[1]:\n result.extend(glob(os.path.join(a0,a1)))\n else:\n result = combine_paths(*(combine_paths(args[0],args[1])+args[2:]))\n return result\n\ndef dict_append(d,**kws):\n for k,v in kws.items():\n if d.has_key(k):\n d[k].extend(v)\n else:\n d[k] = v\n\ndef show_all():\n import system_info\n import pprint\n match_info = re.compile(r'.*?_info').match\n for n in filter(match_info,dir(system_info)):\n if n in ['system_info','get_info']: continue\n c = getattr(system_info,n)()\n r = c.get_info()\n\nif __name__ == \"__main__\":\n show_all()\n", + "methods": [ + { + "name": "get_info", + "long_name": "get_info( name )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 1, + "token_count": 39, + "parameters": [ + "name" + ], + "start_line": 95, + "end_line": 99, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , default_lib_dirs = default_lib_dirs , default_include_dirs = default_include_dirs , )", + "filename": "system_info.py", + "nloc": 17, + "complexity": 2, + "token_count": 152, + "parameters": [ + "self", + "default_lib_dirs", + "default_include_dirs" + ], + "start_line": 142, + "end_line": 158, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "set_info", + "long_name": "set_info( self , ** info )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "info" + ], + "start_line": 160, + "end_line": 161, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "has_info", + "long_name": "has_info( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self" + ], + "start_line": 162, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_info", + "long_name": "get_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 9, + "token_count": 113, + "parameters": [ + "self" + ], + "start_line": 164, + "end_line": 186, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "calc_info_template", + "long_name": "calc_info_template( self , prefix )", + "filename": "system_info.py", + "nloc": 1, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self", + "prefix" + ], + "start_line": 188, + "end_line": 189, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 3, + "token_count": 70, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 191, + "end_line": 195, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "get_lib_dirs", + "long_name": "get_lib_dirs( self , key = 'lib_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 197, + "end_line": 198, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_include_dirs", + "long_name": "get_include_dirs( self , key = 'include_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 199, + "end_line": 200, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_libs", + "long_name": "get_libs( self , key , default )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "key", + "default" + ], + "start_line": 202, + "end_line": 207, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "check_libs", + "long_name": "check_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 4, + "token_count": 60, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 209, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "check_static_libs", + "long_name": "check_static_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 5, + "token_count": 91, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 219, + "end_line": 226, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "check_shared_libs", + "long_name": "check_shared_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 13, + "complexity": 6, + "token_count": 119, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 228, + "end_line": 240, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 246, + "end_line": 247, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 69, + "complexity": 24, + "token_count": 443, + "parameters": [ + "self" + ], + "start_line": 249, + "end_line": 320, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 72, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 8, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 326, + "end_line": 333, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 24, + "complexity": 8, + "token_count": 168, + "parameters": [ + "self" + ], + "start_line": 335, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 27, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 4, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 376, + "end_line": 379, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 7, + "token_count": 110, + "parameters": [ + "self" + ], + "start_line": 381, + "end_line": 400, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "shortest_path", + "long_name": "shortest_path( pths )", + "filename": "system_info.py", + "nloc": 3, + "complexity": 2, + "token_count": 18, + "parameters": [ + "pths" + ], + "start_line": 402, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "combine_paths", + "long_name": "combine_paths( * args )", + "filename": "system_info.py", + "nloc": 19, + "complexity": 9, + "token_count": 162, + "parameters": [ + "args" + ], + "start_line": 406, + "end_line": 427, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "dict_append", + "long_name": "dict_append( d , ** kws )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 44, + "parameters": [ + "d", + "kws" + ], + "start_line": 429, + "end_line": 434, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "show_all", + "long_name": "show_all( )", + "filename": "system_info.py", + "nloc": 8, + "complexity": 3, + "token_count": 59, + "parameters": [], + "start_line": 436, + "end_line": 443, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "get_info", + "long_name": "get_info( name )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 1, + "token_count": 39, + "parameters": [ + "name" + ], + "start_line": 95, + "end_line": 99, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , default_lib_dirs = default_lib_dirs , default_include_dirs = default_include_dirs , )", + "filename": "system_info.py", + "nloc": 17, + "complexity": 2, + "token_count": 152, + "parameters": [ + "self", + "default_lib_dirs", + "default_include_dirs" + ], + "start_line": 142, + "end_line": 158, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "set_info", + "long_name": "set_info( self , ** info )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "info" + ], + "start_line": 160, + "end_line": 161, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "has_info", + "long_name": "has_info( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self" + ], + "start_line": 162, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_info", + "long_name": "get_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 9, + "token_count": 113, + "parameters": [ + "self" + ], + "start_line": 164, + "end_line": 186, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "calc_info_template", + "long_name": "calc_info_template( self , prefix )", + "filename": "system_info.py", + "nloc": 1, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self", + "prefix" + ], + "start_line": 188, + "end_line": 189, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 3, + "token_count": 70, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 191, + "end_line": 195, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "get_lib_dirs", + "long_name": "get_lib_dirs( self , key = 'lib_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 197, + "end_line": 198, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_include_dirs", + "long_name": "get_include_dirs( self , key = 'include_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 199, + "end_line": 200, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_libs", + "long_name": "get_libs( self , key , default )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "key", + "default" + ], + "start_line": 202, + "end_line": 207, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "check_libs", + "long_name": "check_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 4, + "token_count": 60, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 209, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "check_static_libs", + "long_name": "check_static_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 5, + "token_count": 91, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 219, + "end_line": 226, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "check_shared_libs", + "long_name": "check_shared_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 13, + "complexity": 6, + "token_count": 119, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 228, + "end_line": 240, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 246, + "end_line": 247, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 69, + "complexity": 24, + "token_count": 443, + "parameters": [ + "self" + ], + "start_line": 249, + "end_line": 320, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 72, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 4, + "token_count": 91, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 326, + "end_line": 331, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 24, + "complexity": 8, + "token_count": 168, + "parameters": [ + "self" + ], + "start_line": 333, + "end_line": 359, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 27, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 4, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 374, + "end_line": 377, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 7, + "token_count": 110, + "parameters": [ + "self" + ], + "start_line": 379, + "end_line": 398, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "shortest_path", + "long_name": "shortest_path( pths )", + "filename": "system_info.py", + "nloc": 3, + "complexity": 2, + "token_count": 18, + "parameters": [ + "pths" + ], + "start_line": 400, + "end_line": 402, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "combine_paths", + "long_name": "combine_paths( * args )", + "filename": "system_info.py", + "nloc": 19, + "complexity": 9, + "token_count": 162, + "parameters": [ + "args" + ], + "start_line": 404, + "end_line": 425, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "dict_append", + "long_name": "dict_append( d , ** kws )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 44, + "parameters": [ + "d", + "kws" + ], + "start_line": 427, + "end_line": 432, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "show_all", + "long_name": "show_all( )", + "filename": "system_info.py", + "nloc": 8, + "complexity": 3, + "token_count": 59, + "parameters": [], + "start_line": 434, + "end_line": 441, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + } + ], + "changed_methods": [ + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 8, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 326, + "end_line": 333, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + } + ], + "nloc": 378, + "complexity": 101, + "token_count": 2218, + "diff_parsed": { + "added": [ + " if os.environ.has_key('ATLAS'):", + " default_dirs.append(os.environ['ATLAS'])" + ], + "deleted": [] + } + } + ] + }, + { + "hash": "a9bd45e70717507055ab1c08dabcbddba4ab3ebb", + "msg": "auto_test is the begiinings of an automated test suite for scipy. It downloads and builds python,\nscipy and all the dependencies (except atlas...). It then sends email based on the results.\nIt requires the logging.py file that hopefully will make it into the standard library.", + "author": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "committer": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "author_date": "2002-04-12T04:01:19+00:00", + "author_timezone": 0, + "committer_date": "2002-04-12T04:01:19+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "577d7613c5e1b6ad60772ff7509d81dd40720188" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 0, + "insertions": 2462, + "lines": 2462, + "files": 2, + "dmm_unit_size": 0.6602209944751382, + "dmm_unit_complexity": 0.8471454880294659, + "dmm_unit_interfacing": 0.6187845303867403, + "modified_files": [ + { + "old_path": null, + "new_path": "scipy_distutils/auto_test.py", + "filename": "auto_test.py", + "extension": "py", + "change_type": "ADD", + "diff": "@@ -0,0 +1,725 @@\n+from distutils import file_util\n+from distutils import dir_util\n+from distutils.errors import DistutilsFileError\n+#import tarfile\n+import sys, os, stat, time\n+import gzip\n+import tempfile, cStringIO\n+import urllib\n+import logging\n+\n+if sys.platform == 'cygwin':\n+ local_repository = \"/cygdrive/i/tarballs\"\n+elif sys.platform == 'win32': \n+ local_repository = \"i:\\tarballs\"\n+else:\n+ local_repository = \"/home/shared/tarballs\"\n+\n+python_ftp_url = \"ftp://ftp.python.org/pub/python\"\n+numeric_url = \"http://prdownloads.sourceforge.net/numpy\"\n+f2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\n+scipy_url = \"ftp://www.scipy.org/pub\"\n+blas_url = \"http://www.netlib.org/blas\"\n+lapack_url = \"http://www.netlib.org/lapack\"\n+#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\n+atlas_url = \"http://www.scipy.org/Members/eric\"\n+\n+#-----------------------------------------------------------------------------\n+# Generic installation class. \n+# built to handle downloading/untarring/building/installing arbitrary software\n+#-----------------------------------------------------------------------------\n+\n+class package_installation: \n+ def __init__(self,version='', dst_dir = '.',\n+ logger = None, python_exe='python'):\n+ #---------------------------------------------------------------------\n+ # These should be defined in sub-class before calling this\n+ # constructor\n+ #---------------------------------------------------------------------\n+ # \n+ #self.package_url -- The name of the url where tarball can be found.\n+ #self.package_base_name -- The base name of the source tarball.\n+ #self.package_dir_name -- Top level directory of unpacked tarball\n+ #self.tarball_suffix -- usually tar.gz or .tgz\n+ #self.build_type -- 'make' or 'setup' for makefile or python setup file\n+ \n+ # Version of the software package.\n+ self.version = version\n+\n+ # Only used by packages built with setup.py\n+ self.python_exe = python_exe\n+ \n+ # Directory where package is unpacked/built/installed\n+ self.dst_dir = os.path.abspath(dst_dir) \n+ \n+ # make sure the destination exists\n+ dir_util.mkpath(self.dst_dir)\n+ \n+ if not logger:\n+ self.logger = logging\n+ else:\n+ self.logger = logger \n+\n+ # Construct any derived names built from the above names.\n+ self.init_names()\n+ \n+ def init_names(self): \n+ self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)\n+ self.tarball = self.package_base_name + '.' + self.tarball_suffix\n+\n+ def get_source(self):\n+ \"\"\" Grab the source tarball from a repository.\n+ \n+ Try a local repository first. If the file isn't found,\n+ grab it from an ftp site.\n+ \"\"\"\n+ local_found = 0\n+ if self.local_source_up_to_date():\n+ try:\n+ self.get_source_local()\n+ local_found = 1 \n+ except DistutilsFileError:\n+ pass\n+ \n+ if not local_found:\n+ self.get_source_ftp()\n+ \n+ def local_source_up_to_date(self):\n+ \"\"\" Hook to test whether a file found in the repository is current\n+ \"\"\"\n+ return 1\n+ \n+ def get_source_local(self):\n+ \"\"\" Grab the requested tarball from a local repository of source\n+ tarballs. If it doesn't exist, an error is raised.\n+ \"\"\"\n+ file = os.path.join(local_repository,self.tarball) \n+ dst_file = os.path.join(self.dst_dir,self.tarball)\n+ self.logger.info(\"Searching local repository for %s\" % file)\n+ try:\n+ copy_file(file,dst_file,self.logger)\n+ except DistutilsFileError, msg:\n+ self.logger.info(\"Not found:\",msg)\n+ raise\n+ \n+ def get_source_ftp(self):\n+ \"\"\" Grab requested tarball from a ftp site specified as a url. \n+ \"\"\"\n+ url = '/'.join([self.package_url,self.tarball])\n+ \n+ self.logger.info('Opening: %s' % url)\n+ f = urllib.urlopen(url)\n+ self.logger.info('Downloading: this may take a while')\n+ contents = f.read(-1)\n+ f.close()\n+ self.logger.info('Finished download (size=%d)' % len(contents))\n+ \n+ output_file = os.path.join(self.dst_dir,self.tarball)\n+ write_file(output_file,contents,self.logger)\n+\n+ # Put file in local repository so we don't have to download it again.\n+ self.logger.info(\"Caching file in repository\" )\n+ src_file = output_file\n+ repos_file = os.path.join(local_repository,self.tarball) \n+ copy_file(src_file,repos_file,self.logger)\n+\n+ def unpack_source(self,sub_dir = None):\n+ \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir\n+ \"\"\" \n+ tarfile = os.path.join(self.dst_dir,self.tarball)\n+ old_dir = None\n+ \n+ # copy and move into sub directory if it is specified.\n+ if sub_dir:\n+ dst_dir = os.path.join(self.dst_dir,sub_dir)\n+ dst_file = os.path.join(dst_dir,self.tarball)\n+ copy_file(tarfile,dst_file)\n+ change_dir(dst_dir,self.logger)\n+ try:\n+ try:\n+ # occasionally the tarball is not zipped, try this first.\n+ untar_file(self.tarball,self.dst_dir,\n+ self.logger,silent_failure=1)\n+ except:\n+ # otherwise, handle the fact that it is zipped \n+ dst = os.path.join(self.dst_dir,'tmp.tar') \n+ decompress_file(tarfile,dst,self.logger) \n+ untar_file(dst,self.dst_dir,self.logger)\n+ remove_file(dst,self.logger)\n+ finally:\n+ if old_dir:\n+ unchange_dir(self.logger)\n+\n+ def auto_configure(self):\n+ cmd = os.path.join('.','configure')\n+ text = run_command(cmd,self.package_dir,self.logger)\n+\n+ def build_with_make(self):\n+ cmd = 'make'\n+ text = run_command(cmd,self.package_dir,self.logger)\n+\n+ def install_with_make(self, prefix = None):\n+ if prefix is None:\n+ prefix = os.path.abspath(self.dst_dir)\n+ cmd = 'make install prefix=%s' % prefix\n+ text = run_command(cmd,self.package_dir,self.logger)\n+\n+ def python_setup(self):\n+ cmd = self.python_exe + ' setup.py install'\n+ text = run_command(cmd,self.package_dir,self.logger)\n+ \n+ def _make(self,**kw):\n+ \"\"\" This generally needs to be overrridden in the derived class,\n+ but this will suffice for the standard configure/make process. \n+ \"\"\"\n+ self.get_source()\n+ self.unpack_source()\n+ self.auto_configure()\n+ self.build_with_make()\n+ self.install_with_make()\n+\n+ def _setup(self):\n+ \"\"\" Build with Python setup script.\n+ \"\"\"\n+ self.get_source()\n+ self.unpack_source()\n+ self.python_setup()\n+\n+ def install(self):\n+ self.logger.info('####### Building: %s' % self.package_base_name)\n+ self.logger.info(' Version: %s' % self.version)\n+ self.logger.info(' Url: %s' % self.package_url)\n+ self.logger.info(' Install dir: %s' % self.dst_dir)\n+ self.logger.info(' Package dir: %s' % self.package_dir)\n+ self.logger.info(' Suffix: %s' % self.tarball_suffix)\n+ self.logger.info(' Build type: %s' % self.build_type)\n+ if self.build_type == 'setup':\n+ self._setup()\n+ else: \n+ self._make()\n+ self.logger.info('####### Finished Building: %s' % self.package_base_name) \n+ \n+#-----------------------------------------------------------------------------\n+# Installation class for Python itself.\n+#-----------------------------------------------------------------------------\n+ \n+class python_installation(package_installation):\n+ \n+ def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n+ \n+ # Specialization for Python. \n+ self.package_base_name = 'Python-'+version\n+ self.package_dir_name = self.package_base_name\n+ self.package_url = '/'.join([python_ftp_url,version])\n+ self.tarball_suffix = 'tgz'\n+ self.build_type = 'make'\n+ \n+ package_installation.__init__(self,version,dst_dir,logger,python_exe)\n+\n+ def write_install_config(self): \n+ \"\"\" Make doesn't seem to install scripts in the correct places.\n+ \n+ Writing this to the python directory will solve the problem.\n+ [install_script]\n+ install-dir= \n+ \"\"\"\n+ text = \"[install_scripts]\\n\"\\\n+ \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n+ file = os.path.join(self.package_dir,'setup.cfg') \n+ write_file(file,text,self.logger,mode='w')\n+\n+ def install_with_make(self):\n+ \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n+ file is written to force installation in the correct place.\n+ \"\"\"\n+ self.write_install_config()\n+ package_installation.install_with_make(self)\n+\n+ def get_exe_name(self):\n+ pyname = os.path.join('.','python')\n+ cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"\n+ text = run_command(cmd,self.package_dir,self.logger)\n+ exe = os.path.join(self.dst_dir,'bin','python'+text)\n+ return exe\n+\n+#-----------------------------------------------------------------------------\n+# Installation class for Blas.\n+#-----------------------------------------------------------------------------\n+\n+class blas_installation(package_installation):\n+ \n+ def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n+ \n+ # Specialization for for \"slow\" blas\n+ self.package_base_name = 'blas'\n+ self.package_dir_name = 'BLAS'\n+ self.package_url = blas_url\n+ self.tarball_suffix = 'tgz'\n+ self.build_type = 'make'\n+ \n+ self.platform = 'LINUX'\n+ package_installation.__init__(self,version,dst_dir,logger,python_exe)\n+\n+ def unpack_source(self,subdir=None):\n+ \"\"\" Dag. blas.tgz doesn't have directory information -- its\n+ just a tar ball of fortran source code. untar it in the\n+ BLAS directory\n+ \"\"\"\n+ package_installation.unpack_source(self,self.package_dir_name)\n+ \n+ def auto_configure(self):\n+ # nothing to do.\n+ pass\n+ def build_with_make(self, **kw):\n+ libname = 'blas_LINUX.a'\n+ cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n+ text = run_command(cmd,self.package_dir,self.logger)\n+\n+ def install_with_make(self, **kw):\n+ # not really using make -- we'll just copy the file over. \n+ src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n+ dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n+ self.logger.info(\"Installing blas\")\n+ copy_file(src_file,dst_file,self.logger)\n+\n+#-----------------------------------------------------------------------------\n+# Installation class for Lapack.\n+#-----------------------------------------------------------------------------\n+\n+class lapack_installation(package_installation):\n+ \n+ def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n+ \n+ # Specialization for Lapack 3.0 + updates \n+ self.package_base_name = 'lapack'\n+ self.package_dir_name = 'LAPACK'\n+ self.package_url = lapack_url\n+ self.tarball_suffix = 'tgz'\n+ self.build_type = 'make'\n+ \n+ self.platform = 'LINUX'\n+ package_installation.__init__(self,version,dst_dir,logger,python_exe)\n+\n+ def auto_configure(self):\n+ # perhaps this should actually override auto_conifgure\n+ # before make, we need to copy the appropriate setup file in.\n+ # should work anywhere g77 works...\n+ make_inc = 'make.inc.' + self.platform\n+ src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n+ dst_file = os.path.join(self.package_dir,'make.inc')\n+ copy_file(src_file,dst_file,self.logger)\n+\n+ def build_with_make(self, **kw):\n+ cmd = 'make install lapacklib'\n+ text = run_command(cmd,self.package_dir,self.logger)\n+\n+ def install_with_make(self, **kw):\n+ # not really using make -- we'll just copy the file over.\n+ src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n+ dst_file = os.path.join(self.dst_dir,'lib','liblapack.a')\n+ self.logger.info(\"Installing lapack\")\n+ copy_file(src_file,dst_file,self.logger)\n+ \n+#-----------------------------------------------------------------------------\n+# Installation class for Numeric\n+#-----------------------------------------------------------------------------\n+\n+class numeric_installation(package_installation):\n+ \n+ def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n+ \n+ self.package_base_name = 'Numeric-'+version\n+ self.package_dir_name = self.package_base_name\n+ self.package_url = numeric_url\n+ self.tarball_suffix = 'tar.gz'\n+ self.build_type = 'setup' \n+\n+ package_installation.__init__(self,version,dst_dir,logger,python_exe)\n+\n+\n+#-----------------------------------------------------------------------------\n+# Installation class for f2py\n+#-----------------------------------------------------------------------------\n+\n+class f2py_installation(package_installation):\n+ \n+ def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n+ \n+ # Typical file format: F2PY-2.13.175-1250.tar.gz\n+ self.package_base_name = 'F2PY-'+version\n+ self.package_dir_name = self.package_base_name\n+ self.package_url = f2py_url\n+ self.tarball_suffix = 'tar.gz'\n+ self.build_type = 'setup' \n+ \n+ package_installation.__init__(self,version,dst_dir,logger,python_exe)\n+\n+\n+#-----------------------------------------------------------------------------\n+# Installation class for Atlas.\n+# This is a binary install *NOT* a source install.\n+# The source install is a pain to automate.\n+#-----------------------------------------------------------------------------\n+\n+class atlas_installation(package_installation):\n+ \n+ def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n+ \n+ #self.package_base_name = 'atlas' + version\n+ #self.package_dir_name = 'ATLAS'\n+ self.package_base_name = 'atlas-RH7.1-PIII'\n+ self.package_dir_name = 'atlas'\n+ self.package_url = atlas_url\n+ self.tarball_suffix = 'tgz'\n+ self.build_type = 'make' \n+ \n+ package_installation.__init__(self,version,dst_dir,logger,python_exe)\n+\n+ def auto_configure(self,**kw):\n+ pass\n+ def build_with_make(self,**kw):\n+ pass\n+ def install_with_make(self, **kw):\n+ # just copy the tree over.\n+ dst = os.path.join(self.dst_dir,'lib','atlas')\n+ self.logger.info(\"Installing Atlas\")\n+ copy_tree(self.package_dir,dst,self.logger)\n+\n+#-----------------------------------------------------------------------------\n+# Installation class for scipy\n+#-----------------------------------------------------------------------------\n+\n+class scipy_installation(package_installation):\n+ \n+ def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n+ \n+ self.package_base_name = 'scipy_snapshot'\n+ self.package_dir_name = 'scipy'\n+ self.package_url = scipy_url\n+ self.tarball_suffix = 'tgz'\n+ self.build_type = 'setup'\n+ \n+ package_installation.__init__(self,version,dst_dir,logger,python_exe)\n+ \n+ def local_source_up_to_date(self):\n+ \"\"\" Hook to test whether a file found in the repository is current\n+ \"\"\"\n+ file = os.path.join(local_repository,self.tarball)\n+ up_to_date = 0\n+ try:\n+ file_time = os.stat(file)[stat.ST_MTIME] \n+ fyear,fmonth,fday = time.localtime(file_time)[:3]\n+ year,month,day = time.localtime()[:3]\n+ if year == year and month == month and day == day:\n+ up_to_date = 1\n+ self.logger.info(\"Repository file up to date: %s\" % file)\n+ except OSError, msg:\n+ pass\n+ return up_to_date\n+ \n+#-----------------------------------------------------------------------------\n+# Utilities\n+#-----------------------------------------------------------------------------\n+\n+\n+#if os.name == 'nt':\n+# def exec_command(command):\n+# \"\"\" not sure how to get exit status on nt. \"\"\"\n+# in_pipe,out_pipe = os.popen4(command)\n+# in_pipe.close()\n+# text = out_pipe.read()\n+# return 0, text\n+#else:\n+# import commands\n+# exec_command = commands.getstatusoutput\n+ \n+# This may not work on Win98... The above stuff was to handle these machines.\n+import commands\n+exec_command = commands.getstatusoutput\n+\n+def copy_file(src,dst,logger=None):\n+ if not logger:\n+ logger = logging\n+ logger.info(\"Copying %s->%s\" % (src,dst)) \n+ try:\n+ file_util.copy_file(src,dst)\n+ except Exception, e: \n+ logger.exception(\"Copy Failed\") \n+ raise\n+\n+def copy_tree(src,dst,logger=None):\n+ if not logger:\n+ logger = logging\n+ logger.info(\"Copying directory tree %s->%s\" % (src,dst)) \n+ try:\n+ dir_util.copy_tree(src,dst)\n+ except Exception, e: \n+ logger.exception(\"Copy Failed\") \n+ raise\n+\n+def remove_file(file,logger=None):\n+ if not logger:\n+ logger = logging\n+ logger.info(\"Remove file %s\" % file) \n+ try:\n+ os.remove(file)\n+ except Exception, e: \n+ logger.exception(\"Remove failed\") \n+ raise\n+\n+def write_file(file,contents,logger=None,mode='wb'):\n+ if not logger:\n+ logger = logging\n+ logger.info('Write file: %s' % file)\n+ try:\n+ new_file = open(file,mode)\n+ new_file.write(contents)\n+ new_file.close()\n+ except Exception, e: \n+ logger.exception(\"Write failed\") \n+ raise\n+\n+# I know, I know...\n+old_dir = []\n+\n+def change_dir(d, logger = None):\n+ if not logger:\n+ logger = logging\n+ global old_dir \n+ cwd = os.getcwd() \n+ old_dir.append(cwd)\n+ d = os.path.abspath(d)\n+ if d != old_dir[-1]:\n+ logger.info(\"Change directory: %s\" % d) \n+ try:\n+ os.chdir(d)\n+ except Exception, e: \n+ logger.exception(\"Change directory failed\")\n+ raise \n+ #if d == '.':\n+ # import sys,traceback\n+ # f = sys._getframe()\n+ # traceback.print_stack(f)\n+\n+def unchange_dir(logger=None):\n+ if not logger:\n+ logger = logging \n+ global old_dir\n+ try:\n+ cwd = os.getcwd()\n+ d = old_dir.pop(-1) \n+ try:\n+ if d != cwd:\n+ logger.info(\"Change directory : %s\" % d)\n+ os.chdir(d)\n+ except Exception, e: \n+ logger.exception(\"Change directory failed\")\n+ raise \n+ except IndexError:\n+ logger.exception(\"Change directory failed\")\n+ \n+def decompress_file(src,dst,logger = None):\n+ if not logger:\n+ logger = logging\n+ logger.info(\"Upacking %s->%s\" % (src,dst))\n+ try:\n+ f = gzip.open(src,'rb')\n+ contents = f.read(-1)\n+ f = open(dst, 'wb')\n+ f.write(contents)\n+ except Exception, e: \n+ logger.exception(\"Unpack failed\")\n+ raise \n+\n+ \n+def untar_file(file,dst_dir='.',logger = None,silent_failure = 0): \n+ if not logger:\n+ logger = logging\n+ logger.info(\"Untarring file: %s\" % (file))\n+ try:\n+ run_command('tar -xf ' + file,directory = dst_dir,\n+ logger=logger, silent_failure = silent_failure)\n+ except Exception, e:\n+ if not silent_failure: \n+ logger.exception(\"Untar failed\")\n+ raise \n+\n+def unpack_file(file,logger = None):\n+ \"\"\" equivalent to 'tar -xzvf file'\n+ \"\"\"\n+ dst = 'tmp.tar'\n+ decompress_file(file,dst,logger) \n+ untar_file(dst.logger)\n+ remove_file(dst,logger) \n+\n+def run_command(cmd,directory='.',logger=None,silent_failure = 0):\n+ if not logger:\n+ logger = logging\n+ change_dir(directory,logger) \n+ try: \n+ msg = 'Command: %s' % cmd\n+ status,text = exec_command(cmd)\n+ if status:\n+ msg = msg + ' (failed)'\n+ logger.info(msg) \n+ if status and not silent_failure:\n+ logger.error('command failed with status: %d' % status) \n+ #if text:\n+ # logger.info('Command Output:\\n'+text)\n+ finally:\n+ unchange_dir(logger)\n+ if status:\n+ raise ValueError,'Command had non-zero exit status'\n+ return text \n+\n+def full_scipy_build(build_dir = '.',\n+ python_version = '2.2.1',\n+ numeric_version = '21.0',\n+ f2py_version = '2.13.175-1250',\n+ atlas_version = '3.3.14',\n+ scipy_version = 'snapshot'):\n+ \n+ # for now the atlas version is ignored. Only the \n+ # binaries for RH are supported at the moment.\n+ \n+ dst_dir = os.path.join(build_dir,sys.platform)\n+\n+ logger = logging.Logger(\"SciPy Test\")\n+ fmt = logging.Formatter(logging.BASIC_FORMAT)\n+ log_stream = cStringIO.StringIO()\n+ stream_handler = logging.StreamHandler(log_stream)\n+ stream_handler.setFormatter(fmt)\n+ logger.addHandler(stream_handler)\n+ # also write to stderr\n+ stderr = logging.StreamHandler()\n+ stderr.setFormatter(fmt)\n+ logger.addHandler(stderr)\n+ \n+ python = python_installation(version=python_version,\n+ logger = logger,\n+ dst_dir = dst_dir)\n+ python.install()\n+ \n+ python_name = python.get_exe_name()\n+\n+ numeric = numeric_installation(version=numeric_version,\n+ dst_dir = dst_dir,\n+ logger = logger,\n+ python_exe=python_name)\n+ numeric.install()\n+ \n+ f2py = f2py_installation(version=f2py_version,\n+ logger = logger,\n+ dst_dir = dst_dir,\n+ python_exe=python_name)\n+ f2py.install() \n+\n+ # download files don't have a version specified \n+ #lapack = lapack_installation(version='',\n+ # dst_dir = dst_dir\n+ # python_exe=python_name)\n+ #lapack.install() \n+\n+ # download files don't have a version specified \n+ #blas = blas_installation(version='',\n+ # logger = logger,\n+ # dst_dir = dst_dir,\n+ # python_exe=python_name)\n+ #blas.install() \n+ \n+ # ATLAS\n+ atlas = atlas_installation(version=atlas_version,\n+ logger = logger,\n+ dst_dir = dst_dir,\n+ python_exe=python_name)\n+ atlas.install()\n+ \n+ # version not currently used -- need to fix this.\n+ scipy = scipy_installation(version=scipy_version,\n+ logger = logger,\n+ dst_dir = dst_dir,\n+ python_exe=python_name)\n+ scipy.install() \n+\n+ # The change to tmp makes sure there isn't a scipy directory in \n+ # the local scope.\n+ # All tests are run.\n+ lvl = 1\n+ cmd = python_name + ' -c \"import sys,scipy;suite=scipy.test(%d);\"' % lvl\n+ test_results = run_command(cmd, logger=logger,\n+ directory = tempfile.gettempdir())\n+ \n+ vitals = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n+ numeric_version,scipy_version) \n+ \n+ msg = 'From: scipy-test@enthought.com\\n'\n+ msg = msg + 'To: knucklehead@enthought.com\\n'\n+ msg = msg + 'Subject: %s\\n' % vitals\n+ msg = msg + '\\r\\n\\r\\n'\n+ msg = msg + 'platform: %s,%s\\n' % (sys.platform,os.name)\n+ msg = msg + 'python_version: %s\\n' % python_version\n+ msg = msg + 'numeric_version: %s\\n' % numeric_version\n+ msg = msg + 'f2py_version: %s\\n' % f2py_version\n+ msg = msg + 'atlas_version(hard coded): %s\\n' % atlas_version\n+ msg = msg + 'scipy_version: %s\\n' % scipy_version\n+ msg = msg + test_results \n+ msg = msg + '-----------------------------\\n' \n+ msg = msg + '-------- BUILD LOG -------\\n' \n+ msg = msg + '-----------------------------\\n' \n+ msg = msg + log_stream.getvalue()\n+ # mail results\n+ import smtplib \n+ toaddrs = \"eric@enthought.com\"\n+ fromaddr = \"eric@enthought.com\"\n+ server = smtplib.SMTP('enthought.com') \n+ server.sendmail(fromaddr, toaddrs, msg)\n+ server.quit()\n+ print msg\n+\n+ \n+if __name__ == '__main__':\n+ build_dir = '/tmp/scipy_test'\n+\n+ full_scipy_build(build_dir = build_dir,\n+ python_version = '2.2.1',\n+ numeric_version = '21.0',\n+ f2py_version = '2.13.175-1250',\n+ atlas_version = '3.3.14',\n+ scipy_version = 'snapshot')\n+\n+ # an older python\n+ full_scipy_build(build_dir = build_dir,\n+ python_version = '2.1.3',\n+ numeric_version = '21.0',\n+ f2py_version = '2.13.175-1250',\n+ atlas_version = '3.3.14',\n+ scipy_version = 'snapshot')\n+\n+ # an older numeric\n+ full_scipy_build(build_dir = build_dir,\n+ python_version = '2.1.3',\n+ numeric_version = '20.3',\n+ f2py_version = '2.13.175-1250',\n+ atlas_version = '3.3.14',\n+ scipy_version = 'snapshot')\n+\n+ full_scipy_build(build_dir = build_dir,\n+ python_version = '2.1.3',\n+ numeric_version = '20.0',\n+ f2py_version = '2.13.175-1250',\n+ atlas_version = '3.3.14',\n+ scipy_version = 'snapshot')\n+\n+ full_scipy_build(build_dir = build_dir,\n+ python_version = '2.1.3',\n+ numeric_version = '19.0',\n+ f2py_version = '2.13.175-1250',\n+ atlas_version = '3.3.14',\n+ scipy_version = 'snapshot')\n+\n+ full_scipy_build(build_dir = build_dir,\n+ python_version = '2.1.3',\n+ numeric_version = '18.0',\n+ f2py_version = '2.13.175-1250',\n+ atlas_version = '3.3.14',\n+ scipy_version = 'snapshot')\n", + "added_lines": 725, + "deleted_lines": 0, + "source_code": "from distutils import file_util\nfrom distutils import dir_util\nfrom distutils.errors import DistutilsFileError\n#import tarfile\nimport sys, os, stat, time\nimport gzip\nimport tempfile, cStringIO\nimport urllib\nimport logging\n\nif sys.platform == 'cygwin':\n local_repository = \"/cygdrive/i/tarballs\"\nelif sys.platform == 'win32': \n local_repository = \"i:\\tarballs\"\nelse:\n local_repository = \"/home/shared/tarballs\"\n\npython_ftp_url = \"ftp://ftp.python.org/pub/python\"\nnumeric_url = \"http://prdownloads.sourceforge.net/numpy\"\nf2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\nscipy_url = \"ftp://www.scipy.org/pub\"\nblas_url = \"http://www.netlib.org/blas\"\nlapack_url = \"http://www.netlib.org/lapack\"\n#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\natlas_url = \"http://www.scipy.org/Members/eric\"\n\n#-----------------------------------------------------------------------------\n# Generic installation class. \n# built to handle downloading/untarring/building/installing arbitrary software\n#-----------------------------------------------------------------------------\n\nclass package_installation: \n def __init__(self,version='', dst_dir = '.',\n logger = None, python_exe='python'):\n #---------------------------------------------------------------------\n # These should be defined in sub-class before calling this\n # constructor\n #---------------------------------------------------------------------\n # \n #self.package_url -- The name of the url where tarball can be found.\n #self.package_base_name -- The base name of the source tarball.\n #self.package_dir_name -- Top level directory of unpacked tarball\n #self.tarball_suffix -- usually tar.gz or .tgz\n #self.build_type -- 'make' or 'setup' for makefile or python setup file\n \n # Version of the software package.\n self.version = version\n\n # Only used by packages built with setup.py\n self.python_exe = python_exe\n \n # Directory where package is unpacked/built/installed\n self.dst_dir = os.path.abspath(dst_dir) \n \n # make sure the destination exists\n dir_util.mkpath(self.dst_dir)\n \n if not logger:\n self.logger = logging\n else:\n self.logger = logger \n\n # Construct any derived names built from the above names.\n self.init_names()\n \n def init_names(self): \n self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)\n self.tarball = self.package_base_name + '.' + self.tarball_suffix\n\n def get_source(self):\n \"\"\" Grab the source tarball from a repository.\n \n Try a local repository first. If the file isn't found,\n grab it from an ftp site.\n \"\"\"\n local_found = 0\n if self.local_source_up_to_date():\n try:\n self.get_source_local()\n local_found = 1 \n except DistutilsFileError:\n pass\n \n if not local_found:\n self.get_source_ftp()\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n return 1\n \n def get_source_local(self):\n \"\"\" Grab the requested tarball from a local repository of source\n tarballs. If it doesn't exist, an error is raised.\n \"\"\"\n file = os.path.join(local_repository,self.tarball) \n dst_file = os.path.join(self.dst_dir,self.tarball)\n self.logger.info(\"Searching local repository for %s\" % file)\n try:\n copy_file(file,dst_file,self.logger)\n except DistutilsFileError, msg:\n self.logger.info(\"Not found:\",msg)\n raise\n \n def get_source_ftp(self):\n \"\"\" Grab requested tarball from a ftp site specified as a url. \n \"\"\"\n url = '/'.join([self.package_url,self.tarball])\n \n self.logger.info('Opening: %s' % url)\n f = urllib.urlopen(url)\n self.logger.info('Downloading: this may take a while')\n contents = f.read(-1)\n f.close()\n self.logger.info('Finished download (size=%d)' % len(contents))\n \n output_file = os.path.join(self.dst_dir,self.tarball)\n write_file(output_file,contents,self.logger)\n\n # Put file in local repository so we don't have to download it again.\n self.logger.info(\"Caching file in repository\" )\n src_file = output_file\n repos_file = os.path.join(local_repository,self.tarball) \n copy_file(src_file,repos_file,self.logger)\n\n def unpack_source(self,sub_dir = None):\n \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir\n \"\"\" \n tarfile = os.path.join(self.dst_dir,self.tarball)\n old_dir = None\n \n # copy and move into sub directory if it is specified.\n if sub_dir:\n dst_dir = os.path.join(self.dst_dir,sub_dir)\n dst_file = os.path.join(dst_dir,self.tarball)\n copy_file(tarfile,dst_file)\n change_dir(dst_dir,self.logger)\n try:\n try:\n # occasionally the tarball is not zipped, try this first.\n untar_file(self.tarball,self.dst_dir,\n self.logger,silent_failure=1)\n except:\n # otherwise, handle the fact that it is zipped \n dst = os.path.join(self.dst_dir,'tmp.tar') \n decompress_file(tarfile,dst,self.logger) \n untar_file(dst,self.dst_dir,self.logger)\n remove_file(dst,self.logger)\n finally:\n if old_dir:\n unchange_dir(self.logger)\n\n def auto_configure(self):\n cmd = os.path.join('.','configure')\n text = run_command(cmd,self.package_dir,self.logger)\n\n def build_with_make(self):\n cmd = 'make'\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, prefix = None):\n if prefix is None:\n prefix = os.path.abspath(self.dst_dir)\n cmd = 'make install prefix=%s' % prefix\n text = run_command(cmd,self.package_dir,self.logger)\n\n def python_setup(self):\n cmd = self.python_exe + ' setup.py install'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def _make(self,**kw):\n \"\"\" This generally needs to be overrridden in the derived class,\n but this will suffice for the standard configure/make process. \n \"\"\"\n self.get_source()\n self.unpack_source()\n self.auto_configure()\n self.build_with_make()\n self.install_with_make()\n\n def _setup(self):\n \"\"\" Build with Python setup script.\n \"\"\"\n self.get_source()\n self.unpack_source()\n self.python_setup()\n\n def install(self):\n self.logger.info('####### Building: %s' % self.package_base_name)\n self.logger.info(' Version: %s' % self.version)\n self.logger.info(' Url: %s' % self.package_url)\n self.logger.info(' Install dir: %s' % self.dst_dir)\n self.logger.info(' Package dir: %s' % self.package_dir)\n self.logger.info(' Suffix: %s' % self.tarball_suffix)\n self.logger.info(' Build type: %s' % self.build_type)\n if self.build_type == 'setup':\n self._setup()\n else: \n self._make()\n self.logger.info('####### Finished Building: %s' % self.package_base_name) \n \n#-----------------------------------------------------------------------------\n# Installation class for Python itself.\n#-----------------------------------------------------------------------------\n \nclass python_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Python. \n self.package_base_name = 'Python-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = '/'.join([python_ftp_url,version])\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def write_install_config(self): \n \"\"\" Make doesn't seem to install scripts in the correct places.\n \n Writing this to the python directory will solve the problem.\n [install_script]\n install-dir= \n \"\"\"\n text = \"[install_scripts]\\n\"\\\n \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n file = os.path.join(self.package_dir,'setup.cfg') \n write_file(file,text,self.logger,mode='w')\n\n def install_with_make(self):\n \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n file is written to force installation in the correct place.\n \"\"\"\n self.write_install_config()\n package_installation.install_with_make(self)\n\n def get_exe_name(self):\n pyname = os.path.join('.','python')\n cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"\n text = run_command(cmd,self.package_dir,self.logger)\n exe = os.path.join(self.dst_dir,'bin','python'+text)\n return exe\n\n#-----------------------------------------------------------------------------\n# Installation class for Blas.\n#-----------------------------------------------------------------------------\n\nclass blas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for for \"slow\" blas\n self.package_base_name = 'blas'\n self.package_dir_name = 'BLAS'\n self.package_url = blas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def unpack_source(self,subdir=None):\n \"\"\" Dag. blas.tgz doesn't have directory information -- its\n just a tar ball of fortran source code. untar it in the\n BLAS directory\n \"\"\"\n package_installation.unpack_source(self,self.package_dir_name)\n \n def auto_configure(self):\n # nothing to do.\n pass\n def build_with_make(self, **kw):\n libname = 'blas_LINUX.a'\n cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over. \n src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n self.logger.info(\"Installing blas\")\n copy_file(src_file,dst_file,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for Lapack.\n#-----------------------------------------------------------------------------\n\nclass lapack_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Lapack 3.0 + updates \n self.package_base_name = 'lapack'\n self.package_dir_name = 'LAPACK'\n self.package_url = lapack_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self):\n # perhaps this should actually override auto_conifgure\n # before make, we need to copy the appropriate setup file in.\n # should work anywhere g77 works...\n make_inc = 'make.inc.' + self.platform\n src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n dst_file = os.path.join(self.package_dir,'make.inc')\n copy_file(src_file,dst_file,self.logger)\n\n def build_with_make(self, **kw):\n cmd = 'make install lapacklib'\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over.\n src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','liblapack.a')\n self.logger.info(\"Installing lapack\")\n copy_file(src_file,dst_file,self.logger)\n \n#-----------------------------------------------------------------------------\n# Installation class for Numeric\n#-----------------------------------------------------------------------------\n\nclass numeric_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'Numeric-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = numeric_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for f2py\n#-----------------------------------------------------------------------------\n\nclass f2py_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Typical file format: F2PY-2.13.175-1250.tar.gz\n self.package_base_name = 'F2PY-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = f2py_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for Atlas.\n# This is a binary install *NOT* a source install.\n# The source install is a pain to automate.\n#-----------------------------------------------------------------------------\n\nclass atlas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n #self.package_base_name = 'atlas' + version\n #self.package_dir_name = 'ATLAS'\n self.package_base_name = 'atlas-RH7.1-PIII'\n self.package_dir_name = 'atlas'\n self.package_url = atlas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self,**kw):\n pass\n def build_with_make(self,**kw):\n pass\n def install_with_make(self, **kw):\n # just copy the tree over.\n dst = os.path.join(self.dst_dir,'lib','atlas')\n self.logger.info(\"Installing Atlas\")\n copy_tree(self.package_dir,dst,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for scipy\n#-----------------------------------------------------------------------------\n\nclass scipy_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'scipy_snapshot'\n self.package_dir_name = 'scipy'\n self.package_url = scipy_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'setup'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n file = os.path.join(local_repository,self.tarball)\n up_to_date = 0\n try:\n file_time = os.stat(file)[stat.ST_MTIME] \n fyear,fmonth,fday = time.localtime(file_time)[:3]\n year,month,day = time.localtime()[:3]\n if year == year and month == month and day == day:\n up_to_date = 1\n self.logger.info(\"Repository file up to date: %s\" % file)\n except OSError, msg:\n pass\n return up_to_date\n \n#-----------------------------------------------------------------------------\n# Utilities\n#-----------------------------------------------------------------------------\n\n\n#if os.name == 'nt':\n# def exec_command(command):\n# \"\"\" not sure how to get exit status on nt. \"\"\"\n# in_pipe,out_pipe = os.popen4(command)\n# in_pipe.close()\n# text = out_pipe.read()\n# return 0, text\n#else:\n# import commands\n# exec_command = commands.getstatusoutput\n \n# This may not work on Win98... The above stuff was to handle these machines.\nimport commands\nexec_command = commands.getstatusoutput\n\ndef copy_file(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying %s->%s\" % (src,dst)) \n try:\n file_util.copy_file(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef copy_tree(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying directory tree %s->%s\" % (src,dst)) \n try:\n dir_util.copy_tree(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef remove_file(file,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Remove file %s\" % file) \n try:\n os.remove(file)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef write_file(file,contents,logger=None,mode='wb'):\n if not logger:\n logger = logging\n logger.info('Write file: %s' % file)\n try:\n new_file = open(file,mode)\n new_file.write(contents)\n new_file.close()\n except Exception, e: \n logger.exception(\"Write failed\") \n raise\n\n# I know, I know...\nold_dir = []\n\ndef change_dir(d, logger = None):\n if not logger:\n logger = logging\n global old_dir \n cwd = os.getcwd() \n old_dir.append(cwd)\n d = os.path.abspath(d)\n if d != old_dir[-1]:\n logger.info(\"Change directory: %s\" % d) \n try:\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n #if d == '.':\n # import sys,traceback\n # f = sys._getframe()\n # traceback.print_stack(f)\n\ndef unchange_dir(logger=None):\n if not logger:\n logger = logging \n global old_dir\n try:\n cwd = os.getcwd()\n d = old_dir.pop(-1) \n try:\n if d != cwd:\n logger.info(\"Change directory : %s\" % d)\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n except IndexError:\n logger.exception(\"Change directory failed\")\n \ndef decompress_file(src,dst,logger = None):\n if not logger:\n logger = logging\n logger.info(\"Upacking %s->%s\" % (src,dst))\n try:\n f = gzip.open(src,'rb')\n contents = f.read(-1)\n f = open(dst, 'wb')\n f.write(contents)\n except Exception, e: \n logger.exception(\"Unpack failed\")\n raise \n\n \ndef untar_file(file,dst_dir='.',logger = None,silent_failure = 0): \n if not logger:\n logger = logging\n logger.info(\"Untarring file: %s\" % (file))\n try:\n run_command('tar -xf ' + file,directory = dst_dir,\n logger=logger, silent_failure = silent_failure)\n except Exception, e:\n if not silent_failure: \n logger.exception(\"Untar failed\")\n raise \n\ndef unpack_file(file,logger = None):\n \"\"\" equivalent to 'tar -xzvf file'\n \"\"\"\n dst = 'tmp.tar'\n decompress_file(file,dst,logger) \n untar_file(dst.logger)\n remove_file(dst,logger) \n\ndef run_command(cmd,directory='.',logger=None,silent_failure = 0):\n if not logger:\n logger = logging\n change_dir(directory,logger) \n try: \n msg = 'Command: %s' % cmd\n status,text = exec_command(cmd)\n if status:\n msg = msg + ' (failed)'\n logger.info(msg) \n if status and not silent_failure:\n logger.error('command failed with status: %d' % status) \n #if text:\n # logger.info('Command Output:\\n'+text)\n finally:\n unchange_dir(logger)\n if status:\n raise ValueError,'Command had non-zero exit status'\n return text \n\ndef full_scipy_build(build_dir = '.',\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot'):\n \n # for now the atlas version is ignored. Only the \n # binaries for RH are supported at the moment.\n \n dst_dir = os.path.join(build_dir,sys.platform)\n\n logger = logging.Logger(\"SciPy Test\")\n fmt = logging.Formatter(logging.BASIC_FORMAT)\n log_stream = cStringIO.StringIO()\n stream_handler = logging.StreamHandler(log_stream)\n stream_handler.setFormatter(fmt)\n logger.addHandler(stream_handler)\n # also write to stderr\n stderr = logging.StreamHandler()\n stderr.setFormatter(fmt)\n logger.addHandler(stderr)\n \n python = python_installation(version=python_version,\n logger = logger,\n dst_dir = dst_dir)\n python.install()\n \n python_name = python.get_exe_name()\n\n numeric = numeric_installation(version=numeric_version,\n dst_dir = dst_dir,\n logger = logger,\n python_exe=python_name)\n numeric.install()\n \n f2py = f2py_installation(version=f2py_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n f2py.install() \n\n # download files don't have a version specified \n #lapack = lapack_installation(version='',\n # dst_dir = dst_dir\n # python_exe=python_name)\n #lapack.install() \n\n # download files don't have a version specified \n #blas = blas_installation(version='',\n # logger = logger,\n # dst_dir = dst_dir,\n # python_exe=python_name)\n #blas.install() \n \n # ATLAS\n atlas = atlas_installation(version=atlas_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n atlas.install()\n \n # version not currently used -- need to fix this.\n scipy = scipy_installation(version=scipy_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n scipy.install() \n\n # The change to tmp makes sure there isn't a scipy directory in \n # the local scope.\n # All tests are run.\n lvl = 1\n cmd = python_name + ' -c \"import sys,scipy;suite=scipy.test(%d);\"' % lvl\n test_results = run_command(cmd, logger=logger,\n directory = tempfile.gettempdir())\n \n vitals = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n numeric_version,scipy_version) \n \n msg = 'From: scipy-test@enthought.com\\n'\n msg = msg + 'To: knucklehead@enthought.com\\n'\n msg = msg + 'Subject: %s\\n' % vitals\n msg = msg + '\\r\\n\\r\\n'\n msg = msg + 'platform: %s,%s\\n' % (sys.platform,os.name)\n msg = msg + 'python_version: %s\\n' % python_version\n msg = msg + 'numeric_version: %s\\n' % numeric_version\n msg = msg + 'f2py_version: %s\\n' % f2py_version\n msg = msg + 'atlas_version(hard coded): %s\\n' % atlas_version\n msg = msg + 'scipy_version: %s\\n' % scipy_version\n msg = msg + test_results \n msg = msg + '-----------------------------\\n' \n msg = msg + '-------- BUILD LOG -------\\n' \n msg = msg + '-----------------------------\\n' \n msg = msg + log_stream.getvalue()\n # mail results\n import smtplib \n toaddrs = \"eric@enthought.com\"\n fromaddr = \"eric@enthought.com\"\n server = smtplib.SMTP('enthought.com') \n server.sendmail(fromaddr, toaddrs, msg)\n server.quit()\n print msg\n\n \nif __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n\n full_scipy_build(build_dir = build_dir,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older python\n full_scipy_build(build_dir = build_dir,\n python_version = '2.1.3',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older numeric\n full_scipy_build(build_dir = build_dir,\n python_version = '2.1.3',\n numeric_version = '20.3',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n python_version = '2.1.3',\n numeric_version = '20.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n python_version = '2.1.3',\n numeric_version = '19.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n python_version = '2.1.3',\n numeric_version = '18.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n", + "source_code_before": null, + "methods": [ + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 33, + "end_line": 64, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "init_names", + "long_name": "init_names( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 66, + "end_line": 68, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_source", + "long_name": "get_source( self )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 4, + "token_count": 39, + "parameters": [ + "self" + ], + "start_line": 70, + "end_line": 85, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 87, + "end_line": 90, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "get_source_local", + "long_name": "get_source_local( self )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 2, + "token_count": 74, + "parameters": [ + "self" + ], + "start_line": 92, + "end_line": 103, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "get_source_ftp", + "long_name": "get_source_ftp( self )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 1, + "token_count": 136, + "parameters": [ + "self" + ], + "start_line": 105, + "end_line": 124, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , sub_dir = None )", + "filename": "auto_test.py", + "nloc": 20, + "complexity": 5, + "token_count": 153, + "parameters": [ + "self", + "sub_dir" + ], + "start_line": 126, + "end_line": 151, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 153, + "end_line": 155, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 157, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , prefix = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 2, + "token_count": 45, + "parameters": [ + "self", + "prefix" + ], + "start_line": 161, + "end_line": 165, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "python_setup", + "long_name": "python_setup( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 167, + "end_line": 169, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 34, + "parameters": [ + "self", + "kw" + ], + "start_line": 171, + "end_line": 179, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "_setup", + "long_name": "_setup( self )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 21, + "parameters": [ + "self" + ], + "start_line": 181, + "end_line": 186, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 2, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 188, + "end_line": 200, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 73, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 208, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 219, + "end_line": 229, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 231, + "end_line": 236, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_exe_name", + "long_name": "get_exe_name( self )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 56, + "parameters": [ + "self" + ], + "start_line": 238, + "end_line": 243, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 251, + "end_line": 261, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , subdir = None )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "subdir" + ], + "start_line": 263, + "end_line": 268, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 270, + "end_line": 272, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "kw" + ], + "start_line": 273, + "end_line": 276, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 278, + "end_line": 283, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 291, + "end_line": 301, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 303, + "end_line": 310, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "kw" + ], + "start_line": 312, + "end_line": 314, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 316, + "end_line": 321, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 329, + "end_line": 337, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 346, + "end_line": 355, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 366, + "end_line": 376, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 378, + "end_line": 379, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 380, + "end_line": 381, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "kw" + ], + "start_line": 382, + "end_line": 386, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 394, + "end_line": 402, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self" + ], + "start_line": 404, + "end_line": 418, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "copy_file", + "long_name": "copy_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 440, + "end_line": 448, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "copy_tree", + "long_name": "copy_tree( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 450, + "end_line": 458, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_file", + "long_name": "remove_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "file", + "logger" + ], + "start_line": 460, + "end_line": 468, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_file", + "long_name": "write_file( file , contents , logger = None , mode = 'wb' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 3, + "token_count": 63, + "parameters": [ + "file", + "contents", + "logger", + "mode" + ], + "start_line": 470, + "end_line": 480, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "change_dir", + "long_name": "change_dir( d , logger = None )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 4, + "token_count": 78, + "parameters": [ + "d", + "logger" + ], + "start_line": 485, + "end_line": 498, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "unchange_dir", + "long_name": "unchange_dir( logger = None )", + "filename": "auto_test.py", + "nloc": 16, + "complexity": 5, + "token_count": 76, + "parameters": [ + "logger" + ], + "start_line": 504, + "end_line": 519, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "decompress_file", + "long_name": "decompress_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 12, + "complexity": 3, + "token_count": 77, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 521, + "end_line": 532, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "untar_file", + "long_name": "untar_file( file , dst_dir = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 4, + "token_count": 70, + "parameters": [ + "file", + "dst_dir", + "logger", + "silent_failure" + ], + "start_line": 535, + "end_line": 545, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "unpack_file", + "long_name": "unpack_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 33, + "parameters": [ + "file", + "logger" + ], + "start_line": 547, + "end_line": 553, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 17, + "complexity": 7, + "token_count": 88, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 555, + "end_line": 573, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 69, + "complexity": 1, + "token_count": 408, + "parameters": [ + "build_dir", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 575, + "end_line": 677, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 103, + "top_nesting_level": 0 + } + ], + "methods_before": [], + "changed_methods": [ + { + "name": "get_source", + "long_name": "get_source( self )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 4, + "token_count": 39, + "parameters": [ + "self" + ], + "start_line": 70, + "end_line": 85, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , subdir = None )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "subdir" + ], + "start_line": 263, + "end_line": 268, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 231, + "end_line": 236, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "kw" + ], + "start_line": 273, + "end_line": 276, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , sub_dir = None )", + "filename": "auto_test.py", + "nloc": 20, + "complexity": 5, + "token_count": 153, + "parameters": [ + "self", + "sub_dir" + ], + "start_line": 126, + "end_line": 151, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "remove_file", + "long_name": "remove_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "file", + "logger" + ], + "start_line": 460, + "end_line": 468, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_file", + "long_name": "write_file( file , contents , logger = None , mode = 'wb' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 3, + "token_count": 63, + "parameters": [ + "file", + "contents", + "logger", + "mode" + ], + "start_line": 470, + "end_line": 480, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "unchange_dir", + "long_name": "unchange_dir( logger = None )", + "filename": "auto_test.py", + "nloc": 16, + "complexity": 5, + "token_count": 76, + "parameters": [ + "logger" + ], + "start_line": 504, + "end_line": 519, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "untar_file", + "long_name": "untar_file( file , dst_dir = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 4, + "token_count": 70, + "parameters": [ + "file", + "dst_dir", + "logger", + "silent_failure" + ], + "start_line": 535, + "end_line": 545, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 2, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 188, + "end_line": 200, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "init_names", + "long_name": "init_names( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 66, + "end_line": 68, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , prefix = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 2, + "token_count": 45, + "parameters": [ + "self", + "prefix" + ], + "start_line": 161, + "end_line": 165, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "get_source_local", + "long_name": "get_source_local( self )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 2, + "token_count": 74, + "parameters": [ + "self" + ], + "start_line": 92, + "end_line": 103, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "change_dir", + "long_name": "change_dir( d , logger = None )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 4, + "token_count": 78, + "parameters": [ + "d", + "logger" + ], + "start_line": 485, + "end_line": 498, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "get_exe_name", + "long_name": "get_exe_name( self )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 56, + "parameters": [ + "self" + ], + "start_line": 238, + "end_line": 243, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 157, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "decompress_file", + "long_name": "decompress_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 12, + "complexity": 3, + "token_count": 77, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 521, + "end_line": 532, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 33, + "end_line": 64, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "copy_tree", + "long_name": "copy_tree( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 450, + "end_line": 458, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 153, + "end_line": 155, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 219, + "end_line": 229, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 378, + "end_line": 379, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 34, + "parameters": [ + "self", + "kw" + ], + "start_line": 171, + "end_line": 179, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 278, + "end_line": 283, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "_setup", + "long_name": "_setup( self )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 21, + "parameters": [ + "self" + ], + "start_line": 181, + "end_line": 186, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_source_ftp", + "long_name": "get_source_ftp( self )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 1, + "token_count": 136, + "parameters": [ + "self" + ], + "start_line": 105, + "end_line": 124, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 69, + "complexity": 1, + "token_count": 408, + "parameters": [ + "build_dir", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 575, + "end_line": 677, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 103, + "top_nesting_level": 0 + }, + { + "name": "unpack_file", + "long_name": "unpack_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 33, + "parameters": [ + "file", + "logger" + ], + "start_line": 547, + "end_line": 553, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 87, + "end_line": 90, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 17, + "complexity": 7, + "token_count": 88, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 555, + "end_line": 573, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 0 + }, + { + "name": "copy_file", + "long_name": "copy_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 440, + "end_line": 448, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "python_setup", + "long_name": "python_setup( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 167, + "end_line": 169, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + } + ], + "nloc": 470, + "complexity": 87, + "token_count": 3196, + "diff_parsed": { + "added": [ + "from distutils import file_util", + "from distutils import dir_util", + "from distutils.errors import DistutilsFileError", + "#import tarfile", + "import sys, os, stat, time", + "import gzip", + "import tempfile, cStringIO", + "import urllib", + "import logging", + "", + "if sys.platform == 'cygwin':", + " local_repository = \"/cygdrive/i/tarballs\"", + "elif sys.platform == 'win32':", + " local_repository = \"i:\\tarballs\"", + "else:", + " local_repository = \"/home/shared/tarballs\"", + "", + "python_ftp_url = \"ftp://ftp.python.org/pub/python\"", + "numeric_url = \"http://prdownloads.sourceforge.net/numpy\"", + "f2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"", + "scipy_url = \"ftp://www.scipy.org/pub\"", + "blas_url = \"http://www.netlib.org/blas\"", + "lapack_url = \"http://www.netlib.org/lapack\"", + "#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"", + "atlas_url = \"http://www.scipy.org/Members/eric\"", + "", + "#-----------------------------------------------------------------------------", + "# Generic installation class.", + "# built to handle downloading/untarring/building/installing arbitrary software", + "#-----------------------------------------------------------------------------", + "", + "class package_installation:", + " def __init__(self,version='', dst_dir = '.',", + " logger = None, python_exe='python'):", + " #---------------------------------------------------------------------", + " # These should be defined in sub-class before calling this", + " # constructor", + " #---------------------------------------------------------------------", + " #", + " #self.package_url -- The name of the url where tarball can be found.", + " #self.package_base_name -- The base name of the source tarball.", + " #self.package_dir_name -- Top level directory of unpacked tarball", + " #self.tarball_suffix -- usually tar.gz or .tgz", + " #self.build_type -- 'make' or 'setup' for makefile or python setup file", + "", + " # Version of the software package.", + " self.version = version", + "", + " # Only used by packages built with setup.py", + " self.python_exe = python_exe", + "", + " # Directory where package is unpacked/built/installed", + " self.dst_dir = os.path.abspath(dst_dir)", + "", + " # make sure the destination exists", + " dir_util.mkpath(self.dst_dir)", + "", + " if not logger:", + " self.logger = logging", + " else:", + " self.logger = logger", + "", + " # Construct any derived names built from the above names.", + " self.init_names()", + "", + " def init_names(self):", + " self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)", + " self.tarball = self.package_base_name + '.' + self.tarball_suffix", + "", + " def get_source(self):", + " \"\"\" Grab the source tarball from a repository.", + "", + " Try a local repository first. If the file isn't found,", + " grab it from an ftp site.", + " \"\"\"", + " local_found = 0", + " if self.local_source_up_to_date():", + " try:", + " self.get_source_local()", + " local_found = 1", + " except DistutilsFileError:", + " pass", + "", + " if not local_found:", + " self.get_source_ftp()", + "", + " def local_source_up_to_date(self):", + " \"\"\" Hook to test whether a file found in the repository is current", + " \"\"\"", + " return 1", + "", + " def get_source_local(self):", + " \"\"\" Grab the requested tarball from a local repository of source", + " tarballs. If it doesn't exist, an error is raised.", + " \"\"\"", + " file = os.path.join(local_repository,self.tarball)", + " dst_file = os.path.join(self.dst_dir,self.tarball)", + " self.logger.info(\"Searching local repository for %s\" % file)", + " try:", + " copy_file(file,dst_file,self.logger)", + " except DistutilsFileError, msg:", + " self.logger.info(\"Not found:\",msg)", + " raise", + "", + " def get_source_ftp(self):", + " \"\"\" Grab requested tarball from a ftp site specified as a url.", + " \"\"\"", + " url = '/'.join([self.package_url,self.tarball])", + "", + " self.logger.info('Opening: %s' % url)", + " f = urllib.urlopen(url)", + " self.logger.info('Downloading: this may take a while')", + " contents = f.read(-1)", + " f.close()", + " self.logger.info('Finished download (size=%d)' % len(contents))", + "", + " output_file = os.path.join(self.dst_dir,self.tarball)", + " write_file(output_file,contents,self.logger)", + "", + " # Put file in local repository so we don't have to download it again.", + " self.logger.info(\"Caching file in repository\" )", + " src_file = output_file", + " repos_file = os.path.join(local_repository,self.tarball)", + " copy_file(src_file,repos_file,self.logger)", + "", + " def unpack_source(self,sub_dir = None):", + " \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir", + " \"\"\"", + " tarfile = os.path.join(self.dst_dir,self.tarball)", + " old_dir = None", + "", + " # copy and move into sub directory if it is specified.", + " if sub_dir:", + " dst_dir = os.path.join(self.dst_dir,sub_dir)", + " dst_file = os.path.join(dst_dir,self.tarball)", + " copy_file(tarfile,dst_file)", + " change_dir(dst_dir,self.logger)", + " try:", + " try:", + " # occasionally the tarball is not zipped, try this first.", + " untar_file(self.tarball,self.dst_dir,", + " self.logger,silent_failure=1)", + " except:", + " # otherwise, handle the fact that it is zipped", + " dst = os.path.join(self.dst_dir,'tmp.tar')", + " decompress_file(tarfile,dst,self.logger)", + " untar_file(dst,self.dst_dir,self.logger)", + " remove_file(dst,self.logger)", + " finally:", + " if old_dir:", + " unchange_dir(self.logger)", + "", + " def auto_configure(self):", + " cmd = os.path.join('.','configure')", + " text = run_command(cmd,self.package_dir,self.logger)", + "", + " def build_with_make(self):", + " cmd = 'make'", + " text = run_command(cmd,self.package_dir,self.logger)", + "", + " def install_with_make(self, prefix = None):", + " if prefix is None:", + " prefix = os.path.abspath(self.dst_dir)", + " cmd = 'make install prefix=%s' % prefix", + " text = run_command(cmd,self.package_dir,self.logger)", + "", + " def python_setup(self):", + " cmd = self.python_exe + ' setup.py install'", + " text = run_command(cmd,self.package_dir,self.logger)", + "", + " def _make(self,**kw):", + " \"\"\" This generally needs to be overrridden in the derived class,", + " but this will suffice for the standard configure/make process.", + " \"\"\"", + " self.get_source()", + " self.unpack_source()", + " self.auto_configure()", + " self.build_with_make()", + " self.install_with_make()", + "", + " def _setup(self):", + " \"\"\" Build with Python setup script.", + " \"\"\"", + " self.get_source()", + " self.unpack_source()", + " self.python_setup()", + "", + " def install(self):", + " self.logger.info('####### Building: %s' % self.package_base_name)", + " self.logger.info(' Version: %s' % self.version)", + " self.logger.info(' Url: %s' % self.package_url)", + " self.logger.info(' Install dir: %s' % self.dst_dir)", + " self.logger.info(' Package dir: %s' % self.package_dir)", + " self.logger.info(' Suffix: %s' % self.tarball_suffix)", + " self.logger.info(' Build type: %s' % self.build_type)", + " if self.build_type == 'setup':", + " self._setup()", + " else:", + " self._make()", + " self.logger.info('####### Finished Building: %s' % self.package_base_name)", + "", + "#-----------------------------------------------------------------------------", + "# Installation class for Python itself.", + "#-----------------------------------------------------------------------------", + "", + "class python_installation(package_installation):", + "", + " def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):", + "", + " # Specialization for Python.", + " self.package_base_name = 'Python-'+version", + " self.package_dir_name = self.package_base_name", + " self.package_url = '/'.join([python_ftp_url,version])", + " self.tarball_suffix = 'tgz'", + " self.build_type = 'make'", + "", + " package_installation.__init__(self,version,dst_dir,logger,python_exe)", + "", + " def write_install_config(self):", + " \"\"\" Make doesn't seem to install scripts in the correct places.", + "", + " Writing this to the python directory will solve the problem.", + " [install_script]", + " install-dir=", + " \"\"\"", + " text = \"[install_scripts]\\n\"\\", + " \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')", + " file = os.path.join(self.package_dir,'setup.cfg')", + " write_file(file,text,self.logger,mode='w')", + "", + " def install_with_make(self):", + " \"\"\" Scripts were failing to install correctly, so a setuo.cfg", + " file is written to force installation in the correct place.", + " \"\"\"", + " self.write_install_config()", + " package_installation.install_with_make(self)", + "", + " def get_exe_name(self):", + " pyname = os.path.join('.','python')", + " cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"", + " text = run_command(cmd,self.package_dir,self.logger)", + " exe = os.path.join(self.dst_dir,'bin','python'+text)", + " return exe", + "", + "#-----------------------------------------------------------------------------", + "# Installation class for Blas.", + "#-----------------------------------------------------------------------------", + "", + "class blas_installation(package_installation):", + "", + " def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):", + "", + " # Specialization for for \"slow\" blas", + " self.package_base_name = 'blas'", + " self.package_dir_name = 'BLAS'", + " self.package_url = blas_url", + " self.tarball_suffix = 'tgz'", + " self.build_type = 'make'", + "", + " self.platform = 'LINUX'", + " package_installation.__init__(self,version,dst_dir,logger,python_exe)", + "", + " def unpack_source(self,subdir=None):", + " \"\"\" Dag. blas.tgz doesn't have directory information -- its", + " just a tar ball of fortran source code. untar it in the", + " BLAS directory", + " \"\"\"", + " package_installation.unpack_source(self,self.package_dir_name)", + "", + " def auto_configure(self):", + " # nothing to do.", + " pass", + " def build_with_make(self, **kw):", + " libname = 'blas_LINUX.a'", + " cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname", + " text = run_command(cmd,self.package_dir,self.logger)", + "", + " def install_with_make(self, **kw):", + " # not really using make -- we'll just copy the file over.", + " src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)", + " dst_file = os.path.join(self.dst_dir,'lib','libblas.a')", + " self.logger.info(\"Installing blas\")", + " copy_file(src_file,dst_file,self.logger)", + "", + "#-----------------------------------------------------------------------------", + "# Installation class for Lapack.", + "#-----------------------------------------------------------------------------", + "", + "class lapack_installation(package_installation):", + "", + " def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):", + "", + " # Specialization for Lapack 3.0 + updates", + " self.package_base_name = 'lapack'", + " self.package_dir_name = 'LAPACK'", + " self.package_url = lapack_url", + " self.tarball_suffix = 'tgz'", + " self.build_type = 'make'", + "", + " self.platform = 'LINUX'", + " package_installation.__init__(self,version,dst_dir,logger,python_exe)", + "", + " def auto_configure(self):", + " # perhaps this should actually override auto_conifgure", + " # before make, we need to copy the appropriate setup file in.", + " # should work anywhere g77 works...", + " make_inc = 'make.inc.' + self.platform", + " src_file = os.path.join(self.package_dir,'INSTALL',make_inc)", + " dst_file = os.path.join(self.package_dir,'make.inc')", + " copy_file(src_file,dst_file,self.logger)", + "", + " def build_with_make(self, **kw):", + " cmd = 'make install lapacklib'", + " text = run_command(cmd,self.package_dir,self.logger)", + "", + " def install_with_make(self, **kw):", + " # not really using make -- we'll just copy the file over.", + " src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)", + " dst_file = os.path.join(self.dst_dir,'lib','liblapack.a')", + " self.logger.info(\"Installing lapack\")", + " copy_file(src_file,dst_file,self.logger)", + "", + "#-----------------------------------------------------------------------------", + "# Installation class for Numeric", + "#-----------------------------------------------------------------------------", + "", + "class numeric_installation(package_installation):", + "", + " def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):", + "", + " self.package_base_name = 'Numeric-'+version", + " self.package_dir_name = self.package_base_name", + " self.package_url = numeric_url", + " self.tarball_suffix = 'tar.gz'", + " self.build_type = 'setup'", + "", + " package_installation.__init__(self,version,dst_dir,logger,python_exe)", + "", + "", + "#-----------------------------------------------------------------------------", + "# Installation class for f2py", + "#-----------------------------------------------------------------------------", + "", + "class f2py_installation(package_installation):", + "", + " def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):", + "", + " # Typical file format: F2PY-2.13.175-1250.tar.gz", + " self.package_base_name = 'F2PY-'+version", + " self.package_dir_name = self.package_base_name", + " self.package_url = f2py_url", + " self.tarball_suffix = 'tar.gz'", + " self.build_type = 'setup'", + "", + " package_installation.__init__(self,version,dst_dir,logger,python_exe)", + "", + "", + "#-----------------------------------------------------------------------------", + "# Installation class for Atlas.", + "# This is a binary install *NOT* a source install.", + "# The source install is a pain to automate.", + "#-----------------------------------------------------------------------------", + "", + "class atlas_installation(package_installation):", + "", + " def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):", + "", + " #self.package_base_name = 'atlas' + version", + " #self.package_dir_name = 'ATLAS'", + " self.package_base_name = 'atlas-RH7.1-PIII'", + " self.package_dir_name = 'atlas'", + " self.package_url = atlas_url", + " self.tarball_suffix = 'tgz'", + " self.build_type = 'make'", + "", + " package_installation.__init__(self,version,dst_dir,logger,python_exe)", + "", + " def auto_configure(self,**kw):", + " pass", + " def build_with_make(self,**kw):", + " pass", + " def install_with_make(self, **kw):", + " # just copy the tree over.", + " dst = os.path.join(self.dst_dir,'lib','atlas')", + " self.logger.info(\"Installing Atlas\")", + " copy_tree(self.package_dir,dst,self.logger)", + "", + "#-----------------------------------------------------------------------------", + "# Installation class for scipy", + "#-----------------------------------------------------------------------------", + "", + "class scipy_installation(package_installation):", + "", + " def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):", + "", + " self.package_base_name = 'scipy_snapshot'", + " self.package_dir_name = 'scipy'", + " self.package_url = scipy_url", + " self.tarball_suffix = 'tgz'", + " self.build_type = 'setup'", + "", + " package_installation.__init__(self,version,dst_dir,logger,python_exe)", + "", + " def local_source_up_to_date(self):", + " \"\"\" Hook to test whether a file found in the repository is current", + " \"\"\"", + " file = os.path.join(local_repository,self.tarball)", + " up_to_date = 0", + " try:", + " file_time = os.stat(file)[stat.ST_MTIME]", + " fyear,fmonth,fday = time.localtime(file_time)[:3]", + " year,month,day = time.localtime()[:3]", + " if year == year and month == month and day == day:", + " up_to_date = 1", + " self.logger.info(\"Repository file up to date: %s\" % file)", + " except OSError, msg:", + " pass", + " return up_to_date", + "", + "#-----------------------------------------------------------------------------", + "# Utilities", + "#-----------------------------------------------------------------------------", + "", + "", + "#if os.name == 'nt':", + "# def exec_command(command):", + "# \"\"\" not sure how to get exit status on nt. \"\"\"", + "# in_pipe,out_pipe = os.popen4(command)", + "# in_pipe.close()", + "# text = out_pipe.read()", + "# return 0, text", + "#else:", + "# import commands", + "# exec_command = commands.getstatusoutput", + "", + "# This may not work on Win98... The above stuff was to handle these machines.", + "import commands", + "exec_command = commands.getstatusoutput", + "", + "def copy_file(src,dst,logger=None):", + " if not logger:", + " logger = logging", + " logger.info(\"Copying %s->%s\" % (src,dst))", + " try:", + " file_util.copy_file(src,dst)", + " except Exception, e:", + " logger.exception(\"Copy Failed\")", + " raise", + "", + "def copy_tree(src,dst,logger=None):", + " if not logger:", + " logger = logging", + " logger.info(\"Copying directory tree %s->%s\" % (src,dst))", + " try:", + " dir_util.copy_tree(src,dst)", + " except Exception, e:", + " logger.exception(\"Copy Failed\")", + " raise", + "", + "def remove_file(file,logger=None):", + " if not logger:", + " logger = logging", + " logger.info(\"Remove file %s\" % file)", + " try:", + " os.remove(file)", + " except Exception, e:", + " logger.exception(\"Remove failed\")", + " raise", + "", + "def write_file(file,contents,logger=None,mode='wb'):", + " if not logger:", + " logger = logging", + " logger.info('Write file: %s' % file)", + " try:", + " new_file = open(file,mode)", + " new_file.write(contents)", + " new_file.close()", + " except Exception, e:", + " logger.exception(\"Write failed\")", + " raise", + "", + "# I know, I know...", + "old_dir = []", + "", + "def change_dir(d, logger = None):", + " if not logger:", + " logger = logging", + " global old_dir", + " cwd = os.getcwd()", + " old_dir.append(cwd)", + " d = os.path.abspath(d)", + " if d != old_dir[-1]:", + " logger.info(\"Change directory: %s\" % d)", + " try:", + " os.chdir(d)", + " except Exception, e:", + " logger.exception(\"Change directory failed\")", + " raise", + " #if d == '.':", + " # import sys,traceback", + " # f = sys._getframe()", + " # traceback.print_stack(f)", + "", + "def unchange_dir(logger=None):", + " if not logger:", + " logger = logging", + " global old_dir", + " try:", + " cwd = os.getcwd()", + " d = old_dir.pop(-1)", + " try:", + " if d != cwd:", + " logger.info(\"Change directory : %s\" % d)", + " os.chdir(d)", + " except Exception, e:", + " logger.exception(\"Change directory failed\")", + " raise", + " except IndexError:", + " logger.exception(\"Change directory failed\")", + "", + "def decompress_file(src,dst,logger = None):", + " if not logger:", + " logger = logging", + " logger.info(\"Upacking %s->%s\" % (src,dst))", + " try:", + " f = gzip.open(src,'rb')", + " contents = f.read(-1)", + " f = open(dst, 'wb')", + " f.write(contents)", + " except Exception, e:", + " logger.exception(\"Unpack failed\")", + " raise", + "", + "", + "def untar_file(file,dst_dir='.',logger = None,silent_failure = 0):", + " if not logger:", + " logger = logging", + " logger.info(\"Untarring file: %s\" % (file))", + " try:", + " run_command('tar -xf ' + file,directory = dst_dir,", + " logger=logger, silent_failure = silent_failure)", + " except Exception, e:", + " if not silent_failure:", + " logger.exception(\"Untar failed\")", + " raise", + "", + "def unpack_file(file,logger = None):", + " \"\"\" equivalent to 'tar -xzvf file'", + " \"\"\"", + " dst = 'tmp.tar'", + " decompress_file(file,dst,logger)", + " untar_file(dst.logger)", + " remove_file(dst,logger)", + "", + "def run_command(cmd,directory='.',logger=None,silent_failure = 0):", + " if not logger:", + " logger = logging", + " change_dir(directory,logger)", + " try:", + " msg = 'Command: %s' % cmd", + " status,text = exec_command(cmd)", + " if status:", + " msg = msg + ' (failed)'", + " logger.info(msg)", + " if status and not silent_failure:", + " logger.error('command failed with status: %d' % status)", + " #if text:", + " # logger.info('Command Output:\\n'+text)", + " finally:", + " unchange_dir(logger)", + " if status:", + " raise ValueError,'Command had non-zero exit status'", + " return text", + "", + "def full_scipy_build(build_dir = '.',", + " python_version = '2.2.1',", + " numeric_version = '21.0',", + " f2py_version = '2.13.175-1250',", + " atlas_version = '3.3.14',", + " scipy_version = 'snapshot'):", + "", + " # for now the atlas version is ignored. Only the", + " # binaries for RH are supported at the moment.", + "", + " dst_dir = os.path.join(build_dir,sys.platform)", + "", + " logger = logging.Logger(\"SciPy Test\")", + " fmt = logging.Formatter(logging.BASIC_FORMAT)", + " log_stream = cStringIO.StringIO()", + " stream_handler = logging.StreamHandler(log_stream)", + " stream_handler.setFormatter(fmt)", + " logger.addHandler(stream_handler)", + " # also write to stderr", + " stderr = logging.StreamHandler()", + " stderr.setFormatter(fmt)", + " logger.addHandler(stderr)", + "", + " python = python_installation(version=python_version,", + " logger = logger,", + " dst_dir = dst_dir)", + " python.install()", + "", + " python_name = python.get_exe_name()", + "", + " numeric = numeric_installation(version=numeric_version,", + " dst_dir = dst_dir,", + " logger = logger,", + " python_exe=python_name)", + " numeric.install()", + "", + " f2py = f2py_installation(version=f2py_version,", + " logger = logger,", + " dst_dir = dst_dir,", + " python_exe=python_name)", + " f2py.install()", + "", + " # download files don't have a version specified", + " #lapack = lapack_installation(version='',", + " # dst_dir = dst_dir", + " # python_exe=python_name)", + " #lapack.install()", + "", + " # download files don't have a version specified", + " #blas = blas_installation(version='',", + " # logger = logger,", + " # dst_dir = dst_dir,", + " # python_exe=python_name)", + " #blas.install()", + "", + " # ATLAS", + " atlas = atlas_installation(version=atlas_version,", + " logger = logger,", + " dst_dir = dst_dir,", + " python_exe=python_name)", + " atlas.install()", + "", + " # version not currently used -- need to fix this.", + " scipy = scipy_installation(version=scipy_version,", + " logger = logger,", + " dst_dir = dst_dir,", + " python_exe=python_name)", + " scipy.install()", + "", + " # The change to tmp makes sure there isn't a scipy directory in", + " # the local scope.", + " # All tests are run.", + " lvl = 1", + " cmd = python_name + ' -c \"import sys,scipy;suite=scipy.test(%d);\"' % lvl", + " test_results = run_command(cmd, logger=logger,", + " directory = tempfile.gettempdir())", + "", + " vitals = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,", + " numeric_version,scipy_version)", + "", + " msg = 'From: scipy-test@enthought.com\\n'", + " msg = msg + 'To: knucklehead@enthought.com\\n'", + " msg = msg + 'Subject: %s\\n' % vitals", + " msg = msg + '\\r\\n\\r\\n'", + " msg = msg + 'platform: %s,%s\\n' % (sys.platform,os.name)", + " msg = msg + 'python_version: %s\\n' % python_version", + " msg = msg + 'numeric_version: %s\\n' % numeric_version", + " msg = msg + 'f2py_version: %s\\n' % f2py_version", + " msg = msg + 'atlas_version(hard coded): %s\\n' % atlas_version", + " msg = msg + 'scipy_version: %s\\n' % scipy_version", + " msg = msg + test_results", + " msg = msg + '-----------------------------\\n'", + " msg = msg + '-------- BUILD LOG -------\\n'", + " msg = msg + '-----------------------------\\n'", + " msg = msg + log_stream.getvalue()", + " # mail results", + " import smtplib", + " toaddrs = \"eric@enthought.com\"", + " fromaddr = \"eric@enthought.com\"", + " server = smtplib.SMTP('enthought.com')", + " server.sendmail(fromaddr, toaddrs, msg)", + " server.quit()", + " print msg", + "", + "", + "if __name__ == '__main__':", + " build_dir = '/tmp/scipy_test'", + "", + " full_scipy_build(build_dir = build_dir,", + " python_version = '2.2.1',", + " numeric_version = '21.0',", + " f2py_version = '2.13.175-1250',", + " atlas_version = '3.3.14',", + " scipy_version = 'snapshot')", + "", + " # an older python", + " full_scipy_build(build_dir = build_dir,", + " python_version = '2.1.3',", + " numeric_version = '21.0',", + " f2py_version = '2.13.175-1250',", + " atlas_version = '3.3.14',", + " scipy_version = 'snapshot')", + "", + " # an older numeric", + " full_scipy_build(build_dir = build_dir,", + " python_version = '2.1.3',", + " numeric_version = '20.3',", + " f2py_version = '2.13.175-1250',", + " atlas_version = '3.3.14',", + " scipy_version = 'snapshot')", + "", + " full_scipy_build(build_dir = build_dir,", + " python_version = '2.1.3',", + " numeric_version = '20.0',", + " f2py_version = '2.13.175-1250',", + " atlas_version = '3.3.14',", + " scipy_version = 'snapshot')", + "", + " full_scipy_build(build_dir = build_dir,", + " python_version = '2.1.3',", + " numeric_version = '19.0',", + " f2py_version = '2.13.175-1250',", + " atlas_version = '3.3.14',", + " scipy_version = 'snapshot')", + "", + " full_scipy_build(build_dir = build_dir,", + " python_version = '2.1.3',", + " numeric_version = '18.0',", + " f2py_version = '2.13.175-1250',", + " atlas_version = '3.3.14',", + " scipy_version = 'snapshot')" + ], + "deleted": [] + } + }, + { + "old_path": null, + "new_path": "scipy_distutils/logging.py", + "filename": "logging.py", + "extension": "py", + "change_type": "ADD", + "diff": "@@ -0,0 +1,1737 @@\n+#! /usr/bin/env python\n+#\n+# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.\n+#\n+# Permission to use, copy, modify, and distribute this software and its\n+# documentation for any purpose and without fee is hereby granted,\n+# provided that the above copyright notice appear in all copies and that\n+# both that copyright notice and this permission notice appear in\n+# supporting documentation, and that the name of Vinay Sajip\n+# not be used in advertising or publicity pertaining to distribution\n+# of the software without specific, written prior permission.\n+# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\n+# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL\n+# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\n+# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER\n+# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT\n+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n+#\n+# For the change history, see README.txt in the distribution.\n+#\n+# This file is part of the Python logging distribution. See\n+# http://www.red-dove.com/python_logging.html\n+#\n+\n+\"\"\"\n+Logging module for Python. Based on PEP 282 and comments thereto in\n+comp.lang.python, and influenced by Apache's log4j system.\n+\n+Should work under Python versions >= 1.5.2, except that source line\n+information is not available unless 'inspect' is.\n+\n+Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved.\n+\n+To use, simply 'import logging' and log away!\n+\"\"\"\n+\n+import sys, os, types, time, string, socket, cPickle, cStringIO\n+\n+try:\n+ import thread\n+except ImportError:\n+ thread = None\n+try:\n+ import inspect\n+except ImportError:\n+ inspect = None\n+\n+__author__ = \"Vinay Sajip \"\n+__status__ = \"alpha\"\n+__version__ = \"0.4.1\"\n+__date__ = \"03 April 2002\"\n+\n+#---------------------------------------------------------------------------\n+# Module data\n+#---------------------------------------------------------------------------\n+\n+#\n+#_srcfile is used when walking the stack to check when we've got the first\n+# caller stack frame.\n+#If run as a script, __file__ is not bound.\n+#\n+if __name__ == \"__main__\":\n+ _srcFile = None\n+else:\n+ _srcfile = os.path.splitext(__file__)\n+ if _srcfile[1] in [\".pyc\", \".pyo\"]:\n+ _srcfile = _srcfile[0] + \".py\"\n+ else:\n+ _srcfile = __file__\n+\n+#\n+#_start_time is used as the base when calculating the relative time of events\n+#\n+_start_time = time.time()\n+\n+DEFAULT_TCP_LOGGING_PORT = 9020\n+DEFAULT_UDP_LOGGING_PORT = 9021\n+DEFAULT_HTTP_LOGGING_PORT = 9022\n+SYSLOG_UDP_PORT = 514\n+\n+#\n+# Default levels and level names, these can be replaced with any positive set\n+# of values having corresponding names. There is a pseudo-level, ALL, which\n+# is only really there as a lower limit for user-defined levels. Handlers and\n+# loggers are initialized with ALL so that they will log all messages, even\n+# at user-defined levels.\n+#\n+CRITICAL = 50\n+FATAL = CRITICAL\n+ERROR = 40\n+WARN = 30\n+INFO = 20\n+DEBUG = 10\n+ALL = 0\n+\n+_levelNames = {\n+ CRITICAL : 'CRITICAL',\n+ ERROR : 'ERROR',\n+ WARN : 'WARN',\n+ INFO : 'INFO',\n+ DEBUG : 'DEBUG',\n+ ALL : 'ALL',\n+}\n+\n+def getLevelName(lvl):\n+ \"\"\"\n+ Return the textual representation of logging level 'lvl'. If the level is\n+ one of the predefined levels (CRITICAL, ERROR, WARN, INFO, DEBUG) then you\n+ get the corresponding string. If you have associated levels with names\n+ using addLevelName then the name you have associated with 'lvl' is\n+ returned. Otherwise, the string \"Level %s\" % lvl is returned.\n+ \"\"\"\n+ return _levelNames.get(lvl, (\"Level %s\" % lvl))\n+\n+def addLevelName(lvl, levelName):\n+ \"\"\"\n+ Associate 'levelName' with 'lvl'. This is used when converting levels\n+ to text during message formatting.\n+ \"\"\"\n+ _levelNames[lvl] = levelName\n+\n+#---------------------------------------------------------------------------\n+# The logging record\n+#---------------------------------------------------------------------------\n+\n+class LogRecord:\n+ \"\"\"\n+ LogRecord instances are created every time something is logged. They\n+ contain all the information pertinent to the event being logged. The\n+ main information passed in is in msg and args, which are combined\n+ using msg % args to create the message field of the record. The record\n+ also includes information such as when the record was created, the\n+ source line where the logging call was made, and any exception\n+ information to be logged.\n+ \"\"\"\n+ def __init__(self, name, lvl, pathname, lineno, msg, args, exc_info):\n+ \"\"\"\n+ Initialize a logging record with interesting information.\n+ \"\"\"\n+ ct = time.time()\n+ self.name = name\n+ self.msg = msg\n+ self.args = args\n+ self.level = getLevelName(lvl)\n+ self.lvl = lvl\n+ self.pathname = pathname\n+ try:\n+ self.filename = os.path.basename(pathname)\n+ except:\n+ self.filename = pathname\n+ self.exc_info = exc_info\n+ self.lineno = lineno\n+ self.created = ct\n+ self.msecs = (ct - long(ct)) * 1000\n+ self.relativeCreated = (self.created - _start_time) * 1000\n+ if thread:\n+ self.thread = thread.get_ident()\n+ else:\n+ self.thread = None\n+\n+ def __str__(self):\n+ return ''%(self.name, self.lvl,\n+ self.pathname, self.lineno, self.msg)\n+\n+#---------------------------------------------------------------------------\n+# Formatter classes and functions\n+#---------------------------------------------------------------------------\n+\n+class Formatter:\n+ \"\"\"\n+ Formatters need to know how a LogRecord is constructed. They are\n+ responsible for converting a LogRecord to (usually) a string which can\n+ be interpreted by either a human or an external system. The base Formatter\n+ allows a formatting string to be specified. If none is supplied, the\n+ default value of \"%s(message)\\\\n\" is used.\n+\n+ The Formatter can be initialized with a format string which makes use of\n+ knowledge of the LogRecord attributes - e.g. the default value mentioned\n+ above makes use of the fact that the user's message and arguments are pre-\n+ formatted into a LogRecord's message attribute. Currently, the useful\n+ attributes in a LogRecord are described by:\n+\n+ %(name)s Name of the logger (logging channel)\n+ %(lvl)s Numeric logging level for the message (DEBUG, INFO,\n+ WARN, ERROR, CRITICAL)\n+ %(level)s Text logging level for the message (\"DEBUG\", \"INFO\",\n+ \"WARN\", \"ERROR\", \"CRITICAL\")\n+ %(pathname)s Full pathname of the source file where the logging\n+ call was issued (if available)\n+ %(filename)s Filename portion of pathname\n+ %(lineno)d Source line number where the logging call was issued\n+ (if available)\n+ %(created)f Time when the LogRecord was created (time.time()\n+ return value)\n+ %(asctime)s textual time when the LogRecord was created\n+ %(msecs)d Millisecond portion of the creation time\n+ %(relativeCreated)d Time in milliseconds when the LogRecord was created,\n+ relative to the time the logging module was loaded\n+ (typically at application startup time)\n+ %(thread)d Thread ID (if available)\n+ %(message)s The result of msg % args, computed just as the\n+ record is emitted\n+ %(msg)s The raw formatting string provided by the user\n+ %(args)r The argument tuple which goes with the formatting\n+ string in the msg attribute\n+ \"\"\"\n+ def __init__(self, fmt=None, datefmt=None):\n+ \"\"\"\n+ Initialize the formatter either with the specified format string, or a\n+ default as described above. Allow for specialized date formatting with\n+ the optional datefmt argument (if omitted, you get the ISO8601 format).\n+ \"\"\"\n+ if fmt:\n+ self._fmt = fmt\n+ else:\n+ self._fmt = \"%(message)s\"\n+ self.datefmt = datefmt\n+\n+ def formatTime(self, record, datefmt=None):\n+ \"\"\"\n+ This method should be called from format() by a formatter which\n+ wants to make use of a formatted time. This method can be overridden\n+ in formatters to provide for any specific requirement, but the\n+ basic behaviour is as follows: if datefmt (a string) is specfied,\n+ it is used with time.strftime to format the creation time of the\n+ record. Otherwise, the ISO8601 format is used. The resulting\n+ string is written to the asctime attribute of the record.\n+ \"\"\"\n+ ct = record.created\n+ if datefmt:\n+ s = time.strftime(datefmt, time.localtime(ct))\n+ else:\n+ t = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime(ct))\n+ s = \"%s,%03d\" % (t, record.msecs)\n+ record.asctime = s\n+\n+ def formatException(self, ei):\n+ \"\"\"\n+ Format the specified exception information as a string. This\n+ default implementation just uses traceback.print_exception()\n+ \"\"\"\n+ import traceback\n+ sio = cStringIO.StringIO()\n+ traceback.print_exception(ei[0], ei[1], ei[2], None, sio)\n+ s = sio.getvalue()\n+ sio.close()\n+ return s\n+\n+ def format(self, record):\n+ \"\"\"\n+ The record's attribute dictionary is used as the operand to a\n+ string formatting operation which yields the returned string.\n+ Before formatting the dictionary, a couple of preparatory steps\n+ are carried out. The message attribute of the record is computed\n+ using msg % args. If the formatting string contains \"(asctime)\",\n+ formatTime() is called to format the event time. If there is\n+ exception information, it is formatted using formatException()\n+ and appended to the message.\n+ \"\"\"\n+ record.message = record.msg % record.args\n+ if string.find(self._fmt,\"(asctime)\") > 0:\n+ self.formatTime(record, self.datefmt)\n+ s = self._fmt % record.__dict__\n+ if record.exc_info:\n+ if s[-1] != \"\\n\":\n+ s = s + \"\\n\"\n+ s = s + self.formatException(record.exc_info)\n+ return s\n+\n+#\n+# The default formatter to use when no other is specified\n+#\n+_defaultFormatter = Formatter()\n+\n+class BufferingFormatter:\n+ \"\"\"\n+ A formatter suitable for formatting a number of records.\n+ \"\"\"\n+ def __init__(self, linefmt=None):\n+ \"\"\"\n+ Optionally specify a formatter which will be used to format each\n+ individual record.\n+ \"\"\"\n+ if linefmt:\n+ self.linefmt = linefmt\n+ else:\n+ self.linefmt = _defaultFormatter\n+\n+ def formatHeader(self, records):\n+ \"\"\"\n+ Return the header string for the specified records.\n+ \"\"\"\n+ return \"\"\n+\n+ def formatFooter(self, records):\n+ \"\"\"\n+ Return the footer string for the specified records.\n+ \"\"\"\n+ return \"\"\n+\n+ def format(self, records):\n+ \"\"\"\n+ Format the specified records and return the result as a string.\n+ \"\"\"\n+ rv = \"\"\n+ if len(records) > 0:\n+ rv = rv + self.formatHeader(records)\n+ for record in records:\n+ rv = rv + self.linefmt.format(record)\n+ rv = rv + self.formatFooter(records)\n+ return rv\n+\n+#---------------------------------------------------------------------------\n+# Filter classes and functions\n+#---------------------------------------------------------------------------\n+\n+class Filter:\n+ \"\"\"\n+ The base filter class. This class never filters anything, acting as\n+ a placeholder which defines the Filter interface. Loggers and Handlers\n+ can optionally use Filter instances to filter records as desired.\n+ \"\"\"\n+ def filter(self, record):\n+ \"\"\"\n+ Is the specified record to be logged? Returns a boolean value.\n+ \"\"\"\n+ return 1\n+\n+class Filterer:\n+ \"\"\"\n+ A base class for loggers and handlers which allows them to share\n+ common code.\n+ \"\"\"\n+ def __init__(self):\n+ self.filters = []\n+\n+ def addFilter(self, filter):\n+ \"\"\"\n+ Add the specified filter to this handler.\n+ \"\"\"\n+ if not (filter in self.filters):\n+ self.filters.append(filter)\n+\n+ def removeFilter(self, filter):\n+ \"\"\"\n+ Remove the specified filter from this handler.\n+ \"\"\"\n+ if filter in self.filters:\n+ self.filters.remove(filter)\n+\n+ def filter(self, record):\n+ \"\"\"\n+ Determine if a record is loggable by consulting all the filters. The\n+ default is to allow the record to be logged; any filter can veto this\n+ and the record is then dropped. Returns a boolean value.\n+ \"\"\"\n+ rv = 1\n+ for f in self.filters:\n+ if not f.filter(record):\n+ rv = 0\n+ break\n+ return rv\n+\n+#---------------------------------------------------------------------------\n+# Handler classes and functions\n+#---------------------------------------------------------------------------\n+\n+_handlers = {} #repository of handlers (for flushing when shutdown called)\n+\n+class Handler(Filterer):\n+ \"\"\"\n+ The base handler class. Acts as a placeholder which defines the Handler\n+ interface. Handlers can optionally use Formatter instances to format\n+ records as desired. By default, no formatter is specified; in this case,\n+ the 'raw' message as determined by record.message is logged.\n+ \"\"\"\n+ def __init__(self, level=0):\n+ \"\"\"\n+ Initializes the instance - basically setting the formatter to None\n+ and the filter list to empty.\n+ \"\"\"\n+ Filterer.__init__(self)\n+ self.level = level\n+ self.formatter = None\n+ _handlers[self] = 1\n+\n+ def setLevel(self, lvl):\n+ \"\"\"\n+ Set the logging level of this handler.\n+ \"\"\"\n+ self.level = lvl\n+\n+ def format(self, record):\n+ \"\"\"\n+ Do formatting for a record - if a formatter is set, use it.\n+ Otherwise, use the default formatter for the module.\n+ \"\"\"\n+ if self.formatter:\n+ fmt = self.formatter\n+ else:\n+ fmt = _defaultFormatter\n+ return fmt.format(record)\n+\n+ def emit(self, record):\n+ \"\"\"\n+ Do whatever it takes to actually log the specified logging record.\n+ This version is intended to be implemented by subclasses and so\n+ raises a NotImplementedError.\n+ \"\"\"\n+ raise NotImplementedError, 'emit must be implemented '\\\n+ 'by Handler subclasses'\n+\n+ def handle(self, record):\n+ \"\"\"\n+ Conditionally handle the specified logging record, depending on\n+ filters which may have been added to the handler.\n+ \"\"\"\n+ if self.filter(record):\n+ self.emit(record)\n+\n+ def setFormatter(self, fmt):\n+ \"\"\"\n+ Set the formatter for this handler.\n+ \"\"\"\n+ self.formatter = fmt\n+\n+ def flush(self):\n+ \"\"\"\n+ Ensure all logging output has been flushed. This version does\n+ nothing and is intended to be implemented by subclasses.\n+ \"\"\"\n+ pass\n+\n+ def close(self):\n+ \"\"\"\n+ Tidy up any resources used by the handler. This version does\n+ nothing and is intended to be implemented by subclasses.\n+ \"\"\"\n+ pass\n+\n+ def handleError(self):\n+ \"\"\"\n+ This method should be called from handlers when an exception is\n+ encountered during an emit() call. By default it does nothing,\n+ which means that exceptions get silently ignored. This is what is\n+ mostly wanted for a logging system - most users will not care\n+ about errors in the logging system, they are more interested in\n+ application errors. You could, however, replace this with a custom\n+ handler if you wish.\n+ \"\"\"\n+ #import traceback\n+ #ei = sys.exc_info()\n+ #traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)\n+ #del ei\n+ pass\n+\n+class StreamHandler(Handler):\n+ \"\"\"\n+ A handler class which writes logging records, appropriately formatted,\n+ to a stream. Note that this class does not close the stream, as\n+ sys.stdout or sys.stderr may be used.\n+ \"\"\"\n+ def __init__(self, strm=None):\n+ \"\"\"\n+ If strm is not specified, sys.stderr is used.\n+ \"\"\"\n+ Handler.__init__(self)\n+ if not strm:\n+ strm = sys.stderr\n+ self.stream = strm\n+ self.formatter = None\n+\n+ def flush(self):\n+ \"\"\"\n+ Flushes the stream.\n+ \"\"\"\n+ self.stream.flush()\n+\n+ def emit(self, record):\n+ \"\"\"\n+ If a formatter is specified, it is used to format the record.\n+ The record is then written to the stream with a trailing newline\n+ [N.B. this may be removed depending on feedback]. If exception\n+ information is present, it is formatted using\n+ traceback.print_exception and appended to the stream.\n+ \"\"\"\n+ try:\n+ msg = self.format(record)\n+ self.stream.write(\"%s\\n\" % msg)\n+ self.flush()\n+ except:\n+ self.handleError()\n+\n+class FileHandler(StreamHandler):\n+ \"\"\"\n+ A handler class which writes formatted logging records to disk files.\n+ \"\"\"\n+ def __init__(self, filename, mode=\"a+\"):\n+ \"\"\"\n+ Open the specified file and use it as the stream for logging.\n+ By default, the file grows indefinitely. You can call setRollover()\n+ to allow the file to rollover at a predetermined size.\n+ \"\"\"\n+ StreamHandler.__init__(self, open(filename, mode))\n+ self.max_size = 0\n+ self.backup_count = 0\n+ self.basefilename = filename\n+ self.backup_index = 0\n+ self.mode = mode\n+\n+ def setRollover(self, max_size, backup_count):\n+ \"\"\"\n+ Set the rollover parameters so that rollover occurs whenever the\n+ current log file is nearly max_size in length. If backup_count\n+ is >= 1, the system will successively create new files with the\n+ same pathname as the base file, but with extensions \".1\", \".2\"\n+ etc. appended to it. For example, with a backup_count of 5 and a\n+ base file name of \"app.log\", you would get \"app.log\", \"app.log.1\",\n+ \"app.log.2\", ... through to \"app.log.5\". When the last file reaches\n+ its size limit, the logging reverts to \"app.log\" which is truncated\n+ to zero length. If max_size is zero, rollover never occurs.\n+ \"\"\"\n+ self.max_size = max_size\n+ self.backup_count = backup_count\n+ if max_size > 0:\n+ self.mode = \"a+\"\n+\n+ def doRollover(self):\n+ \"\"\"\n+ Do a rollover, as described in setRollover().\n+ \"\"\"\n+ if self.backup_index >= self.backup_count:\n+ self.backup_index = 0\n+ fn = self.basefilename\n+ else:\n+ self.backup_index = self.backup_index + 1\n+ fn = \"%s.%d\" % (self.basefilename, self.backup_index)\n+ self.stream.close()\n+ self.stream = open(fn, \"w+\")\n+\n+ def emit(self, record):\n+ \"\"\"\n+ Output the record to the file, catering for rollover as described\n+ in setRollover().\n+ \"\"\"\n+ if self.max_size > 0: # are we rolling over?\n+ msg = \"%s\\n\" % self.format(record)\n+ if self.stream.tell() + len(msg) >= self.max_size:\n+ self.doRollover()\n+ StreamHandler.emit(self, record)\n+\n+ def close(self):\n+ \"\"\"\n+ Closes the stream.\n+ \"\"\"\n+ self.stream.close()\n+\n+class SocketHandler(StreamHandler):\n+ \"\"\"\n+ A handler class which writes logging records, in pickle format, to\n+ a streaming socket. The socket is kept open across logging calls.\n+ If the peer resets it, an attempt is made to reconnect on the next call.\n+ \"\"\"\n+\n+ def __init__(self, host, port):\n+ \"\"\"\n+ Initializes the handler with a specific host address and port.\n+ \"\"\"\n+ StreamHandler.__init__(self)\n+ self.host = host\n+ self.port = port\n+ self.sock = None\n+ self.closeOnError = 1\n+\n+ def makeSocket(self):\n+ \"\"\"\n+ A factory method which allows subclasses to define the precise\n+ type of socket they want.\n+ \"\"\"\n+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n+ s.connect((self.host, self.port))\n+ return s\n+\n+ def send(self, s):\n+ \"\"\"\n+ Send a pickled string to the socket. This function allows for\n+ partial sends which can happen when the network is busy.\n+ \"\"\"\n+ sentsofar = 0\n+ left = len(s)\n+ while left > 0:\n+ sent = self.sock.send(s[sentsofar:])\n+ sentsofar = sentsofar + sent\n+ left = left - sent\n+\n+ def makePickle(self, record):\n+ \"\"\"\n+ Pickle the record in binary format with a length prefix.\n+ \"\"\"\n+ s = cPickle.dumps(record.__dict__, 1)\n+ n = len(s)\n+ slen = \"%c%c\" % ((n >> 8) & 0xFF, n & 0xFF)\n+ return slen + s\n+\n+ def handleError(self):\n+ \"\"\"\n+ An error has occurred during logging. Most likely cause -\n+ connection lost. Close the socket so that we can retry on the\n+ next event.\n+ \"\"\"\n+ if self.closeOnError and self.sock:\n+ self.sock.close()\n+ self.sock = None #try to reconnect next time\n+\n+ def emit(self, record):\n+ \"\"\"\n+ Pickles the record and writes it to the socket in binary format.\n+ If there is an error with the socket, silently drop the packet.\n+ \"\"\"\n+ try:\n+ s = self.makePickle(record)\n+ if not self.sock:\n+ self.sock = self.makeSocket()\n+ self.send(s)\n+ except:\n+ self.handleError()\n+\n+ def close(self):\n+ \"\"\"\n+ Closes the socket.\n+ \"\"\"\n+ if self.sock:\n+ self.sock.close()\n+ self.sock = None\n+\n+class DatagramHandler(SocketHandler):\n+ \"\"\"\n+ A handler class which writes logging records, in pickle format, to\n+ a datagram socket.\n+ \"\"\"\n+ def __init__(self, host, port):\n+ \"\"\"\n+ Initializes the handler with a specific host address and port.\n+ \"\"\"\n+ SocketHandler.__init__(self, host, port)\n+ self.closeOnError = 0\n+\n+ def makeSocket(self):\n+ \"\"\"\n+ The factory method of SocketHandler is here overridden to create\n+ a UDP socket (SOCK_DGRAM).\n+ \"\"\"\n+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n+ return s\n+\n+ def sendto(self, s, addr):\n+ \"\"\"\n+ Send a pickled string to a socket. This function allows for\n+ partial sends which can happen when the network is busy.\n+ \"\"\"\n+ sentsofar = 0\n+ left = len(s)\n+ while left > 0:\n+ sent = self.sock.sendto(s[sentsofar:], addr)\n+ sentsofar = sentsofar + sent\n+ left = left - sent\n+\n+ def emit(self, record):\n+ \"\"\"\n+ Pickles the record and writes it to the socket in binary format.\n+ \"\"\"\n+ try:\n+ s = self.makePickle(record)\n+ if not self.sock:\n+ self.sock = self.makeSocket()\n+ self.sendto(s, (self.host, self.port))\n+ except:\n+ self.handleError()\n+\n+class SysLogHandler(Handler):\n+ \"\"\"\n+ A handler class which sends formatted logging records to a syslog\n+ server. Based on Sam Rushing's syslog module:\n+ http://www.nightmare.com/squirl/python-ext/misc/syslog.py\n+ Contributed by Nicolas Untz (after which minor refactoring changes\n+ have been made).\n+ \"\"\"\n+\n+ # from :\n+ # ======================================================================\n+ # priorities/facilities are encoded into a single 32-bit quantity, where\n+ # the bottom 3 bits are the priority (0-7) and the top 28 bits are the\n+ # facility (0-big number). Both the priorities and the facilities map\n+ # roughly one-to-one to strings in the syslogd(8) source code. This\n+ # mapping is included in this file.\n+ #\n+ # priorities (these are ordered)\n+\n+ LOG_EMERG = 0 # system is unusable\n+ LOG_ALERT = 1 # action must be taken immediately\n+ LOG_CRIT = 2 # critical conditions\n+ LOG_ERR = 3 # error conditions\n+ LOG_WARNING = 4 # warning conditions\n+ LOG_NOTICE = 5 # normal but significant condition\n+ LOG_INFO = 6 # informational\n+ LOG_DEBUG = 7 # debug-level messages\n+\n+ # facility codes\n+ LOG_KERN = 0 # kernel messages\n+ LOG_USER = 1 # random user-level messages\n+ LOG_MAIL = 2 # mail system\n+ LOG_DAEMON = 3 # system daemons\n+ LOG_AUTH = 4 # security/authorization messages\n+ LOG_SYSLOG = 5 # messages generated internally by syslogd\n+ LOG_LPR = 6 # line printer subsystem\n+ LOG_NEWS = 7 # network news subsystem\n+ LOG_UUCP = 8 # UUCP subsystem\n+ LOG_CRON = 9 # clock daemon\n+ LOG_AUTHPRIV = 10 # security/authorization messages (private)\n+\n+ # other codes through 15 reserved for system use\n+ LOG_LOCAL0 = 16 # reserved for local use\n+ LOG_LOCAL1 = 17 # reserved for local use\n+ LOG_LOCAL2 = 18 # reserved for local use\n+ LOG_LOCAL3 = 19 # reserved for local use\n+ LOG_LOCAL4 = 20 # reserved for local use\n+ LOG_LOCAL5 = 21 # reserved for local use\n+ LOG_LOCAL6 = 22 # reserved for local use\n+ LOG_LOCAL7 = 23 # reserved for local use\n+\n+ priority_names = {\n+ \"alert\": LOG_ALERT,\n+ \"crit\": LOG_CRIT,\n+ \"critical\": LOG_CRIT,\n+ \"debug\": LOG_DEBUG,\n+ \"emerg\": LOG_EMERG,\n+ \"err\": LOG_ERR,\n+ \"error\": LOG_ERR, # DEPRECATED\n+ \"info\": LOG_INFO,\n+ \"notice\": LOG_NOTICE,\n+ \"panic\": LOG_EMERG, # DEPRECATED\n+ \"warn\": LOG_WARNING, # DEPRECATED\n+ \"warning\": LOG_WARNING,\n+ }\n+\n+ facility_names = {\n+ \"auth\": LOG_AUTH,\n+ \"authpriv\": LOG_AUTHPRIV,\n+ \"cron\": LOG_CRON,\n+ \"daemon\": LOG_DAEMON,\n+ \"kern\": LOG_KERN,\n+ \"lpr\": LOG_LPR,\n+ \"mail\": LOG_MAIL,\n+ \"news\": LOG_NEWS,\n+ \"security\": LOG_AUTH, # DEPRECATED\n+ \"syslog\": LOG_SYSLOG,\n+ \"user\": LOG_USER,\n+ \"uucp\": LOG_UUCP,\n+ \"local0\": LOG_LOCAL0,\n+ \"local1\": LOG_LOCAL1,\n+ \"local2\": LOG_LOCAL2,\n+ \"local3\": LOG_LOCAL3,\n+ \"local4\": LOG_LOCAL4,\n+ \"local5\": LOG_LOCAL5,\n+ \"local6\": LOG_LOCAL6,\n+ \"local7\": LOG_LOCAL7,\n+ }\n+\n+ def __init__(self, address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER):\n+ \"\"\"\n+ If address is not specified, UNIX socket is used.\n+ If facility is not specified, LOG_USER is used.\n+ \"\"\"\n+ Handler.__init__(self)\n+\n+ self.address = address\n+ self.facility = facility\n+ if type(address) == types.StringType:\n+ self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\n+ self.socket.connect(address)\n+ self.unixsocket = 1\n+ else:\n+ self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n+ self.unixsocket = 0\n+\n+ self.formatter = None\n+\n+ # curious: when talking to the unix-domain '/dev/log' socket, a\n+ # zero-terminator seems to be required. this string is placed\n+ # into a class variable so that it can be overridden if\n+ # necessary.\n+ log_format_string = '<%d>%s\\000'\n+\n+ def encodePriority (self, facility, priority):\n+ \"\"\"\n+ Encode the facility and priority. You can pass in strings or\n+ integers - if strings are passed, the facility_names and\n+ priority_names mapping dictionaries are used to convert them to\n+ integers.\n+ \"\"\"\n+ if type(facility) == types.StringType:\n+ facility = self.facility_names[facility]\n+ if type(priority) == types.StringType:\n+ priority = self.priority_names[priority]\n+ return (facility << 3) | priority\n+\n+ def close (self):\n+ \"\"\"\n+ Closes the socket.\n+ \"\"\"\n+ if self.unixsocket:\n+ self.socket.close()\n+\n+ def emit(self, record):\n+ \"\"\"\n+ The record is formatted, and then sent to the syslog server. If\n+ exception information is present, it is NOT sent to the server.\n+ \"\"\"\n+ msg = self.format(record)\n+ \"\"\"\n+ We need to convert record level to lowercase, maybe this will\n+ change in the future.\n+ \"\"\"\n+ msg = self.log_format_string % (\n+ self.encodePriority(self.facility, string.lower(record.level)),\n+ msg)\n+ try:\n+ if self.unixsocket:\n+ self.socket.send(msg)\n+ else:\n+ self.socket.sendto(msg, self.address)\n+ except:\n+ self.handleError()\n+\n+class SMTPHandler(Handler):\n+ \"\"\"\n+ A handler class which sends an SMTP email for each logging event.\n+ \"\"\"\n+ def __init__(self, mailhost, fromaddr, toaddrs, subject):\n+ \"\"\"\n+ Initialize the instance with the from and to addresses and subject\n+ line of the email. To specify a non-standard SMTP port, use the\n+ (host, port) tuple format for the mailhost argument.\n+ \"\"\"\n+ Handler.__init__(self)\n+ if type(mailhost) == types.TupleType:\n+ host, port = mailhost\n+ self.mailhost = host\n+ self.mailport = port\n+ else:\n+ self.mailhost = mailhost\n+ self.mailport = None\n+ self.fromaddr = fromaddr\n+ self.toaddrs = toaddrs\n+ self.subject = subject\n+\n+ def getSubject(self, record):\n+ \"\"\"\n+ If you want to specify a subject line which is record-dependent,\n+ override this method.\n+ \"\"\"\n+ return self.subject\n+\n+ def emit(self, record):\n+ \"\"\"\n+ Format the record and send it to the specified addressees.\n+ \"\"\"\n+ try:\n+ import smtplib\n+ port = self.mailport\n+ if not port:\n+ port = smtplib.SMTP_PORT\n+ smtp = smtplib.SMTP(self.mailhost, port)\n+ msg = self.format(record)\n+ msg = \"From: %s\\r\\nTo: %s\\r\\nSubject: %s\\r\\n\\r\\n%s\" % (\n+ self.fromaddr,\n+ string.join(self.toaddrs, \",\"),\n+ self.getSubject(record), msg\n+ )\n+ smtp.sendmail(self.fromaddr, self.toaddrs, msg)\n+ smtp.quit()\n+ except:\n+ self.handleError()\n+\n+class BufferingHandler(Handler):\n+ \"\"\"\n+ A handler class which buffers logging records in memory. Whenever each\n+ record is added to the buffer, a check is made to see if the buffer should\n+ be flushed. If it should, then flush() is expected to do the needful.\n+ \"\"\"\n+ def __init__(self, capacity):\n+ \"\"\"\n+ Initialize the handler with the buffer size.\n+ \"\"\"\n+ Handler.__init__(self)\n+ self.capacity = capacity\n+ self.buffer = []\n+\n+ def shouldFlush(self, record):\n+ \"\"\"\n+ Returns true if the buffer is up to capacity. This method can be\n+ overridden to implement custom flushing strategies.\n+ \"\"\"\n+ return (len(self.buffer) >= self.capacity)\n+\n+ def emit(self, record):\n+ \"\"\"\n+ Append the record. If shouldFlush() tells us to, call flush() to process\n+ the buffer.\n+ \"\"\"\n+ self.buffer.append(record)\n+ if self.shouldFlush(record):\n+ self.flush()\n+\n+ def flush(self):\n+ \"\"\"\n+ Override to implement custom flushing behaviour. This version just zaps\n+ the buffer to empty.\n+ \"\"\"\n+ self.buffer = []\n+\n+class MemoryHandler(BufferingHandler):\n+ \"\"\"\n+ A handler class which buffers logging records in memory, periodically\n+ flushing them to a target handler. Flushing occurs whenever the buffer\n+ is full, or when an event of a certain severity or greater is seen.\n+ \"\"\"\n+ def __init__(self, capacity, flushLevel=ERROR, target=None):\n+ \"\"\"\n+ Initialize the handler with the buffer size, the level at which\n+ flushing should occur and an optional target. Note that without a\n+ target being set either here or via setTarget(), a MemoryHandler\n+ is no use to anyone!\n+ \"\"\"\n+ BufferingHandler.__init__(self, capacity)\n+ self.flushLevel = flushLevel\n+ self.target = target\n+\n+ def shouldFlush(self, record):\n+ \"\"\"\n+ Check for buffer full or a record at the flushLevel or higher.\n+ \"\"\"\n+ return (len(self.buffer) >= self.capacity) or \\\n+ (record.lvl >= self.flushLevel)\n+\n+ def setTarget(self, target):\n+ \"\"\"\n+ Set the target handler for this handler.\n+ \"\"\"\n+ self.target = target\n+\n+ def flush(self):\n+ \"\"\"\n+ For a MemoryHandler, flushing means just sending the buffered\n+ records to the target, if there is one. Override if you want\n+ different behaviour.\n+ \"\"\"\n+ if self.target:\n+ for record in self.buffer:\n+ self.target.handle(record)\n+ self.buffer = []\n+\n+class NTEventLogHandler(Handler):\n+ \"\"\"\n+ A handler class which sends events to the NT Event Log. Adds a\n+ registry entry for the specified application name. If no dllname is\n+ provided, win32service.pyd (which contains some basic message\n+ placeholders) is used. Note that use of these placeholders will make\n+ your event logs big, as the entire message source is held in the log.\n+ If you want slimmer logs, you have to pass in the name of your own DLL\n+ which contains the message definitions you want to use in the event log.\n+ \"\"\"\n+ def __init__(self, appname, dllname=None, logtype=\"Application\"):\n+ Handler.__init__(self)\n+ try:\n+ import win32evtlogutil, win32evtlog\n+ self.appname = appname\n+ self._welu = win32evtlogutil\n+ if not dllname:\n+ import os\n+ dllname = os.path.split(self._welu.__file__)\n+ dllname = os.path.split(dllname[0])\n+ dllname = os.path.join(dllname[0], r'win32service.pyd')\n+ self.dllname = dllname\n+ self.logtype = logtype\n+ self._welu.AddSourceToRegistry(appname, dllname, logtype)\n+ self.deftype = win32evtlog.EVENTLOG_ERROR_TYPE\n+ self.typemap = {\n+ DEBUG : win32evtlog.EVENTLOG_INFORMATION_TYPE,\n+ INFO : win32evtlog.EVENTLOG_INFORMATION_TYPE,\n+ WARN : win32evtlog.EVENTLOG_WARNING_TYPE,\n+ ERROR : win32evtlog.EVENTLOG_ERROR_TYPE,\n+ CRITICAL: win32evtlog.EVENTLOG_ERROR_TYPE,\n+ }\n+ except ImportError:\n+ print \"The Python Win32 extensions for NT (service, event \"\\\n+ \"logging) appear not to be available.\"\n+ self._welu = None\n+\n+ def getMessageID(self, record):\n+ \"\"\"\n+ Return the message ID for the event record. If you are using your\n+ own messages, you could do this by having the msg passed to the\n+ logger being an ID rather than a formatting string. Then, in here,\n+ you could use a dictionary lookup to get the message ID. This\n+ version returns 1, which is the base message ID in win32service.pyd.\n+ \"\"\"\n+ return 1\n+\n+ def getEventCategory(self, record):\n+ \"\"\"\n+ Return the event category for the record. Override this if you\n+ want to specify your own categories. This version returns 0.\n+ \"\"\"\n+ return 0\n+\n+ def getEventType(self, record):\n+ \"\"\"\n+ Return the event type for the record. Override this if you want\n+ to specify your own types. This version does a mapping using the\n+ handler's typemap attribute, which is set up in __init__() to a\n+ dictionary which contains mappings for DEBUG, INFO, WARN, ERROR\n+ and CRITICAL. If you are using your own levels you will either need\n+ to override this method or place a suitable dictionary in the\n+ handler's typemap attribute.\n+ \"\"\"\n+ return self.typemap.get(record.lvl, self.deftype)\n+\n+ def emit(self, record):\n+ \"\"\"\n+ Determine the message ID, event category and event type. Then\n+ log the message in the NT event log.\n+ \"\"\"\n+ if self._welu:\n+ try:\n+ id = self.getMessageID(record)\n+ cat = self.getEventCategory(record)\n+ type = self.getEventType(record)\n+ msg = self.format(record)\n+ self._welu.ReportEvent(self.appname, id, cat, type, [msg])\n+ except:\n+ self.handleError()\n+\n+ def close(self):\n+ \"\"\"\n+ You can remove the application name from the registry as a\n+ source of event log entries. However, if you do this, you will\n+ not be able to see the events as you intended in the Event Log\n+ Viewer - it needs to be able to access the registry to get the\n+ DLL name.\n+ \"\"\"\n+ #self._welu.RemoveSourceFromRegistry(self.appname, self.logtype)\n+ pass\n+\n+class HTTPHandler(Handler):\n+ \"\"\"\n+ A class which sends records to a Web server, using either GET or\n+ POST semantics.\n+ \"\"\"\n+ def __init__(self, host, url, method=\"GET\"):\n+ \"\"\"\n+ Initialize the instance with the host, the request URL, and the method\n+ (\"GET\" or \"POST\")\n+ \"\"\"\n+ Handler.__init__(self)\n+ method = string.upper(method)\n+ if method not in [\"GET\", \"POST\"]:\n+ raise ValueError, \"method must be GET or POST\"\n+ self.host = host\n+ self.url = url\n+ self.method = method\n+\n+ def emit(self, record):\n+ \"\"\"\n+ Send the record to the Web server as an URL-encoded dictionary\n+ \"\"\"\n+ try:\n+ import httplib, urllib\n+ h = httplib.HTTP(self.host)\n+ url = self.url\n+ data = urllib.urlencode(record.__dict__)\n+ if self.method == \"GET\":\n+ if (string.find(url, '?') >= 0):\n+ sep = '&'\n+ else:\n+ sep = '?'\n+ url = url + \"%c%s\" % (sep, data)\n+ h.putrequest(self.method, url)\n+ if self.method == \"POST\":\n+ h.putheader(\"Content-length\", str(len(data)))\n+ h.endheaders()\n+ if self.method == \"POST\":\n+ h.send(data)\n+ h.getreply() #can't do anything with the result\n+ except:\n+ self.handleError()\n+\n+SOAP_MESSAGE = \"\"\"\n+ \n+ \n+%s\n+ \n+ \n+\n+\"\"\"\n+\n+class SOAPHandler(Handler):\n+ \"\"\"\n+ A class which sends records to a SOAP server.\n+ \"\"\"\n+ def __init__(self, host, url):\n+ \"\"\"\n+ Initialize the instance with the host and the request URL\n+ \"\"\"\n+ Handler.__init__(self)\n+ self.host = host\n+ self.url = url\n+\n+ def emit(self, record):\n+ \"\"\"\n+ Send the record to the Web server as a SOAP message\n+ \"\"\"\n+ try:\n+ import httplib, urllib\n+ h = httplib.HTTP(self.host)\n+ h.putrequest(\"POST\", self.url)\n+ keys = record.__dict__.keys()\n+ keys.sort()\n+ args = \"\"\n+ for key in keys:\n+ v = record.__dict__[key]\n+ if type(v) == types.StringType:\n+ t = \"string\"\n+ elif (type(v) == types.IntType) or (type(v) == types.LongType):\n+ t = \"integer\"\n+ elif type(v) == types.FloatType:\n+ t = \"float\"\n+ else:\n+ t = \"string\"\n+ args = args + \"%12s%s\\n\" % (\"\",\n+ key, t, str(v), key)\n+ data = SOAP_MESSAGE % args[:-1]\n+ #print data\n+ h.putheader(\"Content-type\", \"text/plain; charset=\\\"utf-8\\\"\")\n+ h.putheader(\"Content-length\", str(len(data)))\n+ h.endheaders()\n+ h.send(data)\n+ r = h.getreply() #can't do anything with the result\n+ #print r\n+ f = h.getfile()\n+ #print f.read()\n+ f.close()\n+ except:\n+ self.handleError()\n+\n+#---------------------------------------------------------------------------\n+# Manager classes and functions\n+#---------------------------------------------------------------------------\n+\n+class PlaceHolder:\n+ \"\"\"\n+ PlaceHolder instances are used in the Manager logger hierarchy to take\n+ the place of nodes for which no loggers have been defined [FIXME add\n+ example].\n+ \"\"\"\n+ def __init__(self, alogger):\n+ \"\"\"\n+ Initialize with the specified logger being a child of this placeholder.\n+ \"\"\"\n+ self.loggers = [alogger]\n+\n+ def append(self, alogger):\n+ \"\"\"\n+ Add the specified logger as a child of this placeholder.\n+ \"\"\"\n+ if alogger not in self.loggers:\n+ self.loggers.append(alogger)\n+\n+#\n+# Determine which class to use when instantiating loggers.\n+#\n+_loggerClass = None\n+\n+def setLoggerClass(klass):\n+ \"\"\"\n+ Set the class to be used when instantiating a logger. The class should\n+ define __init__() such that only a name argument is required, and the\n+ __init__() should call Logger.__init__()\n+ \"\"\"\n+ if klass != Logger:\n+ if type(klass) != types.ClassType:\n+ raise TypeError, \"setLoggerClass is expecting a class\"\n+ if not (Logger in klass.__bases__):\n+ raise TypeError, \"logger not derived from logging.Logger: \" + \\\n+ klass.__name__\n+ global _loggerClass\n+ _loggerClass = klass\n+\n+class Manager:\n+ \"\"\"\n+ There is [under normal circumstances] just one Manager instance, which\n+ holds the hierarchy of loggers.\n+ \"\"\"\n+ def __init__(self, root):\n+ \"\"\"\n+ Initialize the manager with the root node of the logger hierarchy.\n+ \"\"\"\n+ self.root = root\n+ self.disable = 0\n+ self.emittedNoHandlerWarning = 0\n+ self.loggerDict = {}\n+\n+ def getLogger(self, name):\n+ \"\"\"\n+ Get a logger with the specified name, creating it if it doesn't\n+ yet exist. If a PlaceHolder existed for the specified name [i.e.\n+ the logger didn't exist but a child of it did], replace it with\n+ the created logger and fix up the parent/child references which\n+ pointed to the placeholder to now point to the logger.\n+ \"\"\"\n+ rv = None\n+ if self.loggerDict.has_key(name):\n+ rv = self.loggerDict[name]\n+ if isinstance(rv, PlaceHolder):\n+ ph = rv\n+ rv = _loggerClass(name)\n+ rv.manager = self\n+ self.loggerDict[name] = rv\n+ self._fixupChildren(ph, rv)\n+ self._fixupParents(rv)\n+ else:\n+ rv = _loggerClass(name)\n+ rv.manager = self\n+ self.loggerDict[name] = rv\n+ self._fixupParents(rv)\n+ return rv\n+\n+ def _fixupParents(self, alogger):\n+ \"\"\"\n+ Ensure that there are either loggers or placeholders all the way\n+ from the specified logger to the root of the logger hierarchy.\n+ \"\"\"\n+ name = alogger.name\n+ i = string.rfind(name, \".\")\n+ rv = None\n+ while (i > 0) and not rv:\n+ substr = name[:i]\n+ if not self.loggerDict.has_key(substr):\n+ self.loggerDict[name] = PlaceHolder(alogger)\n+ else:\n+ obj = self.loggerDict[substr]\n+ if isinstance(obj, Logger):\n+ rv = obj\n+ else:\n+ assert isinstance(obj, PlaceHolder)\n+ obj.append(alogger)\n+ i = string.rfind(name, \".\", 0, i - 1)\n+ if not rv:\n+ rv = self.root\n+ alogger.parent = rv\n+\n+ def _fixupChildren(self, ph, alogger):\n+ \"\"\"\n+ Ensure that children of the placeholder ph are connected to the\n+ specified logger.\n+ \"\"\"\n+ for c in ph.loggers:\n+ if string.find(c.parent.name, alogger.name) <> 0:\n+ alogger.parent = c.parent\n+ c.parent = alogger\n+\n+#---------------------------------------------------------------------------\n+# Logger classes and functions\n+#---------------------------------------------------------------------------\n+\n+class Logger(Filterer):\n+ \"\"\"\n+ Instances of the Logger class represent a single logging channel.\n+ \"\"\"\n+ def __init__(self, name, level=0):\n+ \"\"\"\n+ Initialize the logger with a name and an optional level.\n+ \"\"\"\n+ Filterer.__init__(self)\n+ self.name = name\n+ self.level = level\n+ self.parent = None\n+ self.propagate = 1\n+ self.handlers = []\n+\n+ def setLevel(self, lvl):\n+ \"\"\"\n+ Set the logging level of this logger.\n+ \"\"\"\n+ self.level = lvl\n+\n+# def getRoot(self):\n+# \"\"\"\n+# Get the root of the logger hierarchy.\n+# \"\"\"\n+# return Logger.root\n+\n+ def debug(self, msg, *args, **kwargs):\n+ \"\"\"\n+ Log 'msg % args' with severity 'DEBUG'. To pass exception information,\n+ use the keyword argument exc_info with a true value, e.g.\n+\n+ logger.debug(\"Houston, we have a %s\", \"thorny problem\", exc_info=1)\n+ \"\"\"\n+ if self.manager.disable >= DEBUG:\n+ return\n+ if DEBUG >= self.getEffectiveLevel():\n+ apply(self._log, (DEBUG, msg, args), kwargs)\n+\n+ def info(self, msg, *args, **kwargs):\n+ \"\"\"\n+ Log 'msg % args' with severity 'INFO'. To pass exception information,\n+ use the keyword argument exc_info with a true value, e.g.\n+\n+ logger.info(\"Houston, we have a %s\", \"interesting problem\", exc_info=1)\n+ \"\"\"\n+ if self.manager.disable >= INFO:\n+ return\n+ if INFO >= self.getEffectiveLevel():\n+ apply(self._log, (INFO, msg, args), kwargs)\n+\n+ def warn(self, msg, *args, **kwargs):\n+ \"\"\"\n+ Log 'msg % args' with severity 'WARN'. To pass exception information,\n+ use the keyword argument exc_info with a true value, e.g.\n+\n+ logger.warn(\"Houston, we have a %s\", \"bit of a problem\", exc_info=1)\n+ \"\"\"\n+ if self.manager.disable >= WARN:\n+ return\n+ if self.isEnabledFor(WARN):\n+ apply(self._log, (WARN, msg, args), kwargs)\n+\n+ def error(self, msg, *args, **kwargs):\n+ \"\"\"\n+ Log 'msg % args' with severity 'ERROR'. To pass exception information,\n+ use the keyword argument exc_info with a true value, e.g.\n+\n+ logger.error(\"Houston, we have a %s\", \"major problem\", exc_info=1)\n+ \"\"\"\n+ if self.manager.disable >= ERROR:\n+ return\n+ if self.isEnabledFor(ERROR):\n+ apply(self._log, (ERROR, msg, args), kwargs)\n+\n+ def exception(self, msg, *args):\n+ \"\"\"\n+ Convenience method for logging an ERROR with exception information\n+ \"\"\"\n+ apply(self.error, (msg,) + args, {'exc_info': 1})\n+\n+ def critical(self, msg, *args, **kwargs):\n+ \"\"\"\n+ Log 'msg % args' with severity 'CRITICAL'. To pass exception\n+ information, use the keyword argument exc_info with a true value, e.g.\n+\n+ logger.critical(\"Houston, we have a %s\", \"major disaster\", exc_info=1)\n+ \"\"\"\n+ if self.manager.disable >= CRITICAL:\n+ return\n+ if CRITICAL >= self.getEffectiveLevel():\n+ apply(self._log, (CRITICAL, msg, args), kwargs)\n+\n+ fatal = critical\n+\n+ def log(self, lvl, msg, *args, **kwargs):\n+ \"\"\"\n+ Log 'msg % args' with the severity 'lvl'. To pass exception\n+ information, use the keyword argument exc_info with a true value, e.g.\n+ logger.log(lvl, \"We have a %s\", \"mysterious problem\", exc_info=1)\n+ \"\"\"\n+ if self.manager.disable >= lvl:\n+ return\n+ if self.isEnabledFor(lvl):\n+ apply(self._log, (lvl, msg, args), kwargs)\n+\n+ def findCaller(self):\n+ \"\"\"\n+ Find the stack frame of the caller so that we can note the source\n+ file name and line number.\n+ \"\"\"\n+ frames = inspect.stack()[1:]\n+ for f in frames:\n+ if _srcfile != f[1]:\n+ return (f[1], f[2])\n+ return (None, None)\n+\n+ def makeRecord(self, name, lvl, fn, lno, msg, args, exc_info):\n+ \"\"\"\n+ A factory method which can be overridden in subclasses to create\n+ specialized LogRecords.\n+ \"\"\"\n+ return LogRecord(name, lvl, fn, lno, msg, args, exc_info)\n+\n+ def _log(self, lvl, msg, args, exc_info=None):\n+ \"\"\"\n+ Low-level logging routine which creates a LogRecord and then calls\n+ all the handlers of this logger to handle the record.\n+ \"\"\"\n+ if inspect:\n+ fn, lno = self.findCaller()\n+ else:\n+ fn, lno = \"\", 0\n+ if exc_info:\n+ exc_info = sys.exc_info()\n+ record = self.makeRecord(self.name, lvl, fn, lno, msg, args, exc_info)\n+ self.handle(record)\n+\n+ def handle(self, record):\n+ \"\"\"\n+ Call the handlers for the specified record. This method is used for\n+ unpickled records received from a socket, as well as those created\n+ locally. Logger-level filtering is applied.\n+ \"\"\"\n+ if self.filter(record):\n+ self.callHandlers(record)\n+\n+ def addHandler(self, hdlr):\n+ \"\"\"\n+ Add the specified handler to this logger.\n+ \"\"\"\n+ if not (hdlr in self.handlers):\n+ self.handlers.append(hdlr)\n+\n+ def removeHandler(self, hdlr):\n+ \"\"\"\n+ Remove the specified handler from this logger.\n+ \"\"\"\n+ if hdlr in self.handlers:\n+ self.handlers.remove(hdlr)\n+\n+ def callHandlers(self, record):\n+ \"\"\"\n+ Loop through all handlers for this logger and its parents in the\n+ logger hierarchy. If no handler was found, output a one-off error\n+ message. Stop searching up the hierarchy whenever a logger with the\n+ \"propagate\" attribute set to zero is found - that will be the last\n+ logger whose handlers are called.\n+ \"\"\"\n+ c = self\n+ found = 0\n+ while c:\n+ for hdlr in c.handlers:\n+ found = found + 1\n+ if record.lvl >= hdlr.level:\n+ hdlr.handle(record)\n+ if not c.propagate:\n+ c = None #break out\n+ else:\n+ c = c.parent\n+ if (found == 0) and not self.manager.emittedNoHandlerWarning:\n+ print \"No handlers could be found for logger \\\"%s\\\"\" % self.name\n+ self.manager.emittedNoHandlerWarning = 1\n+\n+ def getEffectiveLevel(self):\n+ \"\"\"\n+ Loop through this logger and its parents in the logger hierarchy,\n+ looking for a non-zero logging level. Return the first one found.\n+ \"\"\"\n+ c = self\n+ while c:\n+ if c.level:\n+ return c.level\n+ c = c.parent\n+ #print \"NCP\", self.parent\n+\n+ def isEnabledFor(self, lvl):\n+ \"\"\"\n+ Is this logger enabled for level lvl?\n+ \"\"\"\n+ if self.manager.disable >= lvl:\n+ return 0\n+ return lvl >= self.getEffectiveLevel()\n+\n+class RootLogger(Logger):\n+ \"\"\"\n+ A root logger is not that different to any other logger, except that\n+ it must have a logging level and there is only one instance of it in\n+ the hierarchy.\n+ \"\"\"\n+ def __init__(self, lvl):\n+ \"\"\"\n+ Initialize the logger with the name \"root\".\n+ \"\"\"\n+ Logger.__init__(self, \"root\", lvl)\n+\n+_loggerClass = Logger\n+\n+root = RootLogger(DEBUG)\n+Logger.root = root\n+Logger.manager = Manager(Logger.root)\n+\n+#---------------------------------------------------------------------------\n+# Configuration classes and functions\n+#---------------------------------------------------------------------------\n+\n+BASIC_FORMAT = \"%(asctime)s %(name)-19s %(level)-5s - %(message)s\"\n+\n+def basicConfig():\n+ \"\"\"\n+ Do basic configuration for the logging system by creating a\n+ StreamHandler with a default Formatter and adding it to the\n+ root logger.\n+ \"\"\"\n+ hdlr = StreamHandler()\n+ fmt = Formatter(BASIC_FORMAT)\n+ hdlr.setFormatter(fmt)\n+ root.addHandler(hdlr)\n+\n+#def fileConfig(fname):\n+# \"\"\"\n+# The old implementation - using dict-based configuration files.\n+# Read the logging configuration from a file. Keep it simple for now.\n+# \"\"\"\n+# file = open(fname, \"r\")\n+# data = file.read()\n+# file.close()\n+# dict = eval(data)\n+# handlers = dict.get(\"handlers\", [])\n+# loggers = dict.get(\"loggers\", [])\n+# formatters = dict.get(\"formatters\", [])\n+# for f in formatters:\n+# fd = dict[f]\n+# fc = fd.get(\"class\", \"logging.Formatter\")\n+# args = fd.get(\"args\", ())\n+# fc = eval(fc)\n+# try:\n+# fmt = apply(fc, args)\n+# except:\n+# print fc, args\n+# raise\n+# dict[f] = fmt\n+#\n+# for h in handlers:\n+# hd = dict[h]\n+# hc = hd.get(\"class\", \"logging.StreamHandler\")\n+# args = hd.get(\"args\", ())\n+# hc = eval(hc)\n+# fmt = hd.get(\"formatter\", None)\n+# if fmt:\n+# fmt = dict.get(fmt, None)\n+# try:\n+# hdlr = apply(hc, args)\n+# except:\n+# print hc, args\n+# raise\n+# if fmt:\n+# hdlr.setFormatter(fmt)\n+# dict[h] = hdlr\n+#\n+# for ln in loggers:\n+# ld = dict[ln]\n+# name = ld.get(\"name\", None)\n+# if name:\n+# logger = getLogger(name)\n+# else:\n+# logger = getRootLogger()\n+# logger.propagate = ld.get(\"propagate\", 1)\n+# hdlrs = ld.get(\"handlers\", [])\n+# for h in hdlrs:\n+# hdlr = dict.get(h, None)\n+# if hdlr:\n+# logger.addHandler(hdlr)\n+\n+def fileConfig(fname):\n+ \"\"\"\n+ Read the logging configuration from a ConfigParser-format file.\n+ \"\"\"\n+ import ConfigParser\n+\n+ cp = ConfigParser.ConfigParser()\n+ cp.read(fname)\n+ #first, do the formatters...\n+ flist = cp.get(\"formatters\", \"keys\")\n+ flist = string.split(flist, \",\")\n+ formatters = {}\n+ for form in flist:\n+ sectname = \"formatter_%s\" % form\n+ fs = cp.get(sectname, \"format\", 1)\n+ dfs = cp.get(sectname, \"datefmt\", 1)\n+ f = Formatter(fs, dfs)\n+ formatters[form] = f\n+ #next, do the handlers...\n+ hlist = cp.get(\"handlers\", \"keys\")\n+ hlist = string.split(hlist, \",\")\n+ handlers = {}\n+ for hand in hlist:\n+ sectname = \"handler_%s\" % hand\n+ klass = cp.get(sectname, \"class\")\n+ fmt = cp.get(sectname, \"formatter\")\n+ lvl = cp.get(sectname, \"level\")\n+ klass = eval(klass)\n+ args = cp.get(sectname, \"args\")\n+ args = eval(args)\n+ h = apply(klass, args)\n+ h.setLevel(eval(lvl))\n+ h.setFormatter(formatters[fmt])\n+ #temporary hack for FileHandler.\n+ if klass == FileHandler:\n+ maxsize = cp.get(sectname, \"maxsize\")\n+ if maxsize:\n+ maxsize = eval(maxsize)\n+ else:\n+ maxsize = 0\n+ if maxsize:\n+ backcount = cp.get(sectname, \"backcount\")\n+ if backcount:\n+ backcount = eval(backcount)\n+ else:\n+ backcount = 0\n+ h.setRollover(maxsize, backcount)\n+ handlers[hand] = h\n+ #at last, the loggers...first the root...\n+ llist = cp.get(\"loggers\", \"keys\")\n+ llist = string.split(llist, \",\")\n+ llist.remove(\"root\")\n+ sectname = \"logger_root\"\n+ log = root\n+ lvl = cp.get(sectname, \"level\")\n+ log.setLevel(eval(lvl))\n+ hlist = cp.get(sectname, \"handlers\")\n+ hlist = string.split(hlist, \",\")\n+ for hand in hlist:\n+ log.addHandler(handlers[hand])\n+ #and now the others...\n+ for log in llist:\n+ sectname = \"logger_%s\" % log\n+ qn = cp.get(sectname, \"qualname\")\n+ lvl = cp.get(sectname, \"level\")\n+ propagate = cp.get(sectname, \"propagate\")\n+ logger = getLogger(qn)\n+ logger.setLevel(eval(lvl))\n+ logger.propagate = eval(propagate)\n+ hlist = cp.get(sectname, \"handlers\")\n+ hlist = string.split(hlist, \",\")\n+ for hand in hlist:\n+ logger.addHandler(handlers[hand])\n+\n+\n+#---------------------------------------------------------------------------\n+# Utility functions at module level.\n+# Basically delegate everything to the root logger.\n+#---------------------------------------------------------------------------\n+\n+def getLogger(name):\n+ \"\"\"\n+ Return a logger with the specified name, creating it if necessary.\n+ If no name is specified, return the root logger.\n+ \"\"\"\n+ if name:\n+ return Logger.manager.getLogger(name)\n+ else:\n+ return root\n+\n+def getRootLogger():\n+ \"\"\"\n+ Return the root logger.\n+ \"\"\"\n+ return root\n+\n+def critical(msg, *args, **kwargs):\n+ \"\"\"\n+ Log a message with severity 'CRITICAL' on the root logger.\n+ \"\"\"\n+ if len(root.handlers) == 0:\n+ basicConfig()\n+ apply(root.critical, (msg,)+args, kwargs)\n+\n+fatal = critical\n+\n+def error(msg, *args, **kwargs):\n+ \"\"\"\n+ Log a message with severity 'ERROR' on the root logger.\n+ \"\"\"\n+ if len(root.handlers) == 0:\n+ basicConfig()\n+ apply(root.error, (msg,)+args, kwargs)\n+\n+def exception(msg, *args):\n+ \"\"\"\n+ Log a message with severity 'ERROR' on the root logger,\n+ with exception information.\n+ \"\"\"\n+ apply(error, (msg,)+args, {'exc_info': 1})\n+\n+def warn(msg, *args, **kwargs):\n+ \"\"\"\n+ Log a message with severity 'WARN' on the root logger.\n+ \"\"\"\n+ if len(root.handlers) == 0:\n+ basicConfig()\n+ apply(root.warn, (msg,)+args, kwargs)\n+\n+def info(msg, *args, **kwargs):\n+ \"\"\"\n+ Log a message with severity 'INFO' on the root logger.\n+ \"\"\"\n+ if len(root.handlers) == 0:\n+ basicConfig()\n+ apply(root.info, (msg,)+args, kwargs)\n+\n+def debug(msg, *args, **kwargs):\n+ \"\"\"\n+ Log a message with severity 'DEBUG' on the root logger.\n+ \"\"\"\n+ if len(root.handlers) == 0:\n+ basicConfig()\n+ apply(root.debug, (msg,)+args, kwargs)\n+\n+def disable(level):\n+ \"\"\"\n+ Disable all logging calls less severe than 'level'.\n+ \"\"\"\n+ root.manager.disable = level\n+\n+def shutdown():\n+ \"\"\"\n+ Perform any cleanup actions in the logging system (e.g. flushing\n+ buffers). Should be called at application exit.\n+ \"\"\"\n+ for h in _handlers.keys():\n+ h.flush()\n+ h.close()\n+\n+if __name__ == \"__main__\":\n+ print __doc__\n", + "added_lines": 1737, + "deleted_lines": 0, + "source_code": "#! /usr/bin/env python\n#\n# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.\n#\n# Permission to use, copy, modify, and distribute this software and its\n# documentation for any purpose and without fee is hereby granted,\n# provided that the above copyright notice appear in all copies and that\n# both that copyright notice and this permission notice appear in\n# supporting documentation, and that the name of Vinay Sajip\n# not be used in advertising or publicity pertaining to distribution\n# of the software without specific, written prior permission.\n# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\n# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL\n# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\n# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER\n# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT\n# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n#\n# For the change history, see README.txt in the distribution.\n#\n# This file is part of the Python logging distribution. See\n# http://www.red-dove.com/python_logging.html\n#\n\n\"\"\"\nLogging module for Python. Based on PEP 282 and comments thereto in\ncomp.lang.python, and influenced by Apache's log4j system.\n\nShould work under Python versions >= 1.5.2, except that source line\ninformation is not available unless 'inspect' is.\n\nCopyright (C) 2001-2002 Vinay Sajip. All Rights Reserved.\n\nTo use, simply 'import logging' and log away!\n\"\"\"\n\nimport sys, os, types, time, string, socket, cPickle, cStringIO\n\ntry:\n import thread\nexcept ImportError:\n thread = None\ntry:\n import inspect\nexcept ImportError:\n inspect = None\n\n__author__ = \"Vinay Sajip \"\n__status__ = \"alpha\"\n__version__ = \"0.4.1\"\n__date__ = \"03 April 2002\"\n\n#---------------------------------------------------------------------------\n# Module data\n#---------------------------------------------------------------------------\n\n#\n#_srcfile is used when walking the stack to check when we've got the first\n# caller stack frame.\n#If run as a script, __file__ is not bound.\n#\nif __name__ == \"__main__\":\n _srcFile = None\nelse:\n _srcfile = os.path.splitext(__file__)\n if _srcfile[1] in [\".pyc\", \".pyo\"]:\n _srcfile = _srcfile[0] + \".py\"\n else:\n _srcfile = __file__\n\n#\n#_start_time is used as the base when calculating the relative time of events\n#\n_start_time = time.time()\n\nDEFAULT_TCP_LOGGING_PORT = 9020\nDEFAULT_UDP_LOGGING_PORT = 9021\nDEFAULT_HTTP_LOGGING_PORT = 9022\nSYSLOG_UDP_PORT = 514\n\n#\n# Default levels and level names, these can be replaced with any positive set\n# of values having corresponding names. There is a pseudo-level, ALL, which\n# is only really there as a lower limit for user-defined levels. Handlers and\n# loggers are initialized with ALL so that they will log all messages, even\n# at user-defined levels.\n#\nCRITICAL = 50\nFATAL = CRITICAL\nERROR = 40\nWARN = 30\nINFO = 20\nDEBUG = 10\nALL = 0\n\n_levelNames = {\n CRITICAL : 'CRITICAL',\n ERROR : 'ERROR',\n WARN : 'WARN',\n INFO : 'INFO',\n DEBUG : 'DEBUG',\n ALL : 'ALL',\n}\n\ndef getLevelName(lvl):\n \"\"\"\n Return the textual representation of logging level 'lvl'. If the level is\n one of the predefined levels (CRITICAL, ERROR, WARN, INFO, DEBUG) then you\n get the corresponding string. If you have associated levels with names\n using addLevelName then the name you have associated with 'lvl' is\n returned. Otherwise, the string \"Level %s\" % lvl is returned.\n \"\"\"\n return _levelNames.get(lvl, (\"Level %s\" % lvl))\n\ndef addLevelName(lvl, levelName):\n \"\"\"\n Associate 'levelName' with 'lvl'. This is used when converting levels\n to text during message formatting.\n \"\"\"\n _levelNames[lvl] = levelName\n\n#---------------------------------------------------------------------------\n# The logging record\n#---------------------------------------------------------------------------\n\nclass LogRecord:\n \"\"\"\n LogRecord instances are created every time something is logged. They\n contain all the information pertinent to the event being logged. The\n main information passed in is in msg and args, which are combined\n using msg % args to create the message field of the record. The record\n also includes information such as when the record was created, the\n source line where the logging call was made, and any exception\n information to be logged.\n \"\"\"\n def __init__(self, name, lvl, pathname, lineno, msg, args, exc_info):\n \"\"\"\n Initialize a logging record with interesting information.\n \"\"\"\n ct = time.time()\n self.name = name\n self.msg = msg\n self.args = args\n self.level = getLevelName(lvl)\n self.lvl = lvl\n self.pathname = pathname\n try:\n self.filename = os.path.basename(pathname)\n except:\n self.filename = pathname\n self.exc_info = exc_info\n self.lineno = lineno\n self.created = ct\n self.msecs = (ct - long(ct)) * 1000\n self.relativeCreated = (self.created - _start_time) * 1000\n if thread:\n self.thread = thread.get_ident()\n else:\n self.thread = None\n\n def __str__(self):\n return ''%(self.name, self.lvl,\n self.pathname, self.lineno, self.msg)\n\n#---------------------------------------------------------------------------\n# Formatter classes and functions\n#---------------------------------------------------------------------------\n\nclass Formatter:\n \"\"\"\n Formatters need to know how a LogRecord is constructed. They are\n responsible for converting a LogRecord to (usually) a string which can\n be interpreted by either a human or an external system. The base Formatter\n allows a formatting string to be specified. If none is supplied, the\n default value of \"%s(message)\\\\n\" is used.\n\n The Formatter can be initialized with a format string which makes use of\n knowledge of the LogRecord attributes - e.g. the default value mentioned\n above makes use of the fact that the user's message and arguments are pre-\n formatted into a LogRecord's message attribute. Currently, the useful\n attributes in a LogRecord are described by:\n\n %(name)s Name of the logger (logging channel)\n %(lvl)s Numeric logging level for the message (DEBUG, INFO,\n WARN, ERROR, CRITICAL)\n %(level)s Text logging level for the message (\"DEBUG\", \"INFO\",\n \"WARN\", \"ERROR\", \"CRITICAL\")\n %(pathname)s Full pathname of the source file where the logging\n call was issued (if available)\n %(filename)s Filename portion of pathname\n %(lineno)d Source line number where the logging call was issued\n (if available)\n %(created)f Time when the LogRecord was created (time.time()\n return value)\n %(asctime)s textual time when the LogRecord was created\n %(msecs)d Millisecond portion of the creation time\n %(relativeCreated)d Time in milliseconds when the LogRecord was created,\n relative to the time the logging module was loaded\n (typically at application startup time)\n %(thread)d Thread ID (if available)\n %(message)s The result of msg % args, computed just as the\n record is emitted\n %(msg)s The raw formatting string provided by the user\n %(args)r The argument tuple which goes with the formatting\n string in the msg attribute\n \"\"\"\n def __init__(self, fmt=None, datefmt=None):\n \"\"\"\n Initialize the formatter either with the specified format string, or a\n default as described above. Allow for specialized date formatting with\n the optional datefmt argument (if omitted, you get the ISO8601 format).\n \"\"\"\n if fmt:\n self._fmt = fmt\n else:\n self._fmt = \"%(message)s\"\n self.datefmt = datefmt\n\n def formatTime(self, record, datefmt=None):\n \"\"\"\n This method should be called from format() by a formatter which\n wants to make use of a formatted time. This method can be overridden\n in formatters to provide for any specific requirement, but the\n basic behaviour is as follows: if datefmt (a string) is specfied,\n it is used with time.strftime to format the creation time of the\n record. Otherwise, the ISO8601 format is used. The resulting\n string is written to the asctime attribute of the record.\n \"\"\"\n ct = record.created\n if datefmt:\n s = time.strftime(datefmt, time.localtime(ct))\n else:\n t = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime(ct))\n s = \"%s,%03d\" % (t, record.msecs)\n record.asctime = s\n\n def formatException(self, ei):\n \"\"\"\n Format the specified exception information as a string. This\n default implementation just uses traceback.print_exception()\n \"\"\"\n import traceback\n sio = cStringIO.StringIO()\n traceback.print_exception(ei[0], ei[1], ei[2], None, sio)\n s = sio.getvalue()\n sio.close()\n return s\n\n def format(self, record):\n \"\"\"\n The record's attribute dictionary is used as the operand to a\n string formatting operation which yields the returned string.\n Before formatting the dictionary, a couple of preparatory steps\n are carried out. The message attribute of the record is computed\n using msg % args. If the formatting string contains \"(asctime)\",\n formatTime() is called to format the event time. If there is\n exception information, it is formatted using formatException()\n and appended to the message.\n \"\"\"\n record.message = record.msg % record.args\n if string.find(self._fmt,\"(asctime)\") > 0:\n self.formatTime(record, self.datefmt)\n s = self._fmt % record.__dict__\n if record.exc_info:\n if s[-1] != \"\\n\":\n s = s + \"\\n\"\n s = s + self.formatException(record.exc_info)\n return s\n\n#\n# The default formatter to use when no other is specified\n#\n_defaultFormatter = Formatter()\n\nclass BufferingFormatter:\n \"\"\"\n A formatter suitable for formatting a number of records.\n \"\"\"\n def __init__(self, linefmt=None):\n \"\"\"\n Optionally specify a formatter which will be used to format each\n individual record.\n \"\"\"\n if linefmt:\n self.linefmt = linefmt\n else:\n self.linefmt = _defaultFormatter\n\n def formatHeader(self, records):\n \"\"\"\n Return the header string for the specified records.\n \"\"\"\n return \"\"\n\n def formatFooter(self, records):\n \"\"\"\n Return the footer string for the specified records.\n \"\"\"\n return \"\"\n\n def format(self, records):\n \"\"\"\n Format the specified records and return the result as a string.\n \"\"\"\n rv = \"\"\n if len(records) > 0:\n rv = rv + self.formatHeader(records)\n for record in records:\n rv = rv + self.linefmt.format(record)\n rv = rv + self.formatFooter(records)\n return rv\n\n#---------------------------------------------------------------------------\n# Filter classes and functions\n#---------------------------------------------------------------------------\n\nclass Filter:\n \"\"\"\n The base filter class. This class never filters anything, acting as\n a placeholder which defines the Filter interface. Loggers and Handlers\n can optionally use Filter instances to filter records as desired.\n \"\"\"\n def filter(self, record):\n \"\"\"\n Is the specified record to be logged? Returns a boolean value.\n \"\"\"\n return 1\n\nclass Filterer:\n \"\"\"\n A base class for loggers and handlers which allows them to share\n common code.\n \"\"\"\n def __init__(self):\n self.filters = []\n\n def addFilter(self, filter):\n \"\"\"\n Add the specified filter to this handler.\n \"\"\"\n if not (filter in self.filters):\n self.filters.append(filter)\n\n def removeFilter(self, filter):\n \"\"\"\n Remove the specified filter from this handler.\n \"\"\"\n if filter in self.filters:\n self.filters.remove(filter)\n\n def filter(self, record):\n \"\"\"\n Determine if a record is loggable by consulting all the filters. The\n default is to allow the record to be logged; any filter can veto this\n and the record is then dropped. Returns a boolean value.\n \"\"\"\n rv = 1\n for f in self.filters:\n if not f.filter(record):\n rv = 0\n break\n return rv\n\n#---------------------------------------------------------------------------\n# Handler classes and functions\n#---------------------------------------------------------------------------\n\n_handlers = {} #repository of handlers (for flushing when shutdown called)\n\nclass Handler(Filterer):\n \"\"\"\n The base handler class. Acts as a placeholder which defines the Handler\n interface. Handlers can optionally use Formatter instances to format\n records as desired. By default, no formatter is specified; in this case,\n the 'raw' message as determined by record.message is logged.\n \"\"\"\n def __init__(self, level=0):\n \"\"\"\n Initializes the instance - basically setting the formatter to None\n and the filter list to empty.\n \"\"\"\n Filterer.__init__(self)\n self.level = level\n self.formatter = None\n _handlers[self] = 1\n\n def setLevel(self, lvl):\n \"\"\"\n Set the logging level of this handler.\n \"\"\"\n self.level = lvl\n\n def format(self, record):\n \"\"\"\n Do formatting for a record - if a formatter is set, use it.\n Otherwise, use the default formatter for the module.\n \"\"\"\n if self.formatter:\n fmt = self.formatter\n else:\n fmt = _defaultFormatter\n return fmt.format(record)\n\n def emit(self, record):\n \"\"\"\n Do whatever it takes to actually log the specified logging record.\n This version is intended to be implemented by subclasses and so\n raises a NotImplementedError.\n \"\"\"\n raise NotImplementedError, 'emit must be implemented '\\\n 'by Handler subclasses'\n\n def handle(self, record):\n \"\"\"\n Conditionally handle the specified logging record, depending on\n filters which may have been added to the handler.\n \"\"\"\n if self.filter(record):\n self.emit(record)\n\n def setFormatter(self, fmt):\n \"\"\"\n Set the formatter for this handler.\n \"\"\"\n self.formatter = fmt\n\n def flush(self):\n \"\"\"\n Ensure all logging output has been flushed. This version does\n nothing and is intended to be implemented by subclasses.\n \"\"\"\n pass\n\n def close(self):\n \"\"\"\n Tidy up any resources used by the handler. This version does\n nothing and is intended to be implemented by subclasses.\n \"\"\"\n pass\n\n def handleError(self):\n \"\"\"\n This method should be called from handlers when an exception is\n encountered during an emit() call. By default it does nothing,\n which means that exceptions get silently ignored. This is what is\n mostly wanted for a logging system - most users will not care\n about errors in the logging system, they are more interested in\n application errors. You could, however, replace this with a custom\n handler if you wish.\n \"\"\"\n #import traceback\n #ei = sys.exc_info()\n #traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)\n #del ei\n pass\n\nclass StreamHandler(Handler):\n \"\"\"\n A handler class which writes logging records, appropriately formatted,\n to a stream. Note that this class does not close the stream, as\n sys.stdout or sys.stderr may be used.\n \"\"\"\n def __init__(self, strm=None):\n \"\"\"\n If strm is not specified, sys.stderr is used.\n \"\"\"\n Handler.__init__(self)\n if not strm:\n strm = sys.stderr\n self.stream = strm\n self.formatter = None\n\n def flush(self):\n \"\"\"\n Flushes the stream.\n \"\"\"\n self.stream.flush()\n\n def emit(self, record):\n \"\"\"\n If a formatter is specified, it is used to format the record.\n The record is then written to the stream with a trailing newline\n [N.B. this may be removed depending on feedback]. If exception\n information is present, it is formatted using\n traceback.print_exception and appended to the stream.\n \"\"\"\n try:\n msg = self.format(record)\n self.stream.write(\"%s\\n\" % msg)\n self.flush()\n except:\n self.handleError()\n\nclass FileHandler(StreamHandler):\n \"\"\"\n A handler class which writes formatted logging records to disk files.\n \"\"\"\n def __init__(self, filename, mode=\"a+\"):\n \"\"\"\n Open the specified file and use it as the stream for logging.\n By default, the file grows indefinitely. You can call setRollover()\n to allow the file to rollover at a predetermined size.\n \"\"\"\n StreamHandler.__init__(self, open(filename, mode))\n self.max_size = 0\n self.backup_count = 0\n self.basefilename = filename\n self.backup_index = 0\n self.mode = mode\n\n def setRollover(self, max_size, backup_count):\n \"\"\"\n Set the rollover parameters so that rollover occurs whenever the\n current log file is nearly max_size in length. If backup_count\n is >= 1, the system will successively create new files with the\n same pathname as the base file, but with extensions \".1\", \".2\"\n etc. appended to it. For example, with a backup_count of 5 and a\n base file name of \"app.log\", you would get \"app.log\", \"app.log.1\",\n \"app.log.2\", ... through to \"app.log.5\". When the last file reaches\n its size limit, the logging reverts to \"app.log\" which is truncated\n to zero length. If max_size is zero, rollover never occurs.\n \"\"\"\n self.max_size = max_size\n self.backup_count = backup_count\n if max_size > 0:\n self.mode = \"a+\"\n\n def doRollover(self):\n \"\"\"\n Do a rollover, as described in setRollover().\n \"\"\"\n if self.backup_index >= self.backup_count:\n self.backup_index = 0\n fn = self.basefilename\n else:\n self.backup_index = self.backup_index + 1\n fn = \"%s.%d\" % (self.basefilename, self.backup_index)\n self.stream.close()\n self.stream = open(fn, \"w+\")\n\n def emit(self, record):\n \"\"\"\n Output the record to the file, catering for rollover as described\n in setRollover().\n \"\"\"\n if self.max_size > 0: # are we rolling over?\n msg = \"%s\\n\" % self.format(record)\n if self.stream.tell() + len(msg) >= self.max_size:\n self.doRollover()\n StreamHandler.emit(self, record)\n\n def close(self):\n \"\"\"\n Closes the stream.\n \"\"\"\n self.stream.close()\n\nclass SocketHandler(StreamHandler):\n \"\"\"\n A handler class which writes logging records, in pickle format, to\n a streaming socket. The socket is kept open across logging calls.\n If the peer resets it, an attempt is made to reconnect on the next call.\n \"\"\"\n\n def __init__(self, host, port):\n \"\"\"\n Initializes the handler with a specific host address and port.\n \"\"\"\n StreamHandler.__init__(self)\n self.host = host\n self.port = port\n self.sock = None\n self.closeOnError = 1\n\n def makeSocket(self):\n \"\"\"\n A factory method which allows subclasses to define the precise\n type of socket they want.\n \"\"\"\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n s.connect((self.host, self.port))\n return s\n\n def send(self, s):\n \"\"\"\n Send a pickled string to the socket. This function allows for\n partial sends which can happen when the network is busy.\n \"\"\"\n sentsofar = 0\n left = len(s)\n while left > 0:\n sent = self.sock.send(s[sentsofar:])\n sentsofar = sentsofar + sent\n left = left - sent\n\n def makePickle(self, record):\n \"\"\"\n Pickle the record in binary format with a length prefix.\n \"\"\"\n s = cPickle.dumps(record.__dict__, 1)\n n = len(s)\n slen = \"%c%c\" % ((n >> 8) & 0xFF, n & 0xFF)\n return slen + s\n\n def handleError(self):\n \"\"\"\n An error has occurred during logging. Most likely cause -\n connection lost. Close the socket so that we can retry on the\n next event.\n \"\"\"\n if self.closeOnError and self.sock:\n self.sock.close()\n self.sock = None #try to reconnect next time\n\n def emit(self, record):\n \"\"\"\n Pickles the record and writes it to the socket in binary format.\n If there is an error with the socket, silently drop the packet.\n \"\"\"\n try:\n s = self.makePickle(record)\n if not self.sock:\n self.sock = self.makeSocket()\n self.send(s)\n except:\n self.handleError()\n\n def close(self):\n \"\"\"\n Closes the socket.\n \"\"\"\n if self.sock:\n self.sock.close()\n self.sock = None\n\nclass DatagramHandler(SocketHandler):\n \"\"\"\n A handler class which writes logging records, in pickle format, to\n a datagram socket.\n \"\"\"\n def __init__(self, host, port):\n \"\"\"\n Initializes the handler with a specific host address and port.\n \"\"\"\n SocketHandler.__init__(self, host, port)\n self.closeOnError = 0\n\n def makeSocket(self):\n \"\"\"\n The factory method of SocketHandler is here overridden to create\n a UDP socket (SOCK_DGRAM).\n \"\"\"\n s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n return s\n\n def sendto(self, s, addr):\n \"\"\"\n Send a pickled string to a socket. This function allows for\n partial sends which can happen when the network is busy.\n \"\"\"\n sentsofar = 0\n left = len(s)\n while left > 0:\n sent = self.sock.sendto(s[sentsofar:], addr)\n sentsofar = sentsofar + sent\n left = left - sent\n\n def emit(self, record):\n \"\"\"\n Pickles the record and writes it to the socket in binary format.\n \"\"\"\n try:\n s = self.makePickle(record)\n if not self.sock:\n self.sock = self.makeSocket()\n self.sendto(s, (self.host, self.port))\n except:\n self.handleError()\n\nclass SysLogHandler(Handler):\n \"\"\"\n A handler class which sends formatted logging records to a syslog\n server. Based on Sam Rushing's syslog module:\n http://www.nightmare.com/squirl/python-ext/misc/syslog.py\n Contributed by Nicolas Untz (after which minor refactoring changes\n have been made).\n \"\"\"\n\n # from :\n # ======================================================================\n # priorities/facilities are encoded into a single 32-bit quantity, where\n # the bottom 3 bits are the priority (0-7) and the top 28 bits are the\n # facility (0-big number). Both the priorities and the facilities map\n # roughly one-to-one to strings in the syslogd(8) source code. This\n # mapping is included in this file.\n #\n # priorities (these are ordered)\n\n LOG_EMERG = 0 # system is unusable\n LOG_ALERT = 1 # action must be taken immediately\n LOG_CRIT = 2 # critical conditions\n LOG_ERR = 3 # error conditions\n LOG_WARNING = 4 # warning conditions\n LOG_NOTICE = 5 # normal but significant condition\n LOG_INFO = 6 # informational\n LOG_DEBUG = 7 # debug-level messages\n\n # facility codes\n LOG_KERN = 0 # kernel messages\n LOG_USER = 1 # random user-level messages\n LOG_MAIL = 2 # mail system\n LOG_DAEMON = 3 # system daemons\n LOG_AUTH = 4 # security/authorization messages\n LOG_SYSLOG = 5 # messages generated internally by syslogd\n LOG_LPR = 6 # line printer subsystem\n LOG_NEWS = 7 # network news subsystem\n LOG_UUCP = 8 # UUCP subsystem\n LOG_CRON = 9 # clock daemon\n LOG_AUTHPRIV = 10 # security/authorization messages (private)\n\n # other codes through 15 reserved for system use\n LOG_LOCAL0 = 16 # reserved for local use\n LOG_LOCAL1 = 17 # reserved for local use\n LOG_LOCAL2 = 18 # reserved for local use\n LOG_LOCAL3 = 19 # reserved for local use\n LOG_LOCAL4 = 20 # reserved for local use\n LOG_LOCAL5 = 21 # reserved for local use\n LOG_LOCAL6 = 22 # reserved for local use\n LOG_LOCAL7 = 23 # reserved for local use\n\n priority_names = {\n \"alert\": LOG_ALERT,\n \"crit\": LOG_CRIT,\n \"critical\": LOG_CRIT,\n \"debug\": LOG_DEBUG,\n \"emerg\": LOG_EMERG,\n \"err\": LOG_ERR,\n \"error\": LOG_ERR, # DEPRECATED\n \"info\": LOG_INFO,\n \"notice\": LOG_NOTICE,\n \"panic\": LOG_EMERG, # DEPRECATED\n \"warn\": LOG_WARNING, # DEPRECATED\n \"warning\": LOG_WARNING,\n }\n\n facility_names = {\n \"auth\": LOG_AUTH,\n \"authpriv\": LOG_AUTHPRIV,\n \"cron\": LOG_CRON,\n \"daemon\": LOG_DAEMON,\n \"kern\": LOG_KERN,\n \"lpr\": LOG_LPR,\n \"mail\": LOG_MAIL,\n \"news\": LOG_NEWS,\n \"security\": LOG_AUTH, # DEPRECATED\n \"syslog\": LOG_SYSLOG,\n \"user\": LOG_USER,\n \"uucp\": LOG_UUCP,\n \"local0\": LOG_LOCAL0,\n \"local1\": LOG_LOCAL1,\n \"local2\": LOG_LOCAL2,\n \"local3\": LOG_LOCAL3,\n \"local4\": LOG_LOCAL4,\n \"local5\": LOG_LOCAL5,\n \"local6\": LOG_LOCAL6,\n \"local7\": LOG_LOCAL7,\n }\n\n def __init__(self, address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER):\n \"\"\"\n If address is not specified, UNIX socket is used.\n If facility is not specified, LOG_USER is used.\n \"\"\"\n Handler.__init__(self)\n\n self.address = address\n self.facility = facility\n if type(address) == types.StringType:\n self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\n self.socket.connect(address)\n self.unixsocket = 1\n else:\n self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n self.unixsocket = 0\n\n self.formatter = None\n\n # curious: when talking to the unix-domain '/dev/log' socket, a\n # zero-terminator seems to be required. this string is placed\n # into a class variable so that it can be overridden if\n # necessary.\n log_format_string = '<%d>%s\\000'\n\n def encodePriority (self, facility, priority):\n \"\"\"\n Encode the facility and priority. You can pass in strings or\n integers - if strings are passed, the facility_names and\n priority_names mapping dictionaries are used to convert them to\n integers.\n \"\"\"\n if type(facility) == types.StringType:\n facility = self.facility_names[facility]\n if type(priority) == types.StringType:\n priority = self.priority_names[priority]\n return (facility << 3) | priority\n\n def close (self):\n \"\"\"\n Closes the socket.\n \"\"\"\n if self.unixsocket:\n self.socket.close()\n\n def emit(self, record):\n \"\"\"\n The record is formatted, and then sent to the syslog server. If\n exception information is present, it is NOT sent to the server.\n \"\"\"\n msg = self.format(record)\n \"\"\"\n We need to convert record level to lowercase, maybe this will\n change in the future.\n \"\"\"\n msg = self.log_format_string % (\n self.encodePriority(self.facility, string.lower(record.level)),\n msg)\n try:\n if self.unixsocket:\n self.socket.send(msg)\n else:\n self.socket.sendto(msg, self.address)\n except:\n self.handleError()\n\nclass SMTPHandler(Handler):\n \"\"\"\n A handler class which sends an SMTP email for each logging event.\n \"\"\"\n def __init__(self, mailhost, fromaddr, toaddrs, subject):\n \"\"\"\n Initialize the instance with the from and to addresses and subject\n line of the email. To specify a non-standard SMTP port, use the\n (host, port) tuple format for the mailhost argument.\n \"\"\"\n Handler.__init__(self)\n if type(mailhost) == types.TupleType:\n host, port = mailhost\n self.mailhost = host\n self.mailport = port\n else:\n self.mailhost = mailhost\n self.mailport = None\n self.fromaddr = fromaddr\n self.toaddrs = toaddrs\n self.subject = subject\n\n def getSubject(self, record):\n \"\"\"\n If you want to specify a subject line which is record-dependent,\n override this method.\n \"\"\"\n return self.subject\n\n def emit(self, record):\n \"\"\"\n Format the record and send it to the specified addressees.\n \"\"\"\n try:\n import smtplib\n port = self.mailport\n if not port:\n port = smtplib.SMTP_PORT\n smtp = smtplib.SMTP(self.mailhost, port)\n msg = self.format(record)\n msg = \"From: %s\\r\\nTo: %s\\r\\nSubject: %s\\r\\n\\r\\n%s\" % (\n self.fromaddr,\n string.join(self.toaddrs, \",\"),\n self.getSubject(record), msg\n )\n smtp.sendmail(self.fromaddr, self.toaddrs, msg)\n smtp.quit()\n except:\n self.handleError()\n\nclass BufferingHandler(Handler):\n \"\"\"\n A handler class which buffers logging records in memory. Whenever each\n record is added to the buffer, a check is made to see if the buffer should\n be flushed. If it should, then flush() is expected to do the needful.\n \"\"\"\n def __init__(self, capacity):\n \"\"\"\n Initialize the handler with the buffer size.\n \"\"\"\n Handler.__init__(self)\n self.capacity = capacity\n self.buffer = []\n\n def shouldFlush(self, record):\n \"\"\"\n Returns true if the buffer is up to capacity. This method can be\n overridden to implement custom flushing strategies.\n \"\"\"\n return (len(self.buffer) >= self.capacity)\n\n def emit(self, record):\n \"\"\"\n Append the record. If shouldFlush() tells us to, call flush() to process\n the buffer.\n \"\"\"\n self.buffer.append(record)\n if self.shouldFlush(record):\n self.flush()\n\n def flush(self):\n \"\"\"\n Override to implement custom flushing behaviour. This version just zaps\n the buffer to empty.\n \"\"\"\n self.buffer = []\n\nclass MemoryHandler(BufferingHandler):\n \"\"\"\n A handler class which buffers logging records in memory, periodically\n flushing them to a target handler. Flushing occurs whenever the buffer\n is full, or when an event of a certain severity or greater is seen.\n \"\"\"\n def __init__(self, capacity, flushLevel=ERROR, target=None):\n \"\"\"\n Initialize the handler with the buffer size, the level at which\n flushing should occur and an optional target. Note that without a\n target being set either here or via setTarget(), a MemoryHandler\n is no use to anyone!\n \"\"\"\n BufferingHandler.__init__(self, capacity)\n self.flushLevel = flushLevel\n self.target = target\n\n def shouldFlush(self, record):\n \"\"\"\n Check for buffer full or a record at the flushLevel or higher.\n \"\"\"\n return (len(self.buffer) >= self.capacity) or \\\n (record.lvl >= self.flushLevel)\n\n def setTarget(self, target):\n \"\"\"\n Set the target handler for this handler.\n \"\"\"\n self.target = target\n\n def flush(self):\n \"\"\"\n For a MemoryHandler, flushing means just sending the buffered\n records to the target, if there is one. Override if you want\n different behaviour.\n \"\"\"\n if self.target:\n for record in self.buffer:\n self.target.handle(record)\n self.buffer = []\n\nclass NTEventLogHandler(Handler):\n \"\"\"\n A handler class which sends events to the NT Event Log. Adds a\n registry entry for the specified application name. If no dllname is\n provided, win32service.pyd (which contains some basic message\n placeholders) is used. Note that use of these placeholders will make\n your event logs big, as the entire message source is held in the log.\n If you want slimmer logs, you have to pass in the name of your own DLL\n which contains the message definitions you want to use in the event log.\n \"\"\"\n def __init__(self, appname, dllname=None, logtype=\"Application\"):\n Handler.__init__(self)\n try:\n import win32evtlogutil, win32evtlog\n self.appname = appname\n self._welu = win32evtlogutil\n if not dllname:\n import os\n dllname = os.path.split(self._welu.__file__)\n dllname = os.path.split(dllname[0])\n dllname = os.path.join(dllname[0], r'win32service.pyd')\n self.dllname = dllname\n self.logtype = logtype\n self._welu.AddSourceToRegistry(appname, dllname, logtype)\n self.deftype = win32evtlog.EVENTLOG_ERROR_TYPE\n self.typemap = {\n DEBUG : win32evtlog.EVENTLOG_INFORMATION_TYPE,\n INFO : win32evtlog.EVENTLOG_INFORMATION_TYPE,\n WARN : win32evtlog.EVENTLOG_WARNING_TYPE,\n ERROR : win32evtlog.EVENTLOG_ERROR_TYPE,\n CRITICAL: win32evtlog.EVENTLOG_ERROR_TYPE,\n }\n except ImportError:\n print \"The Python Win32 extensions for NT (service, event \"\\\n \"logging) appear not to be available.\"\n self._welu = None\n\n def getMessageID(self, record):\n \"\"\"\n Return the message ID for the event record. If you are using your\n own messages, you could do this by having the msg passed to the\n logger being an ID rather than a formatting string. Then, in here,\n you could use a dictionary lookup to get the message ID. This\n version returns 1, which is the base message ID in win32service.pyd.\n \"\"\"\n return 1\n\n def getEventCategory(self, record):\n \"\"\"\n Return the event category for the record. Override this if you\n want to specify your own categories. This version returns 0.\n \"\"\"\n return 0\n\n def getEventType(self, record):\n \"\"\"\n Return the event type for the record. Override this if you want\n to specify your own types. This version does a mapping using the\n handler's typemap attribute, which is set up in __init__() to a\n dictionary which contains mappings for DEBUG, INFO, WARN, ERROR\n and CRITICAL. If you are using your own levels you will either need\n to override this method or place a suitable dictionary in the\n handler's typemap attribute.\n \"\"\"\n return self.typemap.get(record.lvl, self.deftype)\n\n def emit(self, record):\n \"\"\"\n Determine the message ID, event category and event type. Then\n log the message in the NT event log.\n \"\"\"\n if self._welu:\n try:\n id = self.getMessageID(record)\n cat = self.getEventCategory(record)\n type = self.getEventType(record)\n msg = self.format(record)\n self._welu.ReportEvent(self.appname, id, cat, type, [msg])\n except:\n self.handleError()\n\n def close(self):\n \"\"\"\n You can remove the application name from the registry as a\n source of event log entries. However, if you do this, you will\n not be able to see the events as you intended in the Event Log\n Viewer - it needs to be able to access the registry to get the\n DLL name.\n \"\"\"\n #self._welu.RemoveSourceFromRegistry(self.appname, self.logtype)\n pass\n\nclass HTTPHandler(Handler):\n \"\"\"\n A class which sends records to a Web server, using either GET or\n POST semantics.\n \"\"\"\n def __init__(self, host, url, method=\"GET\"):\n \"\"\"\n Initialize the instance with the host, the request URL, and the method\n (\"GET\" or \"POST\")\n \"\"\"\n Handler.__init__(self)\n method = string.upper(method)\n if method not in [\"GET\", \"POST\"]:\n raise ValueError, \"method must be GET or POST\"\n self.host = host\n self.url = url\n self.method = method\n\n def emit(self, record):\n \"\"\"\n Send the record to the Web server as an URL-encoded dictionary\n \"\"\"\n try:\n import httplib, urllib\n h = httplib.HTTP(self.host)\n url = self.url\n data = urllib.urlencode(record.__dict__)\n if self.method == \"GET\":\n if (string.find(url, '?') >= 0):\n sep = '&'\n else:\n sep = '?'\n url = url + \"%c%s\" % (sep, data)\n h.putrequest(self.method, url)\n if self.method == \"POST\":\n h.putheader(\"Content-length\", str(len(data)))\n h.endheaders()\n if self.method == \"POST\":\n h.send(data)\n h.getreply() #can't do anything with the result\n except:\n self.handleError()\n\nSOAP_MESSAGE = \"\"\"\n \n \n%s\n \n \n\n\"\"\"\n\nclass SOAPHandler(Handler):\n \"\"\"\n A class which sends records to a SOAP server.\n \"\"\"\n def __init__(self, host, url):\n \"\"\"\n Initialize the instance with the host and the request URL\n \"\"\"\n Handler.__init__(self)\n self.host = host\n self.url = url\n\n def emit(self, record):\n \"\"\"\n Send the record to the Web server as a SOAP message\n \"\"\"\n try:\n import httplib, urllib\n h = httplib.HTTP(self.host)\n h.putrequest(\"POST\", self.url)\n keys = record.__dict__.keys()\n keys.sort()\n args = \"\"\n for key in keys:\n v = record.__dict__[key]\n if type(v) == types.StringType:\n t = \"string\"\n elif (type(v) == types.IntType) or (type(v) == types.LongType):\n t = \"integer\"\n elif type(v) == types.FloatType:\n t = \"float\"\n else:\n t = \"string\"\n args = args + \"%12s%s\\n\" % (\"\",\n key, t, str(v), key)\n data = SOAP_MESSAGE % args[:-1]\n #print data\n h.putheader(\"Content-type\", \"text/plain; charset=\\\"utf-8\\\"\")\n h.putheader(\"Content-length\", str(len(data)))\n h.endheaders()\n h.send(data)\n r = h.getreply() #can't do anything with the result\n #print r\n f = h.getfile()\n #print f.read()\n f.close()\n except:\n self.handleError()\n\n#---------------------------------------------------------------------------\n# Manager classes and functions\n#---------------------------------------------------------------------------\n\nclass PlaceHolder:\n \"\"\"\n PlaceHolder instances are used in the Manager logger hierarchy to take\n the place of nodes for which no loggers have been defined [FIXME add\n example].\n \"\"\"\n def __init__(self, alogger):\n \"\"\"\n Initialize with the specified logger being a child of this placeholder.\n \"\"\"\n self.loggers = [alogger]\n\n def append(self, alogger):\n \"\"\"\n Add the specified logger as a child of this placeholder.\n \"\"\"\n if alogger not in self.loggers:\n self.loggers.append(alogger)\n\n#\n# Determine which class to use when instantiating loggers.\n#\n_loggerClass = None\n\ndef setLoggerClass(klass):\n \"\"\"\n Set the class to be used when instantiating a logger. The class should\n define __init__() such that only a name argument is required, and the\n __init__() should call Logger.__init__()\n \"\"\"\n if klass != Logger:\n if type(klass) != types.ClassType:\n raise TypeError, \"setLoggerClass is expecting a class\"\n if not (Logger in klass.__bases__):\n raise TypeError, \"logger not derived from logging.Logger: \" + \\\n klass.__name__\n global _loggerClass\n _loggerClass = klass\n\nclass Manager:\n \"\"\"\n There is [under normal circumstances] just one Manager instance, which\n holds the hierarchy of loggers.\n \"\"\"\n def __init__(self, root):\n \"\"\"\n Initialize the manager with the root node of the logger hierarchy.\n \"\"\"\n self.root = root\n self.disable = 0\n self.emittedNoHandlerWarning = 0\n self.loggerDict = {}\n\n def getLogger(self, name):\n \"\"\"\n Get a logger with the specified name, creating it if it doesn't\n yet exist. If a PlaceHolder existed for the specified name [i.e.\n the logger didn't exist but a child of it did], replace it with\n the created logger and fix up the parent/child references which\n pointed to the placeholder to now point to the logger.\n \"\"\"\n rv = None\n if self.loggerDict.has_key(name):\n rv = self.loggerDict[name]\n if isinstance(rv, PlaceHolder):\n ph = rv\n rv = _loggerClass(name)\n rv.manager = self\n self.loggerDict[name] = rv\n self._fixupChildren(ph, rv)\n self._fixupParents(rv)\n else:\n rv = _loggerClass(name)\n rv.manager = self\n self.loggerDict[name] = rv\n self._fixupParents(rv)\n return rv\n\n def _fixupParents(self, alogger):\n \"\"\"\n Ensure that there are either loggers or placeholders all the way\n from the specified logger to the root of the logger hierarchy.\n \"\"\"\n name = alogger.name\n i = string.rfind(name, \".\")\n rv = None\n while (i > 0) and not rv:\n substr = name[:i]\n if not self.loggerDict.has_key(substr):\n self.loggerDict[name] = PlaceHolder(alogger)\n else:\n obj = self.loggerDict[substr]\n if isinstance(obj, Logger):\n rv = obj\n else:\n assert isinstance(obj, PlaceHolder)\n obj.append(alogger)\n i = string.rfind(name, \".\", 0, i - 1)\n if not rv:\n rv = self.root\n alogger.parent = rv\n\n def _fixupChildren(self, ph, alogger):\n \"\"\"\n Ensure that children of the placeholder ph are connected to the\n specified logger.\n \"\"\"\n for c in ph.loggers:\n if string.find(c.parent.name, alogger.name) <> 0:\n alogger.parent = c.parent\n c.parent = alogger\n\n#---------------------------------------------------------------------------\n# Logger classes and functions\n#---------------------------------------------------------------------------\n\nclass Logger(Filterer):\n \"\"\"\n Instances of the Logger class represent a single logging channel.\n \"\"\"\n def __init__(self, name, level=0):\n \"\"\"\n Initialize the logger with a name and an optional level.\n \"\"\"\n Filterer.__init__(self)\n self.name = name\n self.level = level\n self.parent = None\n self.propagate = 1\n self.handlers = []\n\n def setLevel(self, lvl):\n \"\"\"\n Set the logging level of this logger.\n \"\"\"\n self.level = lvl\n\n# def getRoot(self):\n# \"\"\"\n# Get the root of the logger hierarchy.\n# \"\"\"\n# return Logger.root\n\n def debug(self, msg, *args, **kwargs):\n \"\"\"\n Log 'msg % args' with severity 'DEBUG'. To pass exception information,\n use the keyword argument exc_info with a true value, e.g.\n\n logger.debug(\"Houston, we have a %s\", \"thorny problem\", exc_info=1)\n \"\"\"\n if self.manager.disable >= DEBUG:\n return\n if DEBUG >= self.getEffectiveLevel():\n apply(self._log, (DEBUG, msg, args), kwargs)\n\n def info(self, msg, *args, **kwargs):\n \"\"\"\n Log 'msg % args' with severity 'INFO'. To pass exception information,\n use the keyword argument exc_info with a true value, e.g.\n\n logger.info(\"Houston, we have a %s\", \"interesting problem\", exc_info=1)\n \"\"\"\n if self.manager.disable >= INFO:\n return\n if INFO >= self.getEffectiveLevel():\n apply(self._log, (INFO, msg, args), kwargs)\n\n def warn(self, msg, *args, **kwargs):\n \"\"\"\n Log 'msg % args' with severity 'WARN'. To pass exception information,\n use the keyword argument exc_info with a true value, e.g.\n\n logger.warn(\"Houston, we have a %s\", \"bit of a problem\", exc_info=1)\n \"\"\"\n if self.manager.disable >= WARN:\n return\n if self.isEnabledFor(WARN):\n apply(self._log, (WARN, msg, args), kwargs)\n\n def error(self, msg, *args, **kwargs):\n \"\"\"\n Log 'msg % args' with severity 'ERROR'. To pass exception information,\n use the keyword argument exc_info with a true value, e.g.\n\n logger.error(\"Houston, we have a %s\", \"major problem\", exc_info=1)\n \"\"\"\n if self.manager.disable >= ERROR:\n return\n if self.isEnabledFor(ERROR):\n apply(self._log, (ERROR, msg, args), kwargs)\n\n def exception(self, msg, *args):\n \"\"\"\n Convenience method for logging an ERROR with exception information\n \"\"\"\n apply(self.error, (msg,) + args, {'exc_info': 1})\n\n def critical(self, msg, *args, **kwargs):\n \"\"\"\n Log 'msg % args' with severity 'CRITICAL'. To pass exception\n information, use the keyword argument exc_info with a true value, e.g.\n\n logger.critical(\"Houston, we have a %s\", \"major disaster\", exc_info=1)\n \"\"\"\n if self.manager.disable >= CRITICAL:\n return\n if CRITICAL >= self.getEffectiveLevel():\n apply(self._log, (CRITICAL, msg, args), kwargs)\n\n fatal = critical\n\n def log(self, lvl, msg, *args, **kwargs):\n \"\"\"\n Log 'msg % args' with the severity 'lvl'. To pass exception\n information, use the keyword argument exc_info with a true value, e.g.\n logger.log(lvl, \"We have a %s\", \"mysterious problem\", exc_info=1)\n \"\"\"\n if self.manager.disable >= lvl:\n return\n if self.isEnabledFor(lvl):\n apply(self._log, (lvl, msg, args), kwargs)\n\n def findCaller(self):\n \"\"\"\n Find the stack frame of the caller so that we can note the source\n file name and line number.\n \"\"\"\n frames = inspect.stack()[1:]\n for f in frames:\n if _srcfile != f[1]:\n return (f[1], f[2])\n return (None, None)\n\n def makeRecord(self, name, lvl, fn, lno, msg, args, exc_info):\n \"\"\"\n A factory method which can be overridden in subclasses to create\n specialized LogRecords.\n \"\"\"\n return LogRecord(name, lvl, fn, lno, msg, args, exc_info)\n\n def _log(self, lvl, msg, args, exc_info=None):\n \"\"\"\n Low-level logging routine which creates a LogRecord and then calls\n all the handlers of this logger to handle the record.\n \"\"\"\n if inspect:\n fn, lno = self.findCaller()\n else:\n fn, lno = \"\", 0\n if exc_info:\n exc_info = sys.exc_info()\n record = self.makeRecord(self.name, lvl, fn, lno, msg, args, exc_info)\n self.handle(record)\n\n def handle(self, record):\n \"\"\"\n Call the handlers for the specified record. This method is used for\n unpickled records received from a socket, as well as those created\n locally. Logger-level filtering is applied.\n \"\"\"\n if self.filter(record):\n self.callHandlers(record)\n\n def addHandler(self, hdlr):\n \"\"\"\n Add the specified handler to this logger.\n \"\"\"\n if not (hdlr in self.handlers):\n self.handlers.append(hdlr)\n\n def removeHandler(self, hdlr):\n \"\"\"\n Remove the specified handler from this logger.\n \"\"\"\n if hdlr in self.handlers:\n self.handlers.remove(hdlr)\n\n def callHandlers(self, record):\n \"\"\"\n Loop through all handlers for this logger and its parents in the\n logger hierarchy. If no handler was found, output a one-off error\n message. Stop searching up the hierarchy whenever a logger with the\n \"propagate\" attribute set to zero is found - that will be the last\n logger whose handlers are called.\n \"\"\"\n c = self\n found = 0\n while c:\n for hdlr in c.handlers:\n found = found + 1\n if record.lvl >= hdlr.level:\n hdlr.handle(record)\n if not c.propagate:\n c = None #break out\n else:\n c = c.parent\n if (found == 0) and not self.manager.emittedNoHandlerWarning:\n print \"No handlers could be found for logger \\\"%s\\\"\" % self.name\n self.manager.emittedNoHandlerWarning = 1\n\n def getEffectiveLevel(self):\n \"\"\"\n Loop through this logger and its parents in the logger hierarchy,\n looking for a non-zero logging level. Return the first one found.\n \"\"\"\n c = self\n while c:\n if c.level:\n return c.level\n c = c.parent\n #print \"NCP\", self.parent\n\n def isEnabledFor(self, lvl):\n \"\"\"\n Is this logger enabled for level lvl?\n \"\"\"\n if self.manager.disable >= lvl:\n return 0\n return lvl >= self.getEffectiveLevel()\n\nclass RootLogger(Logger):\n \"\"\"\n A root logger is not that different to any other logger, except that\n it must have a logging level and there is only one instance of it in\n the hierarchy.\n \"\"\"\n def __init__(self, lvl):\n \"\"\"\n Initialize the logger with the name \"root\".\n \"\"\"\n Logger.__init__(self, \"root\", lvl)\n\n_loggerClass = Logger\n\nroot = RootLogger(DEBUG)\nLogger.root = root\nLogger.manager = Manager(Logger.root)\n\n#---------------------------------------------------------------------------\n# Configuration classes and functions\n#---------------------------------------------------------------------------\n\nBASIC_FORMAT = \"%(asctime)s %(name)-19s %(level)-5s - %(message)s\"\n\ndef basicConfig():\n \"\"\"\n Do basic configuration for the logging system by creating a\n StreamHandler with a default Formatter and adding it to the\n root logger.\n \"\"\"\n hdlr = StreamHandler()\n fmt = Formatter(BASIC_FORMAT)\n hdlr.setFormatter(fmt)\n root.addHandler(hdlr)\n\n#def fileConfig(fname):\n# \"\"\"\n# The old implementation - using dict-based configuration files.\n# Read the logging configuration from a file. Keep it simple for now.\n# \"\"\"\n# file = open(fname, \"r\")\n# data = file.read()\n# file.close()\n# dict = eval(data)\n# handlers = dict.get(\"handlers\", [])\n# loggers = dict.get(\"loggers\", [])\n# formatters = dict.get(\"formatters\", [])\n# for f in formatters:\n# fd = dict[f]\n# fc = fd.get(\"class\", \"logging.Formatter\")\n# args = fd.get(\"args\", ())\n# fc = eval(fc)\n# try:\n# fmt = apply(fc, args)\n# except:\n# print fc, args\n# raise\n# dict[f] = fmt\n#\n# for h in handlers:\n# hd = dict[h]\n# hc = hd.get(\"class\", \"logging.StreamHandler\")\n# args = hd.get(\"args\", ())\n# hc = eval(hc)\n# fmt = hd.get(\"formatter\", None)\n# if fmt:\n# fmt = dict.get(fmt, None)\n# try:\n# hdlr = apply(hc, args)\n# except:\n# print hc, args\n# raise\n# if fmt:\n# hdlr.setFormatter(fmt)\n# dict[h] = hdlr\n#\n# for ln in loggers:\n# ld = dict[ln]\n# name = ld.get(\"name\", None)\n# if name:\n# logger = getLogger(name)\n# else:\n# logger = getRootLogger()\n# logger.propagate = ld.get(\"propagate\", 1)\n# hdlrs = ld.get(\"handlers\", [])\n# for h in hdlrs:\n# hdlr = dict.get(h, None)\n# if hdlr:\n# logger.addHandler(hdlr)\n\ndef fileConfig(fname):\n \"\"\"\n Read the logging configuration from a ConfigParser-format file.\n \"\"\"\n import ConfigParser\n\n cp = ConfigParser.ConfigParser()\n cp.read(fname)\n #first, do the formatters...\n flist = cp.get(\"formatters\", \"keys\")\n flist = string.split(flist, \",\")\n formatters = {}\n for form in flist:\n sectname = \"formatter_%s\" % form\n fs = cp.get(sectname, \"format\", 1)\n dfs = cp.get(sectname, \"datefmt\", 1)\n f = Formatter(fs, dfs)\n formatters[form] = f\n #next, do the handlers...\n hlist = cp.get(\"handlers\", \"keys\")\n hlist = string.split(hlist, \",\")\n handlers = {}\n for hand in hlist:\n sectname = \"handler_%s\" % hand\n klass = cp.get(sectname, \"class\")\n fmt = cp.get(sectname, \"formatter\")\n lvl = cp.get(sectname, \"level\")\n klass = eval(klass)\n args = cp.get(sectname, \"args\")\n args = eval(args)\n h = apply(klass, args)\n h.setLevel(eval(lvl))\n h.setFormatter(formatters[fmt])\n #temporary hack for FileHandler.\n if klass == FileHandler:\n maxsize = cp.get(sectname, \"maxsize\")\n if maxsize:\n maxsize = eval(maxsize)\n else:\n maxsize = 0\n if maxsize:\n backcount = cp.get(sectname, \"backcount\")\n if backcount:\n backcount = eval(backcount)\n else:\n backcount = 0\n h.setRollover(maxsize, backcount)\n handlers[hand] = h\n #at last, the loggers...first the root...\n llist = cp.get(\"loggers\", \"keys\")\n llist = string.split(llist, \",\")\n llist.remove(\"root\")\n sectname = \"logger_root\"\n log = root\n lvl = cp.get(sectname, \"level\")\n log.setLevel(eval(lvl))\n hlist = cp.get(sectname, \"handlers\")\n hlist = string.split(hlist, \",\")\n for hand in hlist:\n log.addHandler(handlers[hand])\n #and now the others...\n for log in llist:\n sectname = \"logger_%s\" % log\n qn = cp.get(sectname, \"qualname\")\n lvl = cp.get(sectname, \"level\")\n propagate = cp.get(sectname, \"propagate\")\n logger = getLogger(qn)\n logger.setLevel(eval(lvl))\n logger.propagate = eval(propagate)\n hlist = cp.get(sectname, \"handlers\")\n hlist = string.split(hlist, \",\")\n for hand in hlist:\n logger.addHandler(handlers[hand])\n\n\n#---------------------------------------------------------------------------\n# Utility functions at module level.\n# Basically delegate everything to the root logger.\n#---------------------------------------------------------------------------\n\ndef getLogger(name):\n \"\"\"\n Return a logger with the specified name, creating it if necessary.\n If no name is specified, return the root logger.\n \"\"\"\n if name:\n return Logger.manager.getLogger(name)\n else:\n return root\n\ndef getRootLogger():\n \"\"\"\n Return the root logger.\n \"\"\"\n return root\n\ndef critical(msg, *args, **kwargs):\n \"\"\"\n Log a message with severity 'CRITICAL' on the root logger.\n \"\"\"\n if len(root.handlers) == 0:\n basicConfig()\n apply(root.critical, (msg,)+args, kwargs)\n\nfatal = critical\n\ndef error(msg, *args, **kwargs):\n \"\"\"\n Log a message with severity 'ERROR' on the root logger.\n \"\"\"\n if len(root.handlers) == 0:\n basicConfig()\n apply(root.error, (msg,)+args, kwargs)\n\ndef exception(msg, *args):\n \"\"\"\n Log a message with severity 'ERROR' on the root logger,\n with exception information.\n \"\"\"\n apply(error, (msg,)+args, {'exc_info': 1})\n\ndef warn(msg, *args, **kwargs):\n \"\"\"\n Log a message with severity 'WARN' on the root logger.\n \"\"\"\n if len(root.handlers) == 0:\n basicConfig()\n apply(root.warn, (msg,)+args, kwargs)\n\ndef info(msg, *args, **kwargs):\n \"\"\"\n Log a message with severity 'INFO' on the root logger.\n \"\"\"\n if len(root.handlers) == 0:\n basicConfig()\n apply(root.info, (msg,)+args, kwargs)\n\ndef debug(msg, *args, **kwargs):\n \"\"\"\n Log a message with severity 'DEBUG' on the root logger.\n \"\"\"\n if len(root.handlers) == 0:\n basicConfig()\n apply(root.debug, (msg,)+args, kwargs)\n\ndef disable(level):\n \"\"\"\n Disable all logging calls less severe than 'level'.\n \"\"\"\n root.manager.disable = level\n\ndef shutdown():\n \"\"\"\n Perform any cleanup actions in the logging system (e.g. flushing\n buffers). Should be called at application exit.\n \"\"\"\n for h in _handlers.keys():\n h.flush()\n h.close()\n\nif __name__ == \"__main__\":\n print __doc__\n", + "source_code_before": null, + "methods": [ + { + "name": "getLevelName", + "long_name": "getLevelName( lvl )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 19, + "parameters": [ + "lvl" + ], + "start_line": 105, + "end_line": 113, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "addLevelName", + "long_name": "addLevelName( lvl , levelName )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 14, + "parameters": [ + "lvl", + "levelName" + ], + "start_line": 115, + "end_line": 120, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , name , lvl , pathname , lineno , msg , args , exc_info )", + "filename": "logging.py", + "nloc": 21, + "complexity": 3, + "token_count": 142, + "parameters": [ + "self", + "name", + "lvl", + "pathname", + "lineno", + "msg", + "args", + "exc_info" + ], + "start_line": 136, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "logging.py", + "nloc": 3, + "complexity": 1, + "token_count": 29, + "parameters": [ + "self" + ], + "start_line": 161, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fmt = None , datefmt = None )", + "filename": "logging.py", + "nloc": 6, + "complexity": 2, + "token_count": 34, + "parameters": [ + "self", + "fmt", + "datefmt" + ], + "start_line": 207, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "formatTime", + "long_name": "formatTime( self , record , datefmt = None )", + "filename": "logging.py", + "nloc": 8, + "complexity": 2, + "token_count": 68, + "parameters": [ + "self", + "record", + "datefmt" + ], + "start_line": 219, + "end_line": 235, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "formatException", + "long_name": "formatException( self , ei )", + "filename": "logging.py", + "nloc": 7, + "complexity": 1, + "token_count": 54, + "parameters": [ + "self", + "ei" + ], + "start_line": 237, + "end_line": 247, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "format", + "long_name": "format( self , record )", + "filename": "logging.py", + "nloc": 10, + "complexity": 4, + "token_count": 85, + "parameters": [ + "self", + "record" + ], + "start_line": 249, + "end_line": 268, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , linefmt = None )", + "filename": "logging.py", + "nloc": 5, + "complexity": 2, + "token_count": 25, + "parameters": [ + "self", + "linefmt" + ], + "start_line": 279, + "end_line": 287, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "formatHeader", + "long_name": "formatHeader( self , records )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "records" + ], + "start_line": 289, + "end_line": 293, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "formatFooter", + "long_name": "formatFooter( self , records )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "records" + ], + "start_line": 295, + "end_line": 299, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "format", + "long_name": "format( self , records )", + "filename": "logging.py", + "nloc": 8, + "complexity": 3, + "token_count": 58, + "parameters": [ + "self", + "records" + ], + "start_line": 301, + "end_line": 311, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "filter", + "long_name": "filter( self , record )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "record" + ], + "start_line": 323, + "end_line": 327, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 334, + "end_line": 335, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "addFilter", + "long_name": "addFilter( self , filter )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 26, + "parameters": [ + "self", + "filter" + ], + "start_line": 337, + "end_line": 342, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "removeFilter", + "long_name": "removeFilter( self , filter )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self", + "filter" + ], + "start_line": 344, + "end_line": 349, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "filter", + "long_name": "filter( self , record )", + "filename": "logging.py", + "nloc": 7, + "complexity": 3, + "token_count": 33, + "parameters": [ + "self", + "record" + ], + "start_line": 351, + "end_line": 362, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , level = 0 )", + "filename": "logging.py", + "nloc": 5, + "complexity": 1, + "token_count": 32, + "parameters": [ + "self", + "level" + ], + "start_line": 377, + "end_line": 385, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "setLevel", + "long_name": "setLevel( self , lvl )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self", + "lvl" + ], + "start_line": 387, + "end_line": 391, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "format", + "long_name": "format( self , record )", + "filename": "logging.py", + "nloc": 6, + "complexity": 2, + "token_count": 30, + "parameters": [ + "self", + "record" + ], + "start_line": 393, + "end_line": 402, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , record )", + "filename": "logging.py", + "nloc": 3, + "complexity": 1, + "token_count": 14, + "parameters": [ + "self", + "record" + ], + "start_line": 404, + "end_line": 411, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "handle", + "long_name": "handle( self , record )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self", + "record" + ], + "start_line": 413, + "end_line": 419, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "setFormatter", + "long_name": "setFormatter( self , fmt )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self", + "fmt" + ], + "start_line": 421, + "end_line": 425, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "flush", + "long_name": "flush( self )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [ + "self" + ], + "start_line": 427, + "end_line": 432, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "close", + "long_name": "close( self )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [ + "self" + ], + "start_line": 434, + "end_line": 439, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "handleError", + "long_name": "handleError( self )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [ + "self" + ], + "start_line": 441, + "end_line": 455, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , strm = None )", + "filename": "logging.py", + "nloc": 6, + "complexity": 2, + "token_count": 35, + "parameters": [ + "self", + "strm" + ], + "start_line": 463, + "end_line": 471, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "flush", + "long_name": "flush( self )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 473, + "end_line": 477, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , record )", + "filename": "logging.py", + "nloc": 7, + "complexity": 2, + "token_count": 40, + "parameters": [ + "self", + "record" + ], + "start_line": 479, + "end_line": 492, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , filename , mode = \"a+\" )", + "filename": "logging.py", + "nloc": 7, + "complexity": 1, + "token_count": 50, + "parameters": [ + "self", + "filename", + "mode" + ], + "start_line": 498, + "end_line": 509, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "setRollover", + "long_name": "setRollover( self , max_size , backup_count )", + "filename": "logging.py", + "nloc": 5, + "complexity": 2, + "token_count": 30, + "parameters": [ + "self", + "max_size", + "backup_count" + ], + "start_line": 511, + "end_line": 526, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "doRollover", + "long_name": "doRollover( self )", + "filename": "logging.py", + "nloc": 9, + "complexity": 2, + "token_count": 66, + "parameters": [ + "self" + ], + "start_line": 528, + "end_line": 539, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , record )", + "filename": "logging.py", + "nloc": 6, + "complexity": 3, + "token_count": 56, + "parameters": [ + "self", + "record" + ], + "start_line": 541, + "end_line": 550, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "close", + "long_name": "close( self )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 552, + "end_line": 556, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , host , port )", + "filename": "logging.py", + "nloc": 6, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self", + "host", + "port" + ], + "start_line": 565, + "end_line": 573, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "makeSocket", + "long_name": "makeSocket( self )", + "filename": "logging.py", + "nloc": 4, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 575, + "end_line": 582, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "send", + "long_name": "send( self , s )", + "filename": "logging.py", + "nloc": 7, + "complexity": 2, + "token_count": 46, + "parameters": [ + "self", + "s" + ], + "start_line": 584, + "end_line": 594, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "makePickle", + "long_name": "makePickle( self , record )", + "filename": "logging.py", + "nloc": 5, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "record" + ], + "start_line": 596, + "end_line": 603, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "handleError", + "long_name": "handleError( self )", + "filename": "logging.py", + "nloc": 4, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self" + ], + "start_line": 605, + "end_line": 613, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , record )", + "filename": "logging.py", + "nloc": 8, + "complexity": 3, + "token_count": 46, + "parameters": [ + "self", + "record" + ], + "start_line": 615, + "end_line": 626, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "close", + "long_name": "close( self )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 628, + "end_line": 634, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , host , port )", + "filename": "logging.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "host", + "port" + ], + "start_line": 641, + "end_line": 646, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "makeSocket", + "long_name": "makeSocket( self )", + "filename": "logging.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 648, + "end_line": 654, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "sendto", + "long_name": "sendto( self , s , addr )", + "filename": "logging.py", + "nloc": 7, + "complexity": 2, + "token_count": 50, + "parameters": [ + "self", + "s", + "addr" + ], + "start_line": 656, + "end_line": 666, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , record )", + "filename": "logging.py", + "nloc": 8, + "complexity": 3, + "token_count": 56, + "parameters": [ + "self", + "record" + ], + "start_line": 668, + "end_line": 678, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , address = ( 'localhost' , SYSLOG_UDP_PORT )", + "filename": "logging.py", + "nloc": 16, + "complexity": 2, + "token_count": 101, + "parameters": [ + "self", + "address", + "SYSLOG_UDP_PORT" + ], + "start_line": 769, + "end_line": 786, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "encodePriority", + "long_name": "encodePriority( self , facility , priority )", + "filename": "logging.py", + "nloc": 6, + "complexity": 3, + "token_count": 55, + "parameters": [ + "self", + "facility", + "priority" + ], + "start_line": 794, + "end_line": 805, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "close", + "long_name": "close( self )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 18, + "parameters": [ + "self" + ], + "start_line": 807, + "end_line": 812, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , record )", + "filename": "logging.py", + "nloc": 16, + "complexity": 3, + "token_count": 80, + "parameters": [ + "self", + "record" + ], + "start_line": 814, + "end_line": 833, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , mailhost , fromaddr , toaddrs , subject )", + "filename": "logging.py", + "nloc": 12, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "mailhost", + "fromaddr", + "toaddrs", + "subject" + ], + "start_line": 839, + "end_line": 855, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "getSubject", + "long_name": "getSubject( self , record )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "record" + ], + "start_line": 857, + "end_line": 862, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , record )", + "filename": "logging.py", + "nloc": 17, + "complexity": 3, + "token_count": 101, + "parameters": [ + "self", + "record" + ], + "start_line": 864, + "end_line": 883, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , capacity )", + "filename": "logging.py", + "nloc": 4, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "capacity" + ], + "start_line": 891, + "end_line": 897, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "shouldFlush", + "long_name": "shouldFlush( self , record )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 21, + "parameters": [ + "self", + "record" + ], + "start_line": 899, + "end_line": 904, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , record )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 29, + "parameters": [ + "self", + "record" + ], + "start_line": 906, + "end_line": 913, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "flush", + "long_name": "flush( self )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self" + ], + "start_line": 915, + "end_line": 920, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , capacity , flushLevel = ERROR , target = None )", + "filename": "logging.py", + "nloc": 4, + "complexity": 1, + "token_count": 34, + "parameters": [ + "self", + "capacity", + "flushLevel", + "target" + ], + "start_line": 928, + "end_line": 937, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "shouldFlush", + "long_name": "shouldFlush( self , record )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 32, + "parameters": [ + "self", + "record" + ], + "start_line": 939, + "end_line": 944, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "setTarget", + "long_name": "setTarget( self , target )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self", + "target" + ], + "start_line": 946, + "end_line": 950, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "flush", + "long_name": "flush( self )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 32, + "parameters": [ + "self" + ], + "start_line": 952, + "end_line": 961, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , appname , dllname = None , logtype = \"Application\" )", + "filename": "logging.py", + "nloc": 26, + "complexity": 3, + "token_count": 163, + "parameters": [ + "self", + "appname", + "dllname", + "logtype" + ], + "start_line": 973, + "end_line": 998, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "getMessageID", + "long_name": "getMessageID( self , record )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "record" + ], + "start_line": 1000, + "end_line": 1008, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "getEventCategory", + "long_name": "getEventCategory( self , record )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "record" + ], + "start_line": 1010, + "end_line": 1015, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "getEventType", + "long_name": "getEventType( self , record )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 23, + "parameters": [ + "self", + "record" + ], + "start_line": 1017, + "end_line": 1027, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , record )", + "filename": "logging.py", + "nloc": 10, + "complexity": 3, + "token_count": 74, + "parameters": [ + "self", + "record" + ], + "start_line": 1029, + "end_line": 1042, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 1 + }, + { + "name": "close", + "long_name": "close( self )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [ + "self" + ], + "start_line": 1044, + "end_line": 1053, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , host , url , method = \"GET\" )", + "filename": "logging.py", + "nloc": 8, + "complexity": 2, + "token_count": 57, + "parameters": [ + "self", + "host", + "url", + "method" + ], + "start_line": 1060, + "end_line": 1071, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , record )", + "filename": "logging.py", + "nloc": 21, + "complexity": 6, + "token_count": 140, + "parameters": [ + "self", + "record" + ], + "start_line": 1073, + "end_line": 1096, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , host , url )", + "filename": "logging.py", + "nloc": 4, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self", + "host", + "url" + ], + "start_line": 1117, + "end_line": 1123, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , record )", + "filename": "logging.py", + "nloc": 30, + "complexity": 7, + "token_count": 210, + "parameters": [ + "self", + "record" + ], + "start_line": 1125, + "end_line": 1160, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 36, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , alogger )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 15, + "parameters": [ + "self", + "alogger" + ], + "start_line": 1172, + "end_line": 1176, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "append", + "long_name": "append( self , alogger )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self", + "alogger" + ], + "start_line": 1178, + "end_line": 1183, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "setLoggerClass", + "long_name": "setLoggerClass( klass )", + "filename": "logging.py", + "nloc": 9, + "complexity": 4, + "token_count": 49, + "parameters": [ + "klass" + ], + "start_line": 1190, + "end_line": 1203, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , root )", + "filename": "logging.py", + "nloc": 5, + "complexity": 1, + "token_count": 29, + "parameters": [ + "self", + "root" + ], + "start_line": 1210, + "end_line": 1217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "getLogger", + "long_name": "getLogger( self , name )", + "filename": "logging.py", + "nloc": 17, + "complexity": 3, + "token_count": 102, + "parameters": [ + "self", + "name" + ], + "start_line": 1219, + "end_line": 1242, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "_fixupParents", + "long_name": "_fixupParents( self , alogger )", + "filename": "logging.py", + "nloc": 19, + "complexity": 6, + "token_count": 131, + "parameters": [ + "self", + "alogger" + ], + "start_line": 1244, + "end_line": 1266, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "_fixupChildren", + "long_name": "_fixupChildren( self , ph , alogger )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 48, + "parameters": [ + "self", + "ph", + "alogger" + ], + "start_line": 1268, + "end_line": 1276, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , name , level = 0 )", + "filename": "logging.py", + "nloc": 7, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "name", + "level" + ], + "start_line": 1286, + "end_line": 1295, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "setLevel", + "long_name": "setLevel( self , lvl )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self", + "lvl" + ], + "start_line": 1297, + "end_line": 1301, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "debug", + "long_name": "debug( self , msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "msg", + "args", + "kwargs" + ], + "start_line": 1309, + "end_line": 1319, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "info", + "long_name": "info( self , msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "msg", + "args", + "kwargs" + ], + "start_line": 1321, + "end_line": 1331, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "warn", + "long_name": "warn( self , msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 48, + "parameters": [ + "self", + "msg", + "args", + "kwargs" + ], + "start_line": 1333, + "end_line": 1343, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "error", + "long_name": "error( self , msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 48, + "parameters": [ + "self", + "msg", + "args", + "kwargs" + ], + "start_line": 1345, + "end_line": 1355, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "exception", + "long_name": "exception( self , msg , * args )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "msg", + "args" + ], + "start_line": 1357, + "end_line": 1361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "critical", + "long_name": "critical( self , msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "msg", + "args", + "kwargs" + ], + "start_line": 1363, + "end_line": 1373, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "log", + "long_name": "log( self , lvl , msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 50, + "parameters": [ + "self", + "lvl", + "msg", + "args", + "kwargs" + ], + "start_line": 1377, + "end_line": 1386, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "findCaller", + "long_name": "findCaller( self )", + "filename": "logging.py", + "nloc": 6, + "complexity": 3, + "token_count": 48, + "parameters": [ + "self" + ], + "start_line": 1388, + "end_line": 1397, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "makeRecord", + "long_name": "makeRecord( self , name , lvl , fn , lno , msg , args , exc_info )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 37, + "parameters": [ + "self", + "name", + "lvl", + "fn", + "lno", + "msg", + "args", + "exc_info" + ], + "start_line": 1399, + "end_line": 1404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "_log", + "long_name": "_log( self , lvl , msg , args , exc_info = None )", + "filename": "logging.py", + "nloc": 9, + "complexity": 3, + "token_count": 75, + "parameters": [ + "self", + "lvl", + "msg", + "args", + "exc_info" + ], + "start_line": 1406, + "end_line": 1418, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "handle", + "long_name": "handle( self , record )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self", + "record" + ], + "start_line": 1420, + "end_line": 1427, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "addHandler", + "long_name": "addHandler( self , hdlr )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 26, + "parameters": [ + "self", + "hdlr" + ], + "start_line": 1429, + "end_line": 1434, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "removeHandler", + "long_name": "removeHandler( self , hdlr )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self", + "hdlr" + ], + "start_line": 1436, + "end_line": 1441, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "callHandlers", + "long_name": "callHandlers( self , record )", + "filename": "logging.py", + "nloc": 15, + "complexity": 7, + "token_count": 87, + "parameters": [ + "self", + "record" + ], + "start_line": 1443, + "end_line": 1464, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 1 + }, + { + "name": "getEffectiveLevel", + "long_name": "getEffectiveLevel( self )", + "filename": "logging.py", + "nloc": 6, + "complexity": 3, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 1466, + "end_line": 1475, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "isEnabledFor", + "long_name": "isEnabledFor( self , lvl )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 27, + "parameters": [ + "self", + "lvl" + ], + "start_line": 1478, + "end_line": 1484, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , lvl )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self", + "lvl" + ], + "start_line": 1492, + "end_line": 1496, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "basicConfig", + "long_name": "basicConfig( )", + "filename": "logging.py", + "nloc": 5, + "complexity": 1, + "token_count": 28, + "parameters": [], + "start_line": 1510, + "end_line": 1519, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 0 + }, + { + "name": "fileConfig", + "long_name": "fileConfig( fname )", + "filename": "logging.py", + "nloc": 64, + "complexity": 10, + "token_count": 457, + "parameters": [ + "fname" + ], + "start_line": 1576, + "end_line": 1648, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 73, + "top_nesting_level": 0 + }, + { + "name": "getLogger", + "long_name": "getLogger( name )", + "filename": "logging.py", + "nloc": 5, + "complexity": 2, + "token_count": 22, + "parameters": [ + "name" + ], + "start_line": 1656, + "end_line": 1664, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "getRootLogger", + "long_name": "getRootLogger( )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [], + "start_line": 1666, + "end_line": 1670, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "critical", + "long_name": "critical( msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 40, + "parameters": [ + "msg", + "args", + "kwargs" + ], + "start_line": 1672, + "end_line": 1678, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "error", + "long_name": "error( msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 40, + "parameters": [ + "msg", + "args", + "kwargs" + ], + "start_line": 1682, + "end_line": 1688, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "exception", + "long_name": "exception( msg , * args )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 26, + "parameters": [ + "msg", + "args" + ], + "start_line": 1690, + "end_line": 1695, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "warn", + "long_name": "warn( msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 40, + "parameters": [ + "msg", + "args", + "kwargs" + ], + "start_line": 1697, + "end_line": 1703, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "info", + "long_name": "info( msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 40, + "parameters": [ + "msg", + "args", + "kwargs" + ], + "start_line": 1705, + "end_line": 1711, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "debug", + "long_name": "debug( msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 40, + "parameters": [ + "msg", + "args", + "kwargs" + ], + "start_line": 1713, + "end_line": 1719, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "disable", + "long_name": "disable( level )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "level" + ], + "start_line": 1721, + "end_line": 1725, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "shutdown", + "long_name": "shutdown( )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [], + "start_line": 1727, + "end_line": 1734, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + } + ], + "methods_before": [], + "changed_methods": [ + { + "name": "flush", + "long_name": "flush( self )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [ + "self" + ], + "start_line": 427, + "end_line": 432, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "getEffectiveLevel", + "long_name": "getEffectiveLevel( self )", + "filename": "logging.py", + "nloc": 6, + "complexity": 3, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 1466, + "end_line": 1475, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "close", + "long_name": "close( self )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [ + "self" + ], + "start_line": 434, + "end_line": 439, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "handle", + "long_name": "handle( self , record )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self", + "record" + ], + "start_line": 413, + "end_line": 419, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , address = ( 'localhost' , SYSLOG_UDP_PORT )", + "filename": "logging.py", + "nloc": 16, + "complexity": 2, + "token_count": 101, + "parameters": [ + "self", + "address", + "SYSLOG_UDP_PORT" + ], + "start_line": 769, + "end_line": 786, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "error", + "long_name": "error( msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 40, + "parameters": [ + "msg", + "args", + "kwargs" + ], + "start_line": 1682, + "end_line": 1688, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "formatFooter", + "long_name": "formatFooter( self , records )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "records" + ], + "start_line": 295, + "end_line": 299, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "addFilter", + "long_name": "addFilter( self , filter )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 26, + "parameters": [ + "self", + "filter" + ], + "start_line": 337, + "end_line": 342, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "error", + "long_name": "error( self , msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 48, + "parameters": [ + "self", + "msg", + "args", + "kwargs" + ], + "start_line": 1345, + "end_line": 1355, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "findCaller", + "long_name": "findCaller( self )", + "filename": "logging.py", + "nloc": 6, + "complexity": 3, + "token_count": 48, + "parameters": [ + "self" + ], + "start_line": 1388, + "end_line": 1397, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , host , port )", + "filename": "logging.py", + "nloc": 6, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self", + "host", + "port" + ], + "start_line": 565, + "end_line": 573, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "setTarget", + "long_name": "setTarget( self , target )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self", + "target" + ], + "start_line": 946, + "end_line": 950, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "encodePriority", + "long_name": "encodePriority( self , facility , priority )", + "filename": "logging.py", + "nloc": 6, + "complexity": 3, + "token_count": 55, + "parameters": [ + "self", + "facility", + "priority" + ], + "start_line": 794, + "end_line": 805, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "setRollover", + "long_name": "setRollover( self , max_size , backup_count )", + "filename": "logging.py", + "nloc": 5, + "complexity": 2, + "token_count": 30, + "parameters": [ + "self", + "max_size", + "backup_count" + ], + "start_line": 511, + "end_line": 526, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "setLoggerClass", + "long_name": "setLoggerClass( klass )", + "filename": "logging.py", + "nloc": 9, + "complexity": 4, + "token_count": 49, + "parameters": [ + "klass" + ], + "start_line": 1190, + "end_line": 1203, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , linefmt = None )", + "filename": "logging.py", + "nloc": 5, + "complexity": 2, + "token_count": 25, + "parameters": [ + "self", + "linefmt" + ], + "start_line": 279, + "end_line": 287, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , filename , mode = \"a+\" )", + "filename": "logging.py", + "nloc": 7, + "complexity": 1, + "token_count": 50, + "parameters": [ + "self", + "filename", + "mode" + ], + "start_line": 498, + "end_line": 509, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , capacity , flushLevel = ERROR , target = None )", + "filename": "logging.py", + "nloc": 4, + "complexity": 1, + "token_count": 34, + "parameters": [ + "self", + "capacity", + "flushLevel", + "target" + ], + "start_line": 928, + "end_line": 937, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "doRollover", + "long_name": "doRollover( self )", + "filename": "logging.py", + "nloc": 9, + "complexity": 2, + "token_count": 66, + "parameters": [ + "self" + ], + "start_line": 528, + "end_line": 539, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "_fixupChildren", + "long_name": "_fixupChildren( self , ph , alogger )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 48, + "parameters": [ + "self", + "ph", + "alogger" + ], + "start_line": 1268, + "end_line": 1276, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "makeRecord", + "long_name": "makeRecord( self , name , lvl , fn , lno , msg , args , exc_info )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 37, + "parameters": [ + "self", + "name", + "lvl", + "fn", + "lno", + "msg", + "args", + "exc_info" + ], + "start_line": 1399, + "end_line": 1404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "handleError", + "long_name": "handleError( self )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [ + "self" + ], + "start_line": 441, + "end_line": 455, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "shutdown", + "long_name": "shutdown( )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [], + "start_line": 1727, + "end_line": 1734, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , strm = None )", + "filename": "logging.py", + "nloc": 6, + "complexity": 2, + "token_count": 35, + "parameters": [ + "self", + "strm" + ], + "start_line": 463, + "end_line": 471, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "setLevel", + "long_name": "setLevel( self , lvl )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self", + "lvl" + ], + "start_line": 387, + "end_line": 391, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , name , level = 0 )", + "filename": "logging.py", + "nloc": 7, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "name", + "level" + ], + "start_line": 1286, + "end_line": 1295, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "disable", + "long_name": "disable( level )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "level" + ], + "start_line": 1721, + "end_line": 1725, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "makePickle", + "long_name": "makePickle( self , record )", + "filename": "logging.py", + "nloc": 5, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "record" + ], + "start_line": 596, + "end_line": 603, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , appname , dllname = None , logtype = \"Application\" )", + "filename": "logging.py", + "nloc": 26, + "complexity": 3, + "token_count": 163, + "parameters": [ + "self", + "appname", + "dllname", + "logtype" + ], + "start_line": 973, + "end_line": 998, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , record )", + "filename": "logging.py", + "nloc": 3, + "complexity": 1, + "token_count": 14, + "parameters": [ + "self", + "record" + ], + "start_line": 404, + "end_line": 411, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "exception", + "long_name": "exception( self , msg , * args )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "msg", + "args" + ], + "start_line": 1357, + "end_line": 1361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "filter", + "long_name": "filter( self , record )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "record" + ], + "start_line": 323, + "end_line": 327, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "log", + "long_name": "log( self , lvl , msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 50, + "parameters": [ + "self", + "lvl", + "msg", + "args", + "kwargs" + ], + "start_line": 1377, + "end_line": 1386, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "getLogger", + "long_name": "getLogger( self , name )", + "filename": "logging.py", + "nloc": 17, + "complexity": 3, + "token_count": 102, + "parameters": [ + "self", + "name" + ], + "start_line": 1219, + "end_line": 1242, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "_fixupParents", + "long_name": "_fixupParents( self , alogger )", + "filename": "logging.py", + "nloc": 19, + "complexity": 6, + "token_count": 131, + "parameters": [ + "self", + "alogger" + ], + "start_line": 1244, + "end_line": 1266, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , alogger )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 15, + "parameters": [ + "self", + "alogger" + ], + "start_line": 1172, + "end_line": 1176, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , mailhost , fromaddr , toaddrs , subject )", + "filename": "logging.py", + "nloc": 12, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "mailhost", + "fromaddr", + "toaddrs", + "subject" + ], + "start_line": 839, + "end_line": 855, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "isEnabledFor", + "long_name": "isEnabledFor( self , lvl )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 27, + "parameters": [ + "self", + "lvl" + ], + "start_line": 1478, + "end_line": 1484, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "append", + "long_name": "append( self , alogger )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self", + "alogger" + ], + "start_line": 1178, + "end_line": 1183, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "format", + "long_name": "format( self , records )", + "filename": "logging.py", + "nloc": 8, + "complexity": 3, + "token_count": 58, + "parameters": [ + "self", + "records" + ], + "start_line": 301, + "end_line": 311, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "critical", + "long_name": "critical( msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 40, + "parameters": [ + "msg", + "args", + "kwargs" + ], + "start_line": 1672, + "end_line": 1678, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "addHandler", + "long_name": "addHandler( self , hdlr )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 26, + "parameters": [ + "self", + "hdlr" + ], + "start_line": 1429, + "end_line": 1434, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "getSubject", + "long_name": "getSubject( self , record )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "record" + ], + "start_line": 857, + "end_line": 862, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "send", + "long_name": "send( self , s )", + "filename": "logging.py", + "nloc": 7, + "complexity": 2, + "token_count": 46, + "parameters": [ + "self", + "s" + ], + "start_line": 584, + "end_line": 594, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "getLevelName", + "long_name": "getLevelName( lvl )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 19, + "parameters": [ + "lvl" + ], + "start_line": 105, + "end_line": 113, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , host , url , method = \"GET\" )", + "filename": "logging.py", + "nloc": 8, + "complexity": 2, + "token_count": 57, + "parameters": [ + "self", + "host", + "url", + "method" + ], + "start_line": 1060, + "end_line": 1071, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "shouldFlush", + "long_name": "shouldFlush( self , record )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 21, + "parameters": [ + "self", + "record" + ], + "start_line": 899, + "end_line": 904, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "format", + "long_name": "format( self , record )", + "filename": "logging.py", + "nloc": 10, + "complexity": 4, + "token_count": 85, + "parameters": [ + "self", + "record" + ], + "start_line": 249, + "end_line": 268, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "getRootLogger", + "long_name": "getRootLogger( )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [], + "start_line": 1666, + "end_line": 1670, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "warn", + "long_name": "warn( self , msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 48, + "parameters": [ + "self", + "msg", + "args", + "kwargs" + ], + "start_line": 1333, + "end_line": 1343, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "debug", + "long_name": "debug( self , msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "msg", + "args", + "kwargs" + ], + "start_line": 1309, + "end_line": 1319, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "setFormatter", + "long_name": "setFormatter( self , fmt )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self", + "fmt" + ], + "start_line": 421, + "end_line": 425, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "_log", + "long_name": "_log( self , lvl , msg , args , exc_info = None )", + "filename": "logging.py", + "nloc": 9, + "complexity": 3, + "token_count": 75, + "parameters": [ + "self", + "lvl", + "msg", + "args", + "exc_info" + ], + "start_line": 1406, + "end_line": 1418, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "addLevelName", + "long_name": "addLevelName( lvl , levelName )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 14, + "parameters": [ + "lvl", + "levelName" + ], + "start_line": 115, + "end_line": 120, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "logging.py", + "nloc": 3, + "complexity": 1, + "token_count": 29, + "parameters": [ + "self" + ], + "start_line": 161, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "formatTime", + "long_name": "formatTime( self , record , datefmt = None )", + "filename": "logging.py", + "nloc": 8, + "complexity": 2, + "token_count": 68, + "parameters": [ + "self", + "record", + "datefmt" + ], + "start_line": 219, + "end_line": 235, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "debug", + "long_name": "debug( msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 40, + "parameters": [ + "msg", + "args", + "kwargs" + ], + "start_line": 1713, + "end_line": 1719, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , name , lvl , pathname , lineno , msg , args , exc_info )", + "filename": "logging.py", + "nloc": 21, + "complexity": 3, + "token_count": 142, + "parameters": [ + "self", + "name", + "lvl", + "pathname", + "lineno", + "msg", + "args", + "exc_info" + ], + "start_line": 136, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "info", + "long_name": "info( self , msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "msg", + "args", + "kwargs" + ], + "start_line": 1321, + "end_line": 1331, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fmt = None , datefmt = None )", + "filename": "logging.py", + "nloc": 6, + "complexity": 2, + "token_count": 34, + "parameters": [ + "self", + "fmt", + "datefmt" + ], + "start_line": 207, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "getEventCategory", + "long_name": "getEventCategory( self , record )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "record" + ], + "start_line": 1010, + "end_line": 1015, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , capacity )", + "filename": "logging.py", + "nloc": 4, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "capacity" + ], + "start_line": 891, + "end_line": 897, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "warn", + "long_name": "warn( msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 40, + "parameters": [ + "msg", + "args", + "kwargs" + ], + "start_line": 1697, + "end_line": 1703, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "getMessageID", + "long_name": "getMessageID( self , record )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "record" + ], + "start_line": 1000, + "end_line": 1008, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , lvl )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self", + "lvl" + ], + "start_line": 1492, + "end_line": 1496, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "makeSocket", + "long_name": "makeSocket( self )", + "filename": "logging.py", + "nloc": 4, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 575, + "end_line": 582, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "removeFilter", + "long_name": "removeFilter( self , filter )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self", + "filter" + ], + "start_line": 344, + "end_line": 349, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "critical", + "long_name": "critical( self , msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 5, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "msg", + "args", + "kwargs" + ], + "start_line": 1363, + "end_line": 1373, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "formatHeader", + "long_name": "formatHeader( self , records )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "records" + ], + "start_line": 289, + "end_line": 293, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , host , url )", + "filename": "logging.py", + "nloc": 4, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self", + "host", + "url" + ], + "start_line": 1117, + "end_line": 1123, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , root )", + "filename": "logging.py", + "nloc": 5, + "complexity": 1, + "token_count": 29, + "parameters": [ + "self", + "root" + ], + "start_line": 1210, + "end_line": 1217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , level = 0 )", + "filename": "logging.py", + "nloc": 5, + "complexity": 1, + "token_count": 32, + "parameters": [ + "self", + "level" + ], + "start_line": 377, + "end_line": 385, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "exception", + "long_name": "exception( msg , * args )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 26, + "parameters": [ + "msg", + "args" + ], + "start_line": 1690, + "end_line": 1695, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "callHandlers", + "long_name": "callHandlers( self , record )", + "filename": "logging.py", + "nloc": 15, + "complexity": 7, + "token_count": 87, + "parameters": [ + "self", + "record" + ], + "start_line": 1443, + "end_line": 1464, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 1 + }, + { + "name": "sendto", + "long_name": "sendto( self , s , addr )", + "filename": "logging.py", + "nloc": 7, + "complexity": 2, + "token_count": 50, + "parameters": [ + "self", + "s", + "addr" + ], + "start_line": 656, + "end_line": 666, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "info", + "long_name": "info( msg , * args , ** kwargs )", + "filename": "logging.py", + "nloc": 4, + "complexity": 2, + "token_count": 40, + "parameters": [ + "msg", + "args", + "kwargs" + ], + "start_line": 1705, + "end_line": 1711, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "fileConfig", + "long_name": "fileConfig( fname )", + "filename": "logging.py", + "nloc": 64, + "complexity": 10, + "token_count": 457, + "parameters": [ + "fname" + ], + "start_line": 1576, + "end_line": 1648, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 73, + "top_nesting_level": 0 + }, + { + "name": "getEventType", + "long_name": "getEventType( self , record )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 23, + "parameters": [ + "self", + "record" + ], + "start_line": 1017, + "end_line": 1027, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "logging.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 334, + "end_line": 335, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "basicConfig", + "long_name": "basicConfig( )", + "filename": "logging.py", + "nloc": 5, + "complexity": 1, + "token_count": 28, + "parameters": [], + "start_line": 1510, + "end_line": 1519, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 0 + }, + { + "name": "formatException", + "long_name": "formatException( self , ei )", + "filename": "logging.py", + "nloc": 7, + "complexity": 1, + "token_count": 54, + "parameters": [ + "self", + "ei" + ], + "start_line": 237, + "end_line": 247, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "getLogger", + "long_name": "getLogger( name )", + "filename": "logging.py", + "nloc": 5, + "complexity": 2, + "token_count": 22, + "parameters": [ + "name" + ], + "start_line": 1656, + "end_line": 1664, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "removeHandler", + "long_name": "removeHandler( self , hdlr )", + "filename": "logging.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self", + "hdlr" + ], + "start_line": 1436, + "end_line": 1441, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + } + ], + "nloc": 983, + "complexity": 225, + "token_count": 5486, + "diff_parsed": { + "added": [ + "#! /usr/bin/env python", + "#", + "# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.", + "#", + "# Permission to use, copy, modify, and distribute this software and its", + "# documentation for any purpose and without fee is hereby granted,", + "# provided that the above copyright notice appear in all copies and that", + "# both that copyright notice and this permission notice appear in", + "# supporting documentation, and that the name of Vinay Sajip", + "# not be used in advertising or publicity pertaining to distribution", + "# of the software without specific, written prior permission.", + "# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING", + "# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL", + "# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR", + "# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER", + "# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT", + "# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.", + "#", + "# For the change history, see README.txt in the distribution.", + "#", + "# This file is part of the Python logging distribution. See", + "# http://www.red-dove.com/python_logging.html", + "#", + "", + "\"\"\"", + "Logging module for Python. Based on PEP 282 and comments thereto in", + "comp.lang.python, and influenced by Apache's log4j system.", + "", + "Should work under Python versions >= 1.5.2, except that source line", + "information is not available unless 'inspect' is.", + "", + "Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved.", + "", + "To use, simply 'import logging' and log away!", + "\"\"\"", + "", + "import sys, os, types, time, string, socket, cPickle, cStringIO", + "", + "try:", + " import thread", + "except ImportError:", + " thread = None", + "try:", + " import inspect", + "except ImportError:", + " inspect = None", + "", + "__author__ = \"Vinay Sajip \"", + "__status__ = \"alpha\"", + "__version__ = \"0.4.1\"", + "__date__ = \"03 April 2002\"", + "", + "#---------------------------------------------------------------------------", + "# Module data", + "#---------------------------------------------------------------------------", + "", + "#", + "#_srcfile is used when walking the stack to check when we've got the first", + "# caller stack frame.", + "#If run as a script, __file__ is not bound.", + "#", + "if __name__ == \"__main__\":", + " _srcFile = None", + "else:", + " _srcfile = os.path.splitext(__file__)", + " if _srcfile[1] in [\".pyc\", \".pyo\"]:", + " _srcfile = _srcfile[0] + \".py\"", + " else:", + " _srcfile = __file__", + "", + "#", + "#_start_time is used as the base when calculating the relative time of events", + "#", + "_start_time = time.time()", + "", + "DEFAULT_TCP_LOGGING_PORT = 9020", + "DEFAULT_UDP_LOGGING_PORT = 9021", + "DEFAULT_HTTP_LOGGING_PORT = 9022", + "SYSLOG_UDP_PORT = 514", + "", + "#", + "# Default levels and level names, these can be replaced with any positive set", + "# of values having corresponding names. There is a pseudo-level, ALL, which", + "# is only really there as a lower limit for user-defined levels. Handlers and", + "# loggers are initialized with ALL so that they will log all messages, even", + "# at user-defined levels.", + "#", + "CRITICAL = 50", + "FATAL = CRITICAL", + "ERROR = 40", + "WARN = 30", + "INFO = 20", + "DEBUG = 10", + "ALL = 0", + "", + "_levelNames = {", + " CRITICAL : 'CRITICAL',", + " ERROR : 'ERROR',", + " WARN : 'WARN',", + " INFO : 'INFO',", + " DEBUG : 'DEBUG',", + " ALL : 'ALL',", + "}", + "", + "def getLevelName(lvl):", + " \"\"\"", + " Return the textual representation of logging level 'lvl'. If the level is", + " one of the predefined levels (CRITICAL, ERROR, WARN, INFO, DEBUG) then you", + " get the corresponding string. If you have associated levels with names", + " using addLevelName then the name you have associated with 'lvl' is", + " returned. Otherwise, the string \"Level %s\" % lvl is returned.", + " \"\"\"", + " return _levelNames.get(lvl, (\"Level %s\" % lvl))", + "", + "def addLevelName(lvl, levelName):", + " \"\"\"", + " Associate 'levelName' with 'lvl'. This is used when converting levels", + " to text during message formatting.", + " \"\"\"", + " _levelNames[lvl] = levelName", + "", + "#---------------------------------------------------------------------------", + "# The logging record", + "#---------------------------------------------------------------------------", + "", + "class LogRecord:", + " \"\"\"", + " LogRecord instances are created every time something is logged. They", + " contain all the information pertinent to the event being logged. The", + " main information passed in is in msg and args, which are combined", + " using msg % args to create the message field of the record. The record", + " also includes information such as when the record was created, the", + " source line where the logging call was made, and any exception", + " information to be logged.", + " \"\"\"", + " def __init__(self, name, lvl, pathname, lineno, msg, args, exc_info):", + " \"\"\"", + " Initialize a logging record with interesting information.", + " \"\"\"", + " ct = time.time()", + " self.name = name", + " self.msg = msg", + " self.args = args", + " self.level = getLevelName(lvl)", + " self.lvl = lvl", + " self.pathname = pathname", + " try:", + " self.filename = os.path.basename(pathname)", + " except:", + " self.filename = pathname", + " self.exc_info = exc_info", + " self.lineno = lineno", + " self.created = ct", + " self.msecs = (ct - long(ct)) * 1000", + " self.relativeCreated = (self.created - _start_time) * 1000", + " if thread:", + " self.thread = thread.get_ident()", + " else:", + " self.thread = None", + "", + " def __str__(self):", + " return ''%(self.name, self.lvl,", + " self.pathname, self.lineno, self.msg)", + "", + "#---------------------------------------------------------------------------", + "# Formatter classes and functions", + "#---------------------------------------------------------------------------", + "", + "class Formatter:", + " \"\"\"", + " Formatters need to know how a LogRecord is constructed. They are", + " responsible for converting a LogRecord to (usually) a string which can", + " be interpreted by either a human or an external system. The base Formatter", + " allows a formatting string to be specified. If none is supplied, the", + " default value of \"%s(message)\\\\n\" is used.", + "", + " The Formatter can be initialized with a format string which makes use of", + " knowledge of the LogRecord attributes - e.g. the default value mentioned", + " above makes use of the fact that the user's message and arguments are pre-", + " formatted into a LogRecord's message attribute. Currently, the useful", + " attributes in a LogRecord are described by:", + "", + " %(name)s Name of the logger (logging channel)", + " %(lvl)s Numeric logging level for the message (DEBUG, INFO,", + " WARN, ERROR, CRITICAL)", + " %(level)s Text logging level for the message (\"DEBUG\", \"INFO\",", + " \"WARN\", \"ERROR\", \"CRITICAL\")", + " %(pathname)s Full pathname of the source file where the logging", + " call was issued (if available)", + " %(filename)s Filename portion of pathname", + " %(lineno)d Source line number where the logging call was issued", + " (if available)", + " %(created)f Time when the LogRecord was created (time.time()", + " return value)", + " %(asctime)s textual time when the LogRecord was created", + " %(msecs)d Millisecond portion of the creation time", + " %(relativeCreated)d Time in milliseconds when the LogRecord was created,", + " relative to the time the logging module was loaded", + " (typically at application startup time)", + " %(thread)d Thread ID (if available)", + " %(message)s The result of msg % args, computed just as the", + " record is emitted", + " %(msg)s The raw formatting string provided by the user", + " %(args)r The argument tuple which goes with the formatting", + " string in the msg attribute", + " \"\"\"", + " def __init__(self, fmt=None, datefmt=None):", + " \"\"\"", + " Initialize the formatter either with the specified format string, or a", + " default as described above. Allow for specialized date formatting with", + " the optional datefmt argument (if omitted, you get the ISO8601 format).", + " \"\"\"", + " if fmt:", + " self._fmt = fmt", + " else:", + " self._fmt = \"%(message)s\"", + " self.datefmt = datefmt", + "", + " def formatTime(self, record, datefmt=None):", + " \"\"\"", + " This method should be called from format() by a formatter which", + " wants to make use of a formatted time. This method can be overridden", + " in formatters to provide for any specific requirement, but the", + " basic behaviour is as follows: if datefmt (a string) is specfied,", + " it is used with time.strftime to format the creation time of the", + " record. Otherwise, the ISO8601 format is used. The resulting", + " string is written to the asctime attribute of the record.", + " \"\"\"", + " ct = record.created", + " if datefmt:", + " s = time.strftime(datefmt, time.localtime(ct))", + " else:", + " t = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime(ct))", + " s = \"%s,%03d\" % (t, record.msecs)", + " record.asctime = s", + "", + " def formatException(self, ei):", + " \"\"\"", + " Format the specified exception information as a string. This", + " default implementation just uses traceback.print_exception()", + " \"\"\"", + " import traceback", + " sio = cStringIO.StringIO()", + " traceback.print_exception(ei[0], ei[1], ei[2], None, sio)", + " s = sio.getvalue()", + " sio.close()", + " return s", + "", + " def format(self, record):", + " \"\"\"", + " The record's attribute dictionary is used as the operand to a", + " string formatting operation which yields the returned string.", + " Before formatting the dictionary, a couple of preparatory steps", + " are carried out. The message attribute of the record is computed", + " using msg % args. If the formatting string contains \"(asctime)\",", + " formatTime() is called to format the event time. If there is", + " exception information, it is formatted using formatException()", + " and appended to the message.", + " \"\"\"", + " record.message = record.msg % record.args", + " if string.find(self._fmt,\"(asctime)\") > 0:", + " self.formatTime(record, self.datefmt)", + " s = self._fmt % record.__dict__", + " if record.exc_info:", + " if s[-1] != \"\\n\":", + " s = s + \"\\n\"", + " s = s + self.formatException(record.exc_info)", + " return s", + "", + "#", + "# The default formatter to use when no other is specified", + "#", + "_defaultFormatter = Formatter()", + "", + "class BufferingFormatter:", + " \"\"\"", + " A formatter suitable for formatting a number of records.", + " \"\"\"", + " def __init__(self, linefmt=None):", + " \"\"\"", + " Optionally specify a formatter which will be used to format each", + " individual record.", + " \"\"\"", + " if linefmt:", + " self.linefmt = linefmt", + " else:", + " self.linefmt = _defaultFormatter", + "", + " def formatHeader(self, records):", + " \"\"\"", + " Return the header string for the specified records.", + " \"\"\"", + " return \"\"", + "", + " def formatFooter(self, records):", + " \"\"\"", + " Return the footer string for the specified records.", + " \"\"\"", + " return \"\"", + "", + " def format(self, records):", + " \"\"\"", + " Format the specified records and return the result as a string.", + " \"\"\"", + " rv = \"\"", + " if len(records) > 0:", + " rv = rv + self.formatHeader(records)", + " for record in records:", + " rv = rv + self.linefmt.format(record)", + " rv = rv + self.formatFooter(records)", + " return rv", + "", + "#---------------------------------------------------------------------------", + "# Filter classes and functions", + "#---------------------------------------------------------------------------", + "", + "class Filter:", + " \"\"\"", + " The base filter class. This class never filters anything, acting as", + " a placeholder which defines the Filter interface. Loggers and Handlers", + " can optionally use Filter instances to filter records as desired.", + " \"\"\"", + " def filter(self, record):", + " \"\"\"", + " Is the specified record to be logged? Returns a boolean value.", + " \"\"\"", + " return 1", + "", + "class Filterer:", + " \"\"\"", + " A base class for loggers and handlers which allows them to share", + " common code.", + " \"\"\"", + " def __init__(self):", + " self.filters = []", + "", + " def addFilter(self, filter):", + " \"\"\"", + " Add the specified filter to this handler.", + " \"\"\"", + " if not (filter in self.filters):", + " self.filters.append(filter)", + "", + " def removeFilter(self, filter):", + " \"\"\"", + " Remove the specified filter from this handler.", + " \"\"\"", + " if filter in self.filters:", + " self.filters.remove(filter)", + "", + " def filter(self, record):", + " \"\"\"", + " Determine if a record is loggable by consulting all the filters. The", + " default is to allow the record to be logged; any filter can veto this", + " and the record is then dropped. Returns a boolean value.", + " \"\"\"", + " rv = 1", + " for f in self.filters:", + " if not f.filter(record):", + " rv = 0", + " break", + " return rv", + "", + "#---------------------------------------------------------------------------", + "# Handler classes and functions", + "#---------------------------------------------------------------------------", + "", + "_handlers = {} #repository of handlers (for flushing when shutdown called)", + "", + "class Handler(Filterer):", + " \"\"\"", + " The base handler class. Acts as a placeholder which defines the Handler", + " interface. Handlers can optionally use Formatter instances to format", + " records as desired. By default, no formatter is specified; in this case,", + " the 'raw' message as determined by record.message is logged.", + " \"\"\"", + " def __init__(self, level=0):", + " \"\"\"", + " Initializes the instance - basically setting the formatter to None", + " and the filter list to empty.", + " \"\"\"", + " Filterer.__init__(self)", + " self.level = level", + " self.formatter = None", + " _handlers[self] = 1", + "", + " def setLevel(self, lvl):", + " \"\"\"", + " Set the logging level of this handler.", + " \"\"\"", + " self.level = lvl", + "", + " def format(self, record):", + " \"\"\"", + " Do formatting for a record - if a formatter is set, use it.", + " Otherwise, use the default formatter for the module.", + " \"\"\"", + " if self.formatter:", + " fmt = self.formatter", + " else:", + " fmt = _defaultFormatter", + " return fmt.format(record)", + "", + " def emit(self, record):", + " \"\"\"", + " Do whatever it takes to actually log the specified logging record.", + " This version is intended to be implemented by subclasses and so", + " raises a NotImplementedError.", + " \"\"\"", + " raise NotImplementedError, 'emit must be implemented '\\", + " 'by Handler subclasses'", + "", + " def handle(self, record):", + " \"\"\"", + " Conditionally handle the specified logging record, depending on", + " filters which may have been added to the handler.", + " \"\"\"", + " if self.filter(record):", + " self.emit(record)", + "", + " def setFormatter(self, fmt):", + " \"\"\"", + " Set the formatter for this handler.", + " \"\"\"", + " self.formatter = fmt", + "", + " def flush(self):", + " \"\"\"", + " Ensure all logging output has been flushed. This version does", + " nothing and is intended to be implemented by subclasses.", + " \"\"\"", + " pass", + "", + " def close(self):", + " \"\"\"", + " Tidy up any resources used by the handler. This version does", + " nothing and is intended to be implemented by subclasses.", + " \"\"\"", + " pass", + "", + " def handleError(self):", + " \"\"\"", + " This method should be called from handlers when an exception is", + " encountered during an emit() call. By default it does nothing,", + " which means that exceptions get silently ignored. This is what is", + " mostly wanted for a logging system - most users will not care", + " about errors in the logging system, they are more interested in", + " application errors. You could, however, replace this with a custom", + " handler if you wish.", + " \"\"\"", + " #import traceback", + " #ei = sys.exc_info()", + " #traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)", + " #del ei", + " pass", + "", + "class StreamHandler(Handler):", + " \"\"\"", + " A handler class which writes logging records, appropriately formatted,", + " to a stream. Note that this class does not close the stream, as", + " sys.stdout or sys.stderr may be used.", + " \"\"\"", + " def __init__(self, strm=None):", + " \"\"\"", + " If strm is not specified, sys.stderr is used.", + " \"\"\"", + " Handler.__init__(self)", + " if not strm:", + " strm = sys.stderr", + " self.stream = strm", + " self.formatter = None", + "", + " def flush(self):", + " \"\"\"", + " Flushes the stream.", + " \"\"\"", + " self.stream.flush()", + "", + " def emit(self, record):", + " \"\"\"", + " If a formatter is specified, it is used to format the record.", + " The record is then written to the stream with a trailing newline", + " [N.B. this may be removed depending on feedback]. If exception", + " information is present, it is formatted using", + " traceback.print_exception and appended to the stream.", + " \"\"\"", + " try:", + " msg = self.format(record)", + " self.stream.write(\"%s\\n\" % msg)", + " self.flush()", + " except:", + " self.handleError()", + "", + "class FileHandler(StreamHandler):", + " \"\"\"", + " A handler class which writes formatted logging records to disk files.", + " \"\"\"", + " def __init__(self, filename, mode=\"a+\"):", + " \"\"\"", + " Open the specified file and use it as the stream for logging.", + " By default, the file grows indefinitely. You can call setRollover()", + " to allow the file to rollover at a predetermined size.", + " \"\"\"", + " StreamHandler.__init__(self, open(filename, mode))", + " self.max_size = 0", + " self.backup_count = 0", + " self.basefilename = filename", + " self.backup_index = 0", + " self.mode = mode", + "", + " def setRollover(self, max_size, backup_count):", + " \"\"\"", + " Set the rollover parameters so that rollover occurs whenever the", + " current log file is nearly max_size in length. If backup_count", + " is >= 1, the system will successively create new files with the", + " same pathname as the base file, but with extensions \".1\", \".2\"", + " etc. appended to it. For example, with a backup_count of 5 and a", + " base file name of \"app.log\", you would get \"app.log\", \"app.log.1\",", + " \"app.log.2\", ... through to \"app.log.5\". When the last file reaches", + " its size limit, the logging reverts to \"app.log\" which is truncated", + " to zero length. If max_size is zero, rollover never occurs.", + " \"\"\"", + " self.max_size = max_size", + " self.backup_count = backup_count", + " if max_size > 0:", + " self.mode = \"a+\"", + "", + " def doRollover(self):", + " \"\"\"", + " Do a rollover, as described in setRollover().", + " \"\"\"", + " if self.backup_index >= self.backup_count:", + " self.backup_index = 0", + " fn = self.basefilename", + " else:", + " self.backup_index = self.backup_index + 1", + " fn = \"%s.%d\" % (self.basefilename, self.backup_index)", + " self.stream.close()", + " self.stream = open(fn, \"w+\")", + "", + " def emit(self, record):", + " \"\"\"", + " Output the record to the file, catering for rollover as described", + " in setRollover().", + " \"\"\"", + " if self.max_size > 0: # are we rolling over?", + " msg = \"%s\\n\" % self.format(record)", + " if self.stream.tell() + len(msg) >= self.max_size:", + " self.doRollover()", + " StreamHandler.emit(self, record)", + "", + " def close(self):", + " \"\"\"", + " Closes the stream.", + " \"\"\"", + " self.stream.close()", + "", + "class SocketHandler(StreamHandler):", + " \"\"\"", + " A handler class which writes logging records, in pickle format, to", + " a streaming socket. The socket is kept open across logging calls.", + " If the peer resets it, an attempt is made to reconnect on the next call.", + " \"\"\"", + "", + " def __init__(self, host, port):", + " \"\"\"", + " Initializes the handler with a specific host address and port.", + " \"\"\"", + " StreamHandler.__init__(self)", + " self.host = host", + " self.port = port", + " self.sock = None", + " self.closeOnError = 1", + "", + " def makeSocket(self):", + " \"\"\"", + " A factory method which allows subclasses to define the precise", + " type of socket they want.", + " \"\"\"", + " s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)", + " s.connect((self.host, self.port))", + " return s", + "", + " def send(self, s):", + " \"\"\"", + " Send a pickled string to the socket. This function allows for", + " partial sends which can happen when the network is busy.", + " \"\"\"", + " sentsofar = 0", + " left = len(s)", + " while left > 0:", + " sent = self.sock.send(s[sentsofar:])", + " sentsofar = sentsofar + sent", + " left = left - sent", + "", + " def makePickle(self, record):", + " \"\"\"", + " Pickle the record in binary format with a length prefix.", + " \"\"\"", + " s = cPickle.dumps(record.__dict__, 1)", + " n = len(s)", + " slen = \"%c%c\" % ((n >> 8) & 0xFF, n & 0xFF)", + " return slen + s", + "", + " def handleError(self):", + " \"\"\"", + " An error has occurred during logging. Most likely cause -", + " connection lost. Close the socket so that we can retry on the", + " next event.", + " \"\"\"", + " if self.closeOnError and self.sock:", + " self.sock.close()", + " self.sock = None #try to reconnect next time", + "", + " def emit(self, record):", + " \"\"\"", + " Pickles the record and writes it to the socket in binary format.", + " If there is an error with the socket, silently drop the packet.", + " \"\"\"", + " try:", + " s = self.makePickle(record)", + " if not self.sock:", + " self.sock = self.makeSocket()", + " self.send(s)", + " except:", + " self.handleError()", + "", + " def close(self):", + " \"\"\"", + " Closes the socket.", + " \"\"\"", + " if self.sock:", + " self.sock.close()", + " self.sock = None", + "", + "class DatagramHandler(SocketHandler):", + " \"\"\"", + " A handler class which writes logging records, in pickle format, to", + " a datagram socket.", + " \"\"\"", + " def __init__(self, host, port):", + " \"\"\"", + " Initializes the handler with a specific host address and port.", + " \"\"\"", + " SocketHandler.__init__(self, host, port)", + " self.closeOnError = 0", + "", + " def makeSocket(self):", + " \"\"\"", + " The factory method of SocketHandler is here overridden to create", + " a UDP socket (SOCK_DGRAM).", + " \"\"\"", + " s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)", + " return s", + "", + " def sendto(self, s, addr):", + " \"\"\"", + " Send a pickled string to a socket. This function allows for", + " partial sends which can happen when the network is busy.", + " \"\"\"", + " sentsofar = 0", + " left = len(s)", + " while left > 0:", + " sent = self.sock.sendto(s[sentsofar:], addr)", + " sentsofar = sentsofar + sent", + " left = left - sent", + "", + " def emit(self, record):", + " \"\"\"", + " Pickles the record and writes it to the socket in binary format.", + " \"\"\"", + " try:", + " s = self.makePickle(record)", + " if not self.sock:", + " self.sock = self.makeSocket()", + " self.sendto(s, (self.host, self.port))", + " except:", + " self.handleError()", + "", + "class SysLogHandler(Handler):", + " \"\"\"", + " A handler class which sends formatted logging records to a syslog", + " server. Based on Sam Rushing's syslog module:", + " http://www.nightmare.com/squirl/python-ext/misc/syslog.py", + " Contributed by Nicolas Untz (after which minor refactoring changes", + " have been made).", + " \"\"\"", + "", + " # from :", + " # ======================================================================", + " # priorities/facilities are encoded into a single 32-bit quantity, where", + " # the bottom 3 bits are the priority (0-7) and the top 28 bits are the", + " # facility (0-big number). Both the priorities and the facilities map", + " # roughly one-to-one to strings in the syslogd(8) source code. This", + " # mapping is included in this file.", + " #", + " # priorities (these are ordered)", + "", + " LOG_EMERG = 0 # system is unusable", + " LOG_ALERT = 1 # action must be taken immediately", + " LOG_CRIT = 2 # critical conditions", + " LOG_ERR = 3 # error conditions", + " LOG_WARNING = 4 # warning conditions", + " LOG_NOTICE = 5 # normal but significant condition", + " LOG_INFO = 6 # informational", + " LOG_DEBUG = 7 # debug-level messages", + "", + " # facility codes", + " LOG_KERN = 0 # kernel messages", + " LOG_USER = 1 # random user-level messages", + " LOG_MAIL = 2 # mail system", + " LOG_DAEMON = 3 # system daemons", + " LOG_AUTH = 4 # security/authorization messages", + " LOG_SYSLOG = 5 # messages generated internally by syslogd", + " LOG_LPR = 6 # line printer subsystem", + " LOG_NEWS = 7 # network news subsystem", + " LOG_UUCP = 8 # UUCP subsystem", + " LOG_CRON = 9 # clock daemon", + " LOG_AUTHPRIV = 10 # security/authorization messages (private)", + "", + " # other codes through 15 reserved for system use", + " LOG_LOCAL0 = 16 # reserved for local use", + " LOG_LOCAL1 = 17 # reserved for local use", + " LOG_LOCAL2 = 18 # reserved for local use", + " LOG_LOCAL3 = 19 # reserved for local use", + " LOG_LOCAL4 = 20 # reserved for local use", + " LOG_LOCAL5 = 21 # reserved for local use", + " LOG_LOCAL6 = 22 # reserved for local use", + " LOG_LOCAL7 = 23 # reserved for local use", + "", + " priority_names = {", + " \"alert\": LOG_ALERT,", + " \"crit\": LOG_CRIT,", + " \"critical\": LOG_CRIT,", + " \"debug\": LOG_DEBUG,", + " \"emerg\": LOG_EMERG,", + " \"err\": LOG_ERR,", + " \"error\": LOG_ERR, # DEPRECATED", + " \"info\": LOG_INFO,", + " \"notice\": LOG_NOTICE,", + " \"panic\": LOG_EMERG, # DEPRECATED", + " \"warn\": LOG_WARNING, # DEPRECATED", + " \"warning\": LOG_WARNING,", + " }", + "", + " facility_names = {", + " \"auth\": LOG_AUTH,", + " \"authpriv\": LOG_AUTHPRIV,", + " \"cron\": LOG_CRON,", + " \"daemon\": LOG_DAEMON,", + " \"kern\": LOG_KERN,", + " \"lpr\": LOG_LPR,", + " \"mail\": LOG_MAIL,", + " \"news\": LOG_NEWS,", + " \"security\": LOG_AUTH, # DEPRECATED", + " \"syslog\": LOG_SYSLOG,", + " \"user\": LOG_USER,", + " \"uucp\": LOG_UUCP,", + " \"local0\": LOG_LOCAL0,", + " \"local1\": LOG_LOCAL1,", + " \"local2\": LOG_LOCAL2,", + " \"local3\": LOG_LOCAL3,", + " \"local4\": LOG_LOCAL4,", + " \"local5\": LOG_LOCAL5,", + " \"local6\": LOG_LOCAL6,", + " \"local7\": LOG_LOCAL7,", + " }", + "", + " def __init__(self, address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER):", + " \"\"\"", + " If address is not specified, UNIX socket is used.", + " If facility is not specified, LOG_USER is used.", + " \"\"\"", + " Handler.__init__(self)", + "", + " self.address = address", + " self.facility = facility", + " if type(address) == types.StringType:", + " self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)", + " self.socket.connect(address)", + " self.unixsocket = 1", + " else:", + " self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)", + " self.unixsocket = 0", + "", + " self.formatter = None", + "", + " # curious: when talking to the unix-domain '/dev/log' socket, a", + " # zero-terminator seems to be required. this string is placed", + " # into a class variable so that it can be overridden if", + " # necessary.", + " log_format_string = '<%d>%s\\000'", + "", + " def encodePriority (self, facility, priority):", + " \"\"\"", + " Encode the facility and priority. You can pass in strings or", + " integers - if strings are passed, the facility_names and", + " priority_names mapping dictionaries are used to convert them to", + " integers.", + " \"\"\"", + " if type(facility) == types.StringType:", + " facility = self.facility_names[facility]", + " if type(priority) == types.StringType:", + " priority = self.priority_names[priority]", + " return (facility << 3) | priority", + "", + " def close (self):", + " \"\"\"", + " Closes the socket.", + " \"\"\"", + " if self.unixsocket:", + " self.socket.close()", + "", + " def emit(self, record):", + " \"\"\"", + " The record is formatted, and then sent to the syslog server. If", + " exception information is present, it is NOT sent to the server.", + " \"\"\"", + " msg = self.format(record)", + " \"\"\"", + " We need to convert record level to lowercase, maybe this will", + " change in the future.", + " \"\"\"", + " msg = self.log_format_string % (", + " self.encodePriority(self.facility, string.lower(record.level)),", + " msg)", + " try:", + " if self.unixsocket:", + " self.socket.send(msg)", + " else:", + " self.socket.sendto(msg, self.address)", + " except:", + " self.handleError()", + "", + "class SMTPHandler(Handler):", + " \"\"\"", + " A handler class which sends an SMTP email for each logging event.", + " \"\"\"", + " def __init__(self, mailhost, fromaddr, toaddrs, subject):", + " \"\"\"", + " Initialize the instance with the from and to addresses and subject", + " line of the email. To specify a non-standard SMTP port, use the", + " (host, port) tuple format for the mailhost argument.", + " \"\"\"", + " Handler.__init__(self)", + " if type(mailhost) == types.TupleType:", + " host, port = mailhost", + " self.mailhost = host", + " self.mailport = port", + " else:", + " self.mailhost = mailhost", + " self.mailport = None", + " self.fromaddr = fromaddr", + " self.toaddrs = toaddrs", + " self.subject = subject", + "", + " def getSubject(self, record):", + " \"\"\"", + " If you want to specify a subject line which is record-dependent,", + " override this method.", + " \"\"\"", + " return self.subject", + "", + " def emit(self, record):", + " \"\"\"", + " Format the record and send it to the specified addressees.", + " \"\"\"", + " try:", + " import smtplib", + " port = self.mailport", + " if not port:", + " port = smtplib.SMTP_PORT", + " smtp = smtplib.SMTP(self.mailhost, port)", + " msg = self.format(record)", + " msg = \"From: %s\\r\\nTo: %s\\r\\nSubject: %s\\r\\n\\r\\n%s\" % (", + " self.fromaddr,", + " string.join(self.toaddrs, \",\"),", + " self.getSubject(record), msg", + " )", + " smtp.sendmail(self.fromaddr, self.toaddrs, msg)", + " smtp.quit()", + " except:", + " self.handleError()", + "", + "class BufferingHandler(Handler):", + " \"\"\"", + " A handler class which buffers logging records in memory. Whenever each", + " record is added to the buffer, a check is made to see if the buffer should", + " be flushed. If it should, then flush() is expected to do the needful.", + " \"\"\"", + " def __init__(self, capacity):", + " \"\"\"", + " Initialize the handler with the buffer size.", + " \"\"\"", + " Handler.__init__(self)", + " self.capacity = capacity", + " self.buffer = []", + "", + " def shouldFlush(self, record):", + " \"\"\"", + " Returns true if the buffer is up to capacity. This method can be", + " overridden to implement custom flushing strategies.", + " \"\"\"", + " return (len(self.buffer) >= self.capacity)", + "", + " def emit(self, record):", + " \"\"\"", + " Append the record. If shouldFlush() tells us to, call flush() to process", + " the buffer.", + " \"\"\"", + " self.buffer.append(record)", + " if self.shouldFlush(record):", + " self.flush()", + "", + " def flush(self):", + " \"\"\"", + " Override to implement custom flushing behaviour. This version just zaps", + " the buffer to empty.", + " \"\"\"", + " self.buffer = []", + "", + "class MemoryHandler(BufferingHandler):", + " \"\"\"", + " A handler class which buffers logging records in memory, periodically", + " flushing them to a target handler. Flushing occurs whenever the buffer", + " is full, or when an event of a certain severity or greater is seen.", + " \"\"\"", + " def __init__(self, capacity, flushLevel=ERROR, target=None):", + " \"\"\"", + " Initialize the handler with the buffer size, the level at which", + " flushing should occur and an optional target. Note that without a", + " target being set either here or via setTarget(), a MemoryHandler", + " is no use to anyone!", + " \"\"\"", + " BufferingHandler.__init__(self, capacity)", + " self.flushLevel = flushLevel", + " self.target = target", + "", + " def shouldFlush(self, record):", + " \"\"\"", + " Check for buffer full or a record at the flushLevel or higher.", + " \"\"\"", + " return (len(self.buffer) >= self.capacity) or \\", + " (record.lvl >= self.flushLevel)", + "", + " def setTarget(self, target):", + " \"\"\"", + " Set the target handler for this handler.", + " \"\"\"", + " self.target = target", + "", + " def flush(self):", + " \"\"\"", + " For a MemoryHandler, flushing means just sending the buffered", + " records to the target, if there is one. Override if you want", + " different behaviour.", + " \"\"\"", + " if self.target:", + " for record in self.buffer:", + " self.target.handle(record)", + " self.buffer = []", + "", + "class NTEventLogHandler(Handler):", + " \"\"\"", + " A handler class which sends events to the NT Event Log. Adds a", + " registry entry for the specified application name. If no dllname is", + " provided, win32service.pyd (which contains some basic message", + " placeholders) is used. Note that use of these placeholders will make", + " your event logs big, as the entire message source is held in the log.", + " If you want slimmer logs, you have to pass in the name of your own DLL", + " which contains the message definitions you want to use in the event log.", + " \"\"\"", + " def __init__(self, appname, dllname=None, logtype=\"Application\"):", + " Handler.__init__(self)", + " try:", + " import win32evtlogutil, win32evtlog", + " self.appname = appname", + " self._welu = win32evtlogutil", + " if not dllname:", + " import os", + " dllname = os.path.split(self._welu.__file__)", + " dllname = os.path.split(dllname[0])", + " dllname = os.path.join(dllname[0], r'win32service.pyd')", + " self.dllname = dllname", + " self.logtype = logtype", + " self._welu.AddSourceToRegistry(appname, dllname, logtype)", + " self.deftype = win32evtlog.EVENTLOG_ERROR_TYPE", + " self.typemap = {", + " DEBUG : win32evtlog.EVENTLOG_INFORMATION_TYPE,", + " INFO : win32evtlog.EVENTLOG_INFORMATION_TYPE,", + " WARN : win32evtlog.EVENTLOG_WARNING_TYPE,", + " ERROR : win32evtlog.EVENTLOG_ERROR_TYPE,", + " CRITICAL: win32evtlog.EVENTLOG_ERROR_TYPE,", + " }", + " except ImportError:", + " print \"The Python Win32 extensions for NT (service, event \"\\", + " \"logging) appear not to be available.\"", + " self._welu = None", + "", + " def getMessageID(self, record):", + " \"\"\"", + " Return the message ID for the event record. If you are using your", + " own messages, you could do this by having the msg passed to the", + " logger being an ID rather than a formatting string. Then, in here,", + " you could use a dictionary lookup to get the message ID. This", + " version returns 1, which is the base message ID in win32service.pyd.", + " \"\"\"", + " return 1", + "", + " def getEventCategory(self, record):", + " \"\"\"", + " Return the event category for the record. Override this if you", + " want to specify your own categories. This version returns 0.", + " \"\"\"", + " return 0", + "", + " def getEventType(self, record):", + " \"\"\"", + " Return the event type for the record. Override this if you want", + " to specify your own types. This version does a mapping using the", + " handler's typemap attribute, which is set up in __init__() to a", + " dictionary which contains mappings for DEBUG, INFO, WARN, ERROR", + " and CRITICAL. If you are using your own levels you will either need", + " to override this method or place a suitable dictionary in the", + " handler's typemap attribute.", + " \"\"\"", + " return self.typemap.get(record.lvl, self.deftype)", + "", + " def emit(self, record):", + " \"\"\"", + " Determine the message ID, event category and event type. Then", + " log the message in the NT event log.", + " \"\"\"", + " if self._welu:", + " try:", + " id = self.getMessageID(record)", + " cat = self.getEventCategory(record)", + " type = self.getEventType(record)", + " msg = self.format(record)", + " self._welu.ReportEvent(self.appname, id, cat, type, [msg])", + " except:", + " self.handleError()", + "", + " def close(self):", + " \"\"\"", + " You can remove the application name from the registry as a", + " source of event log entries. However, if you do this, you will", + " not be able to see the events as you intended in the Event Log", + " Viewer - it needs to be able to access the registry to get the", + " DLL name.", + " \"\"\"", + " #self._welu.RemoveSourceFromRegistry(self.appname, self.logtype)", + " pass", + "", + "class HTTPHandler(Handler):", + " \"\"\"", + " A class which sends records to a Web server, using either GET or", + " POST semantics.", + " \"\"\"", + " def __init__(self, host, url, method=\"GET\"):", + " \"\"\"", + " Initialize the instance with the host, the request URL, and the method", + " (\"GET\" or \"POST\")", + " \"\"\"", + " Handler.__init__(self)", + " method = string.upper(method)", + " if method not in [\"GET\", \"POST\"]:", + " raise ValueError, \"method must be GET or POST\"", + " self.host = host", + " self.url = url", + " self.method = method", + "", + " def emit(self, record):", + " \"\"\"", + " Send the record to the Web server as an URL-encoded dictionary", + " \"\"\"", + " try:", + " import httplib, urllib", + " h = httplib.HTTP(self.host)", + " url = self.url", + " data = urllib.urlencode(record.__dict__)", + " if self.method == \"GET\":", + " if (string.find(url, '?') >= 0):", + " sep = '&'", + " else:", + " sep = '?'", + " url = url + \"%c%s\" % (sep, data)", + " h.putrequest(self.method, url)", + " if self.method == \"POST\":", + " h.putheader(\"Content-length\", str(len(data)))", + " h.endheaders()", + " if self.method == \"POST\":", + " h.send(data)", + " h.getreply() #can't do anything with the result", + " except:", + " self.handleError()", + "", + "SOAP_MESSAGE = \"\"\"", + " ", + " ", + "%s", + " ", + " ", + "", + "\"\"\"", + "", + "class SOAPHandler(Handler):", + " \"\"\"", + " A class which sends records to a SOAP server.", + " \"\"\"", + " def __init__(self, host, url):", + " \"\"\"", + " Initialize the instance with the host and the request URL", + " \"\"\"", + " Handler.__init__(self)", + " self.host = host", + " self.url = url", + "", + " def emit(self, record):", + " \"\"\"", + " Send the record to the Web server as a SOAP message", + " \"\"\"", + " try:", + " import httplib, urllib", + " h = httplib.HTTP(self.host)", + " h.putrequest(\"POST\", self.url)", + " keys = record.__dict__.keys()", + " keys.sort()", + " args = \"\"", + " for key in keys:", + " v = record.__dict__[key]", + " if type(v) == types.StringType:", + " t = \"string\"", + " elif (type(v) == types.IntType) or (type(v) == types.LongType):", + " t = \"integer\"", + " elif type(v) == types.FloatType:", + " t = \"float\"", + " else:", + " t = \"string\"", + " args = args + \"%12s%s\\n\" % (\"\",", + " key, t, str(v), key)", + " data = SOAP_MESSAGE % args[:-1]", + " #print data", + " h.putheader(\"Content-type\", \"text/plain; charset=\\\"utf-8\\\"\")", + " h.putheader(\"Content-length\", str(len(data)))", + " h.endheaders()", + " h.send(data)", + " r = h.getreply() #can't do anything with the result", + " #print r", + " f = h.getfile()", + " #print f.read()", + " f.close()", + " except:", + " self.handleError()", + "", + "#---------------------------------------------------------------------------", + "# Manager classes and functions", + "#---------------------------------------------------------------------------", + "", + "class PlaceHolder:", + " \"\"\"", + " PlaceHolder instances are used in the Manager logger hierarchy to take", + " the place of nodes for which no loggers have been defined [FIXME add", + " example].", + " \"\"\"", + " def __init__(self, alogger):", + " \"\"\"", + " Initialize with the specified logger being a child of this placeholder.", + " \"\"\"", + " self.loggers = [alogger]", + "", + " def append(self, alogger):", + " \"\"\"", + " Add the specified logger as a child of this placeholder.", + " \"\"\"", + " if alogger not in self.loggers:", + " self.loggers.append(alogger)", + "", + "#", + "# Determine which class to use when instantiating loggers.", + "#", + "_loggerClass = None", + "", + "def setLoggerClass(klass):", + " \"\"\"", + " Set the class to be used when instantiating a logger. The class should", + " define __init__() such that only a name argument is required, and the", + " __init__() should call Logger.__init__()", + " \"\"\"", + " if klass != Logger:", + " if type(klass) != types.ClassType:", + " raise TypeError, \"setLoggerClass is expecting a class\"", + " if not (Logger in klass.__bases__):", + " raise TypeError, \"logger not derived from logging.Logger: \" + \\", + " klass.__name__", + " global _loggerClass", + " _loggerClass = klass", + "", + "class Manager:", + " \"\"\"", + " There is [under normal circumstances] just one Manager instance, which", + " holds the hierarchy of loggers.", + " \"\"\"", + " def __init__(self, root):", + " \"\"\"", + " Initialize the manager with the root node of the logger hierarchy.", + " \"\"\"", + " self.root = root", + " self.disable = 0", + " self.emittedNoHandlerWarning = 0", + " self.loggerDict = {}", + "", + " def getLogger(self, name):", + " \"\"\"", + " Get a logger with the specified name, creating it if it doesn't", + " yet exist. If a PlaceHolder existed for the specified name [i.e.", + " the logger didn't exist but a child of it did], replace it with", + " the created logger and fix up the parent/child references which", + " pointed to the placeholder to now point to the logger.", + " \"\"\"", + " rv = None", + " if self.loggerDict.has_key(name):", + " rv = self.loggerDict[name]", + " if isinstance(rv, PlaceHolder):", + " ph = rv", + " rv = _loggerClass(name)", + " rv.manager = self", + " self.loggerDict[name] = rv", + " self._fixupChildren(ph, rv)", + " self._fixupParents(rv)", + " else:", + " rv = _loggerClass(name)", + " rv.manager = self", + " self.loggerDict[name] = rv", + " self._fixupParents(rv)", + " return rv", + "", + " def _fixupParents(self, alogger):", + " \"\"\"", + " Ensure that there are either loggers or placeholders all the way", + " from the specified logger to the root of the logger hierarchy.", + " \"\"\"", + " name = alogger.name", + " i = string.rfind(name, \".\")", + " rv = None", + " while (i > 0) and not rv:", + " substr = name[:i]", + " if not self.loggerDict.has_key(substr):", + " self.loggerDict[name] = PlaceHolder(alogger)", + " else:", + " obj = self.loggerDict[substr]", + " if isinstance(obj, Logger):", + " rv = obj", + " else:", + " assert isinstance(obj, PlaceHolder)", + " obj.append(alogger)", + " i = string.rfind(name, \".\", 0, i - 1)", + " if not rv:", + " rv = self.root", + " alogger.parent = rv", + "", + " def _fixupChildren(self, ph, alogger):", + " \"\"\"", + " Ensure that children of the placeholder ph are connected to the", + " specified logger.", + " \"\"\"", + " for c in ph.loggers:", + " if string.find(c.parent.name, alogger.name) <> 0:", + " alogger.parent = c.parent", + " c.parent = alogger", + "", + "#---------------------------------------------------------------------------", + "# Logger classes and functions", + "#---------------------------------------------------------------------------", + "", + "class Logger(Filterer):", + " \"\"\"", + " Instances of the Logger class represent a single logging channel.", + " \"\"\"", + " def __init__(self, name, level=0):", + " \"\"\"", + " Initialize the logger with a name and an optional level.", + " \"\"\"", + " Filterer.__init__(self)", + " self.name = name", + " self.level = level", + " self.parent = None", + " self.propagate = 1", + " self.handlers = []", + "", + " def setLevel(self, lvl):", + " \"\"\"", + " Set the logging level of this logger.", + " \"\"\"", + " self.level = lvl", + "", + "# def getRoot(self):", + "# \"\"\"", + "# Get the root of the logger hierarchy.", + "# \"\"\"", + "# return Logger.root", + "", + " def debug(self, msg, *args, **kwargs):", + " \"\"\"", + " Log 'msg % args' with severity 'DEBUG'. To pass exception information,", + " use the keyword argument exc_info with a true value, e.g.", + "", + " logger.debug(\"Houston, we have a %s\", \"thorny problem\", exc_info=1)", + " \"\"\"", + " if self.manager.disable >= DEBUG:", + " return", + " if DEBUG >= self.getEffectiveLevel():", + " apply(self._log, (DEBUG, msg, args), kwargs)", + "", + " def info(self, msg, *args, **kwargs):", + " \"\"\"", + " Log 'msg % args' with severity 'INFO'. To pass exception information,", + " use the keyword argument exc_info with a true value, e.g.", + "", + " logger.info(\"Houston, we have a %s\", \"interesting problem\", exc_info=1)", + " \"\"\"", + " if self.manager.disable >= INFO:", + " return", + " if INFO >= self.getEffectiveLevel():", + " apply(self._log, (INFO, msg, args), kwargs)", + "", + " def warn(self, msg, *args, **kwargs):", + " \"\"\"", + " Log 'msg % args' with severity 'WARN'. To pass exception information,", + " use the keyword argument exc_info with a true value, e.g.", + "", + " logger.warn(\"Houston, we have a %s\", \"bit of a problem\", exc_info=1)", + " \"\"\"", + " if self.manager.disable >= WARN:", + " return", + " if self.isEnabledFor(WARN):", + " apply(self._log, (WARN, msg, args), kwargs)", + "", + " def error(self, msg, *args, **kwargs):", + " \"\"\"", + " Log 'msg % args' with severity 'ERROR'. To pass exception information,", + " use the keyword argument exc_info with a true value, e.g.", + "", + " logger.error(\"Houston, we have a %s\", \"major problem\", exc_info=1)", + " \"\"\"", + " if self.manager.disable >= ERROR:", + " return", + " if self.isEnabledFor(ERROR):", + " apply(self._log, (ERROR, msg, args), kwargs)", + "", + " def exception(self, msg, *args):", + " \"\"\"", + " Convenience method for logging an ERROR with exception information", + " \"\"\"", + " apply(self.error, (msg,) + args, {'exc_info': 1})", + "", + " def critical(self, msg, *args, **kwargs):", + " \"\"\"", + " Log 'msg % args' with severity 'CRITICAL'. To pass exception", + " information, use the keyword argument exc_info with a true value, e.g.", + "", + " logger.critical(\"Houston, we have a %s\", \"major disaster\", exc_info=1)", + " \"\"\"", + " if self.manager.disable >= CRITICAL:", + " return", + " if CRITICAL >= self.getEffectiveLevel():", + " apply(self._log, (CRITICAL, msg, args), kwargs)", + "", + " fatal = critical", + "", + " def log(self, lvl, msg, *args, **kwargs):", + " \"\"\"", + " Log 'msg % args' with the severity 'lvl'. To pass exception", + " information, use the keyword argument exc_info with a true value, e.g.", + " logger.log(lvl, \"We have a %s\", \"mysterious problem\", exc_info=1)", + " \"\"\"", + " if self.manager.disable >= lvl:", + " return", + " if self.isEnabledFor(lvl):", + " apply(self._log, (lvl, msg, args), kwargs)", + "", + " def findCaller(self):", + " \"\"\"", + " Find the stack frame of the caller so that we can note the source", + " file name and line number.", + " \"\"\"", + " frames = inspect.stack()[1:]", + " for f in frames:", + " if _srcfile != f[1]:", + " return (f[1], f[2])", + " return (None, None)", + "", + " def makeRecord(self, name, lvl, fn, lno, msg, args, exc_info):", + " \"\"\"", + " A factory method which can be overridden in subclasses to create", + " specialized LogRecords.", + " \"\"\"", + " return LogRecord(name, lvl, fn, lno, msg, args, exc_info)", + "", + " def _log(self, lvl, msg, args, exc_info=None):", + " \"\"\"", + " Low-level logging routine which creates a LogRecord and then calls", + " all the handlers of this logger to handle the record.", + " \"\"\"", + " if inspect:", + " fn, lno = self.findCaller()", + " else:", + " fn, lno = \"\", 0", + " if exc_info:", + " exc_info = sys.exc_info()", + " record = self.makeRecord(self.name, lvl, fn, lno, msg, args, exc_info)", + " self.handle(record)", + "", + " def handle(self, record):", + " \"\"\"", + " Call the handlers for the specified record. This method is used for", + " unpickled records received from a socket, as well as those created", + " locally. Logger-level filtering is applied.", + " \"\"\"", + " if self.filter(record):", + " self.callHandlers(record)", + "", + " def addHandler(self, hdlr):", + " \"\"\"", + " Add the specified handler to this logger.", + " \"\"\"", + " if not (hdlr in self.handlers):", + " self.handlers.append(hdlr)", + "", + " def removeHandler(self, hdlr):", + " \"\"\"", + " Remove the specified handler from this logger.", + " \"\"\"", + " if hdlr in self.handlers:", + " self.handlers.remove(hdlr)", + "", + " def callHandlers(self, record):", + " \"\"\"", + " Loop through all handlers for this logger and its parents in the", + " logger hierarchy. If no handler was found, output a one-off error", + " message. Stop searching up the hierarchy whenever a logger with the", + " \"propagate\" attribute set to zero is found - that will be the last", + " logger whose handlers are called.", + " \"\"\"", + " c = self", + " found = 0", + " while c:", + " for hdlr in c.handlers:", + " found = found + 1", + " if record.lvl >= hdlr.level:", + " hdlr.handle(record)", + " if not c.propagate:", + " c = None #break out", + " else:", + " c = c.parent", + " if (found == 0) and not self.manager.emittedNoHandlerWarning:", + " print \"No handlers could be found for logger \\\"%s\\\"\" % self.name", + " self.manager.emittedNoHandlerWarning = 1", + "", + " def getEffectiveLevel(self):", + " \"\"\"", + " Loop through this logger and its parents in the logger hierarchy,", + " looking for a non-zero logging level. Return the first one found.", + " \"\"\"", + " c = self", + " while c:", + " if c.level:", + " return c.level", + " c = c.parent", + " #print \"NCP\", self.parent", + "", + " def isEnabledFor(self, lvl):", + " \"\"\"", + " Is this logger enabled for level lvl?", + " \"\"\"", + " if self.manager.disable >= lvl:", + " return 0", + " return lvl >= self.getEffectiveLevel()", + "", + "class RootLogger(Logger):", + " \"\"\"", + " A root logger is not that different to any other logger, except that", + " it must have a logging level and there is only one instance of it in", + " the hierarchy.", + " \"\"\"", + " def __init__(self, lvl):", + " \"\"\"", + " Initialize the logger with the name \"root\".", + " \"\"\"", + " Logger.__init__(self, \"root\", lvl)", + "", + "_loggerClass = Logger", + "", + "root = RootLogger(DEBUG)", + "Logger.root = root", + "Logger.manager = Manager(Logger.root)", + "", + "#---------------------------------------------------------------------------", + "# Configuration classes and functions", + "#---------------------------------------------------------------------------", + "", + "BASIC_FORMAT = \"%(asctime)s %(name)-19s %(level)-5s - %(message)s\"", + "", + "def basicConfig():", + " \"\"\"", + " Do basic configuration for the logging system by creating a", + " StreamHandler with a default Formatter and adding it to the", + " root logger.", + " \"\"\"", + " hdlr = StreamHandler()", + " fmt = Formatter(BASIC_FORMAT)", + " hdlr.setFormatter(fmt)", + " root.addHandler(hdlr)", + "", + "#def fileConfig(fname):", + "# \"\"\"", + "# The old implementation - using dict-based configuration files.", + "# Read the logging configuration from a file. Keep it simple for now.", + "# \"\"\"", + "# file = open(fname, \"r\")", + "# data = file.read()", + "# file.close()", + "# dict = eval(data)", + "# handlers = dict.get(\"handlers\", [])", + "# loggers = dict.get(\"loggers\", [])", + "# formatters = dict.get(\"formatters\", [])", + "# for f in formatters:", + "# fd = dict[f]", + "# fc = fd.get(\"class\", \"logging.Formatter\")", + "# args = fd.get(\"args\", ())", + "# fc = eval(fc)", + "# try:", + "# fmt = apply(fc, args)", + "# except:", + "# print fc, args", + "# raise", + "# dict[f] = fmt", + "#", + "# for h in handlers:", + "# hd = dict[h]", + "# hc = hd.get(\"class\", \"logging.StreamHandler\")", + "# args = hd.get(\"args\", ())", + "# hc = eval(hc)", + "# fmt = hd.get(\"formatter\", None)", + "# if fmt:", + "# fmt = dict.get(fmt, None)", + "# try:", + "# hdlr = apply(hc, args)", + "# except:", + "# print hc, args", + "# raise", + "# if fmt:", + "# hdlr.setFormatter(fmt)", + "# dict[h] = hdlr", + "#", + "# for ln in loggers:", + "# ld = dict[ln]", + "# name = ld.get(\"name\", None)", + "# if name:", + "# logger = getLogger(name)", + "# else:", + "# logger = getRootLogger()", + "# logger.propagate = ld.get(\"propagate\", 1)", + "# hdlrs = ld.get(\"handlers\", [])", + "# for h in hdlrs:", + "# hdlr = dict.get(h, None)", + "# if hdlr:", + "# logger.addHandler(hdlr)", + "", + "def fileConfig(fname):", + " \"\"\"", + " Read the logging configuration from a ConfigParser-format file.", + " \"\"\"", + " import ConfigParser", + "", + " cp = ConfigParser.ConfigParser()", + " cp.read(fname)", + " #first, do the formatters...", + " flist = cp.get(\"formatters\", \"keys\")", + " flist = string.split(flist, \",\")", + " formatters = {}", + " for form in flist:", + " sectname = \"formatter_%s\" % form", + " fs = cp.get(sectname, \"format\", 1)", + " dfs = cp.get(sectname, \"datefmt\", 1)", + " f = Formatter(fs, dfs)", + " formatters[form] = f", + " #next, do the handlers...", + " hlist = cp.get(\"handlers\", \"keys\")", + " hlist = string.split(hlist, \",\")", + " handlers = {}", + " for hand in hlist:", + " sectname = \"handler_%s\" % hand", + " klass = cp.get(sectname, \"class\")", + " fmt = cp.get(sectname, \"formatter\")", + " lvl = cp.get(sectname, \"level\")", + " klass = eval(klass)", + " args = cp.get(sectname, \"args\")", + " args = eval(args)", + " h = apply(klass, args)", + " h.setLevel(eval(lvl))", + " h.setFormatter(formatters[fmt])", + " #temporary hack for FileHandler.", + " if klass == FileHandler:", + " maxsize = cp.get(sectname, \"maxsize\")", + " if maxsize:", + " maxsize = eval(maxsize)", + " else:", + " maxsize = 0", + " if maxsize:", + " backcount = cp.get(sectname, \"backcount\")", + " if backcount:", + " backcount = eval(backcount)", + " else:", + " backcount = 0", + " h.setRollover(maxsize, backcount)", + " handlers[hand] = h", + " #at last, the loggers...first the root...", + " llist = cp.get(\"loggers\", \"keys\")", + " llist = string.split(llist, \",\")", + " llist.remove(\"root\")", + " sectname = \"logger_root\"", + " log = root", + " lvl = cp.get(sectname, \"level\")", + " log.setLevel(eval(lvl))", + " hlist = cp.get(sectname, \"handlers\")", + " hlist = string.split(hlist, \",\")", + " for hand in hlist:", + " log.addHandler(handlers[hand])", + " #and now the others...", + " for log in llist:", + " sectname = \"logger_%s\" % log", + " qn = cp.get(sectname, \"qualname\")", + " lvl = cp.get(sectname, \"level\")", + " propagate = cp.get(sectname, \"propagate\")", + " logger = getLogger(qn)", + " logger.setLevel(eval(lvl))", + " logger.propagate = eval(propagate)", + " hlist = cp.get(sectname, \"handlers\")", + " hlist = string.split(hlist, \",\")", + " for hand in hlist:", + " logger.addHandler(handlers[hand])", + "", + "", + "#---------------------------------------------------------------------------", + "# Utility functions at module level.", + "# Basically delegate everything to the root logger.", + "#---------------------------------------------------------------------------", + "", + "def getLogger(name):", + " \"\"\"", + " Return a logger with the specified name, creating it if necessary.", + " If no name is specified, return the root logger.", + " \"\"\"", + " if name:", + " return Logger.manager.getLogger(name)", + " else:", + " return root", + "", + "def getRootLogger():", + " \"\"\"", + " Return the root logger.", + " \"\"\"", + " return root", + "", + "def critical(msg, *args, **kwargs):", + " \"\"\"", + " Log a message with severity 'CRITICAL' on the root logger.", + " \"\"\"", + " if len(root.handlers) == 0:", + " basicConfig()", + " apply(root.critical, (msg,)+args, kwargs)", + "", + "fatal = critical", + "", + "def error(msg, *args, **kwargs):", + " \"\"\"", + " Log a message with severity 'ERROR' on the root logger.", + " \"\"\"", + " if len(root.handlers) == 0:", + " basicConfig()", + " apply(root.error, (msg,)+args, kwargs)", + "", + "def exception(msg, *args):", + " \"\"\"", + " Log a message with severity 'ERROR' on the root logger,", + " with exception information.", + " \"\"\"", + " apply(error, (msg,)+args, {'exc_info': 1})", + "", + "def warn(msg, *args, **kwargs):", + " \"\"\"", + " Log a message with severity 'WARN' on the root logger.", + " \"\"\"", + " if len(root.handlers) == 0:", + " basicConfig()", + " apply(root.warn, (msg,)+args, kwargs)", + "", + "def info(msg, *args, **kwargs):", + " \"\"\"", + " Log a message with severity 'INFO' on the root logger.", + " \"\"\"", + " if len(root.handlers) == 0:", + " basicConfig()", + " apply(root.info, (msg,)+args, kwargs)", + "", + "def debug(msg, *args, **kwargs):", + " \"\"\"", + " Log a message with severity 'DEBUG' on the root logger.", + " \"\"\"", + " if len(root.handlers) == 0:", + " basicConfig()", + " apply(root.debug, (msg,)+args, kwargs)", + "", + "def disable(level):", + " \"\"\"", + " Disable all logging calls less severe than 'level'.", + " \"\"\"", + " root.manager.disable = level", + "", + "def shutdown():", + " \"\"\"", + " Perform any cleanup actions in the logging system (e.g. flushing", + " buffers). Should be called at application exit.", + " \"\"\"", + " for h in _handlers.keys():", + " h.flush()", + " h.close()", + "", + "if __name__ == \"__main__\":", + " print __doc__" + ], + "deleted": [] + } + } + ] + }, + { + "hash": "a90a991b2e0631b9d725faf1e1b7907e5e3bd645", + "msg": "auto_test now mails to the scipy-testlog mailing lists. Test files are about 350K\nright now. We'll work to short them in the future. Errors in the build process\nstill result in a mail message to tell where the build process broke.", + "author": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "committer": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "author_date": "2002-04-12T16:26:58+00:00", + "author_timezone": 0, + "committer_date": "2002-04-12T16:26:58+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "a9bd45e70717507055ab1c08dabcbddba4ab3ebb" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 90, + "insertions": 149, + "lines": 239, + "files": 1, + "dmm_unit_size": 0.28125, + "dmm_unit_complexity": 0.9375, + "dmm_unit_interfacing": 0.28125, + "modified_files": [ + { + "old_path": "scipy_distutils/auto_test.py", + "new_path": "scipy_distutils/auto_test.py", + "filename": "auto_test.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -1,3 +1,12 @@\n+\"\"\" Auto test tools for SciPy\n+\n+ Do not run this as root! If you enter something\n+ like /usr as your test directory, it'll delete\n+ /usr/bin, usr/lib, etc. So don't do it!!!\n+ \n+ \n+ Author: Eric Jones (eric@enthought.com)\n+\"\"\"\n from distutils import file_util\n from distutils import dir_util\n from distutils.errors import DistutilsFileError\n@@ -15,6 +24,8 @@\n else:\n local_repository = \"/home/shared/tarballs\"\n \n+local_mail_server = \"enthought.com\"\n+\n python_ftp_url = \"ftp://ftp.python.org/pub/python\"\n numeric_url = \"http://prdownloads.sourceforge.net/numpy\"\n f2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\n@@ -24,6 +35,7 @@\n #atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\n atlas_url = \"http://www.scipy.org/Members/eric\"\n \n+\n #-----------------------------------------------------------------------------\n # Generic installation class. \n # built to handle downloading/untarring/building/installing arbitrary software\n@@ -457,6 +469,16 @@ def copy_tree(src,dst,logger=None):\n logger.exception(\"Copy Failed\") \n raise\n \n+def remove_tree(directory,logger=None):\n+ if not logger:\n+ logger = logging\n+ logger.info(\"Removing directory tree %s\" % directory) \n+ try:\n+ dir_util.remove_tree(directory)\n+ except Exception, e: \n+ logger.exception(\"Remove failed\") \n+ raise\n+\n def remove_file(file,logger=None):\n if not logger:\n logger = logging\n@@ -564,15 +586,40 @@ def run_command(cmd,directory='.',logger=None,silent_failure = 0):\n logger.info(msg) \n if status and not silent_failure:\n logger.error('command failed with status: %d' % status) \n- #if text:\n- # logger.info('Command Output:\\n'+text)\n+ if text and not silent_failure:\n+ logger.info('Command Output:\\n'+text)\n finally:\n unchange_dir(logger)\n if status:\n- raise ValueError,'Command had non-zero exit status'\n+ raise ValueError,status\n return text \n \n+def mail_report(from_addr,to_addr,subject,mail_server,\n+ build_log, test_results,info):\n+ \n+ msg = ''\n+ msg = msg + 'To: %s\\n' % to_addr\n+ msg = msg + 'Subject: %s\\n' % subject\n+ msg = msg + '\\r\\n\\r\\n'\n+\n+ for k,v in info.items(): \n+ msg = msg + '%s: %s\\n' % (k,v)\n+ msg = msg + test_results \n+ msg = msg + '-----------------------------\\n' \n+ msg = msg + '-------- BUILD LOG -------\\n' \n+ msg = msg + '-----------------------------\\n' \n+ msg = msg + build_log\n+ print msg\n+ \n+ # mail results\n+ import smtplib \n+ server = smtplib.SMTP(mail_server) \n+ server.sendmail(from_addr, to_addr, msg)\n+ server.quit()\n+ \n+\n def full_scipy_build(build_dir = '.',\n+ test_level = 10,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n@@ -581,7 +628,14 @@ def full_scipy_build(build_dir = '.',\n \n # for now the atlas version is ignored. Only the \n # binaries for RH are supported at the moment.\n- \n+\n+ build_info = {'python_version' : python_version,\n+ 'test_level' : test_level,\n+ 'numeric_version': numeric_version,\n+ 'f2py_version' : f2py_version,\n+ 'atlas_version' : atlas_version,\n+ 'scipy_version' : scipy_version}\n+ \n dst_dir = os.path.join(build_dir,sys.platform)\n \n logger = logging.Logger(\"SciPy Test\")\n@@ -594,101 +648,99 @@ def full_scipy_build(build_dir = '.',\n stderr = logging.StreamHandler()\n stderr.setFormatter(fmt)\n logger.addHandler(stderr)\n- \n- python = python_installation(version=python_version,\n- logger = logger,\n- dst_dir = dst_dir)\n- python.install()\n- \n- python_name = python.get_exe_name()\n \n- numeric = numeric_installation(version=numeric_version,\n- dst_dir = dst_dir,\n- logger = logger,\n- python_exe=python_name)\n- numeric.install()\n- \n- f2py = f2py_installation(version=f2py_version,\n- logger = logger,\n- dst_dir = dst_dir,\n- python_exe=python_name)\n- f2py.install() \n-\n- # download files don't have a version specified \n- #lapack = lapack_installation(version='',\n- # dst_dir = dst_dir\n- # python_exe=python_name)\n- #lapack.install() \n-\n- # download files don't have a version specified \n- #blas = blas_installation(version='',\n- # logger = logger,\n- # dst_dir = dst_dir,\n- # python_exe=python_name)\n- #blas.install() \n- \n- # ATLAS\n- atlas = atlas_installation(version=atlas_version,\n- logger = logger,\n- dst_dir = dst_dir,\n- python_exe=python_name)\n- atlas.install()\n- \n- # version not currently used -- need to fix this.\n- scipy = scipy_installation(version=scipy_version,\n- logger = logger,\n- dst_dir = dst_dir,\n- python_exe=python_name)\n- scipy.install() \n-\n- # The change to tmp makes sure there isn't a scipy directory in \n- # the local scope.\n- # All tests are run.\n- lvl = 1\n- cmd = python_name + ' -c \"import sys,scipy;suite=scipy.test(%d);\"' % lvl\n- test_results = run_command(cmd, logger=logger,\n- directory = tempfile.gettempdir())\n- \n- vitals = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n- numeric_version,scipy_version) \n- \n- msg = 'From: scipy-test@enthought.com\\n'\n- msg = msg + 'To: knucklehead@enthought.com\\n'\n- msg = msg + 'Subject: %s\\n' % vitals\n- msg = msg + '\\r\\n\\r\\n'\n- msg = msg + 'platform: %s,%s\\n' % (sys.platform,os.name)\n- msg = msg + 'python_version: %s\\n' % python_version\n- msg = msg + 'numeric_version: %s\\n' % numeric_version\n- msg = msg + 'f2py_version: %s\\n' % f2py_version\n- msg = msg + 'atlas_version(hard coded): %s\\n' % atlas_version\n- msg = msg + 'scipy_version: %s\\n' % scipy_version\n- msg = msg + test_results \n- msg = msg + '-----------------------------\\n' \n- msg = msg + '-------- BUILD LOG -------\\n' \n- msg = msg + '-----------------------------\\n' \n- msg = msg + log_stream.getvalue()\n- # mail results\n- import smtplib \n- toaddrs = \"eric@enthought.com\"\n- fromaddr = \"eric@enthought.com\"\n- server = smtplib.SMTP('enthought.com') \n- server.sendmail(fromaddr, toaddrs, msg)\n- server.quit()\n- print msg\n+ try:\n+ try: \n+ \n+ # before doing anything, we need to wipe the \n+ # /bin, /lib, /man, and /include directories\n+ # in dst_dir. Don't run as root.\n+ change_dir(dst_dir , logger)\n+ remove_tree('bin' , logger)\n+ remove_tree('lib' , logger)\n+ remove_tree('man' , logger)\n+ remove_tree('include', logger)\n+ unchange_dir(logger)\n+ \n+ python = python_installation(version=python_version,\n+ logger = logger,\n+ dst_dir = dst_dir)\n+ python.install()\n+ \n+ python_name = python.get_exe_name()\n+ \n+ numeric = numeric_installation(version=numeric_version,\n+ dst_dir = dst_dir,\n+ logger = logger,\n+ python_exe=python_name)\n+ numeric.install()\n+ \n+ f2py = f2py_installation(version=f2py_version,\n+ logger = logger,\n+ dst_dir = dst_dir,\n+ python_exe=python_name)\n+ f2py.install() \n+ \n+ # download files don't have a version specified \n+ #lapack = lapack_installation(version='',\n+ # dst_dir = dst_dir\n+ # python_exe=python_name)\n+ #lapack.install() \n+ \n+ # download files don't have a version specified \n+ #blas = blas_installation(version='',\n+ # logger = logger,\n+ # dst_dir = dst_dir,\n+ # python_exe=python_name)\n+ #blas.install() \n+ \n+ # ATLAS\n+ atlas = atlas_installation(version=atlas_version,\n+ logger = logger,\n+ dst_dir = dst_dir,\n+ python_exe=python_name)\n+ atlas.install()\n+ \n+ # version not currently used -- need to fix this.\n+ scipy = scipy_installation(version=scipy_version,\n+ logger = logger,\n+ dst_dir = dst_dir,\n+ python_exe=python_name)\n+ scipy.install() \n+ \n+ # The change to tmp makes sure there isn't a scipy directory in \n+ # the local scope.\n+ # All tests are run.\n+ cmd = python_name +' -c \"import sys,scipy;suite=scipy.test(%d);\"'\\\n+ % test_level\n+ test_results = run_command(cmd, logger=logger,\n+ directory = tempfile.gettempdir())\n+ build_info['results'] = 'test completed (check below for pass/fail)'\n+ except Exception, msg:\n+ test_results = ''\n+ build_info['results'] = 'build failed: %s' % msg\n+ finally: \n+ to_addr = \"scipy-testlog@scipy.org\"\n+ from_addr = \"scipy-test@enthought.com\"\n+ subject = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n+ numeric_version,scipy_version) \n+ build_log = log_stream.getvalue()\n+ mail_report(from_addr,to_addr,subject,local_mail_server,\n+ build_log,test_results,build_info)\n \n- \n if __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n-\n+ level = 10\n full_scipy_build(build_dir = build_dir,\n+ test_level = level,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n-\n # an older python\n full_scipy_build(build_dir = build_dir,\n+ test_level = level,\n python_version = '2.1.3',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n@@ -697,29 +749,36 @@ def full_scipy_build(build_dir = '.',\n \n # an older numeric\n full_scipy_build(build_dir = build_dir,\n+ test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.3',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n \n+ # This fails because multiarray doesn't have \n+ # arange defined.\n full_scipy_build(build_dir = build_dir,\n+ test_level = level,\n python_version = '2.1.3',\n- numeric_version = '20.0',\n+ numeric_version = '20.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n \n full_scipy_build(build_dir = build_dir,\n+ test_level = level,\n python_version = '2.1.3',\n- numeric_version = '19.0',\n+ numeric_version = '19.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n \n full_scipy_build(build_dir = build_dir,\n+ test_level = level,\n python_version = '2.1.3',\n- numeric_version = '18.0',\n+ numeric_version = '18.4.1',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n+\n", + "added_lines": 149, + "deleted_lines": 90, + "source_code": "\"\"\" Auto test tools for SciPy\n\n Do not run this as root! If you enter something\n like /usr as your test directory, it'll delete\n /usr/bin, usr/lib, etc. So don't do it!!!\n \n \n Author: Eric Jones (eric@enthought.com)\n\"\"\"\nfrom distutils import file_util\nfrom distutils import dir_util\nfrom distutils.errors import DistutilsFileError\n#import tarfile\nimport sys, os, stat, time\nimport gzip\nimport tempfile, cStringIO\nimport urllib\nimport logging\n\nif sys.platform == 'cygwin':\n local_repository = \"/cygdrive/i/tarballs\"\nelif sys.platform == 'win32': \n local_repository = \"i:\\tarballs\"\nelse:\n local_repository = \"/home/shared/tarballs\"\n\nlocal_mail_server = \"enthought.com\"\n\npython_ftp_url = \"ftp://ftp.python.org/pub/python\"\nnumeric_url = \"http://prdownloads.sourceforge.net/numpy\"\nf2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\nscipy_url = \"ftp://www.scipy.org/pub\"\nblas_url = \"http://www.netlib.org/blas\"\nlapack_url = \"http://www.netlib.org/lapack\"\n#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\natlas_url = \"http://www.scipy.org/Members/eric\"\n\n\n#-----------------------------------------------------------------------------\n# Generic installation class. \n# built to handle downloading/untarring/building/installing arbitrary software\n#-----------------------------------------------------------------------------\n\nclass package_installation: \n def __init__(self,version='', dst_dir = '.',\n logger = None, python_exe='python'):\n #---------------------------------------------------------------------\n # These should be defined in sub-class before calling this\n # constructor\n #---------------------------------------------------------------------\n # \n #self.package_url -- The name of the url where tarball can be found.\n #self.package_base_name -- The base name of the source tarball.\n #self.package_dir_name -- Top level directory of unpacked tarball\n #self.tarball_suffix -- usually tar.gz or .tgz\n #self.build_type -- 'make' or 'setup' for makefile or python setup file\n \n # Version of the software package.\n self.version = version\n\n # Only used by packages built with setup.py\n self.python_exe = python_exe\n \n # Directory where package is unpacked/built/installed\n self.dst_dir = os.path.abspath(dst_dir) \n \n # make sure the destination exists\n dir_util.mkpath(self.dst_dir)\n \n if not logger:\n self.logger = logging\n else:\n self.logger = logger \n\n # Construct any derived names built from the above names.\n self.init_names()\n \n def init_names(self): \n self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)\n self.tarball = self.package_base_name + '.' + self.tarball_suffix\n\n def get_source(self):\n \"\"\" Grab the source tarball from a repository.\n \n Try a local repository first. If the file isn't found,\n grab it from an ftp site.\n \"\"\"\n local_found = 0\n if self.local_source_up_to_date():\n try:\n self.get_source_local()\n local_found = 1 \n except DistutilsFileError:\n pass\n \n if not local_found:\n self.get_source_ftp()\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n return 1\n \n def get_source_local(self):\n \"\"\" Grab the requested tarball from a local repository of source\n tarballs. If it doesn't exist, an error is raised.\n \"\"\"\n file = os.path.join(local_repository,self.tarball) \n dst_file = os.path.join(self.dst_dir,self.tarball)\n self.logger.info(\"Searching local repository for %s\" % file)\n try:\n copy_file(file,dst_file,self.logger)\n except DistutilsFileError, msg:\n self.logger.info(\"Not found:\",msg)\n raise\n \n def get_source_ftp(self):\n \"\"\" Grab requested tarball from a ftp site specified as a url. \n \"\"\"\n url = '/'.join([self.package_url,self.tarball])\n \n self.logger.info('Opening: %s' % url)\n f = urllib.urlopen(url)\n self.logger.info('Downloading: this may take a while')\n contents = f.read(-1)\n f.close()\n self.logger.info('Finished download (size=%d)' % len(contents))\n \n output_file = os.path.join(self.dst_dir,self.tarball)\n write_file(output_file,contents,self.logger)\n\n # Put file in local repository so we don't have to download it again.\n self.logger.info(\"Caching file in repository\" )\n src_file = output_file\n repos_file = os.path.join(local_repository,self.tarball) \n copy_file(src_file,repos_file,self.logger)\n\n def unpack_source(self,sub_dir = None):\n \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir\n \"\"\" \n tarfile = os.path.join(self.dst_dir,self.tarball)\n old_dir = None\n \n # copy and move into sub directory if it is specified.\n if sub_dir:\n dst_dir = os.path.join(self.dst_dir,sub_dir)\n dst_file = os.path.join(dst_dir,self.tarball)\n copy_file(tarfile,dst_file)\n change_dir(dst_dir,self.logger)\n try:\n try:\n # occasionally the tarball is not zipped, try this first.\n untar_file(self.tarball,self.dst_dir,\n self.logger,silent_failure=1)\n except:\n # otherwise, handle the fact that it is zipped \n dst = os.path.join(self.dst_dir,'tmp.tar') \n decompress_file(tarfile,dst,self.logger) \n untar_file(dst,self.dst_dir,self.logger)\n remove_file(dst,self.logger)\n finally:\n if old_dir:\n unchange_dir(self.logger)\n\n def auto_configure(self):\n cmd = os.path.join('.','configure')\n text = run_command(cmd,self.package_dir,self.logger)\n\n def build_with_make(self):\n cmd = 'make'\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, prefix = None):\n if prefix is None:\n prefix = os.path.abspath(self.dst_dir)\n cmd = 'make install prefix=%s' % prefix\n text = run_command(cmd,self.package_dir,self.logger)\n\n def python_setup(self):\n cmd = self.python_exe + ' setup.py install'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def _make(self,**kw):\n \"\"\" This generally needs to be overrridden in the derived class,\n but this will suffice for the standard configure/make process. \n \"\"\"\n self.get_source()\n self.unpack_source()\n self.auto_configure()\n self.build_with_make()\n self.install_with_make()\n\n def _setup(self):\n \"\"\" Build with Python setup script.\n \"\"\"\n self.get_source()\n self.unpack_source()\n self.python_setup()\n\n def install(self):\n self.logger.info('####### Building: %s' % self.package_base_name)\n self.logger.info(' Version: %s' % self.version)\n self.logger.info(' Url: %s' % self.package_url)\n self.logger.info(' Install dir: %s' % self.dst_dir)\n self.logger.info(' Package dir: %s' % self.package_dir)\n self.logger.info(' Suffix: %s' % self.tarball_suffix)\n self.logger.info(' Build type: %s' % self.build_type)\n if self.build_type == 'setup':\n self._setup()\n else: \n self._make()\n self.logger.info('####### Finished Building: %s' % self.package_base_name) \n \n#-----------------------------------------------------------------------------\n# Installation class for Python itself.\n#-----------------------------------------------------------------------------\n \nclass python_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Python. \n self.package_base_name = 'Python-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = '/'.join([python_ftp_url,version])\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def write_install_config(self): \n \"\"\" Make doesn't seem to install scripts in the correct places.\n \n Writing this to the python directory will solve the problem.\n [install_script]\n install-dir= \n \"\"\"\n text = \"[install_scripts]\\n\"\\\n \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n file = os.path.join(self.package_dir,'setup.cfg') \n write_file(file,text,self.logger,mode='w')\n\n def install_with_make(self):\n \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n file is written to force installation in the correct place.\n \"\"\"\n self.write_install_config()\n package_installation.install_with_make(self)\n\n def get_exe_name(self):\n pyname = os.path.join('.','python')\n cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"\n text = run_command(cmd,self.package_dir,self.logger)\n exe = os.path.join(self.dst_dir,'bin','python'+text)\n return exe\n\n#-----------------------------------------------------------------------------\n# Installation class for Blas.\n#-----------------------------------------------------------------------------\n\nclass blas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for for \"slow\" blas\n self.package_base_name = 'blas'\n self.package_dir_name = 'BLAS'\n self.package_url = blas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def unpack_source(self,subdir=None):\n \"\"\" Dag. blas.tgz doesn't have directory information -- its\n just a tar ball of fortran source code. untar it in the\n BLAS directory\n \"\"\"\n package_installation.unpack_source(self,self.package_dir_name)\n \n def auto_configure(self):\n # nothing to do.\n pass\n def build_with_make(self, **kw):\n libname = 'blas_LINUX.a'\n cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over. \n src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n self.logger.info(\"Installing blas\")\n copy_file(src_file,dst_file,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for Lapack.\n#-----------------------------------------------------------------------------\n\nclass lapack_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Lapack 3.0 + updates \n self.package_base_name = 'lapack'\n self.package_dir_name = 'LAPACK'\n self.package_url = lapack_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self):\n # perhaps this should actually override auto_conifgure\n # before make, we need to copy the appropriate setup file in.\n # should work anywhere g77 works...\n make_inc = 'make.inc.' + self.platform\n src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n dst_file = os.path.join(self.package_dir,'make.inc')\n copy_file(src_file,dst_file,self.logger)\n\n def build_with_make(self, **kw):\n cmd = 'make install lapacklib'\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over.\n src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','liblapack.a')\n self.logger.info(\"Installing lapack\")\n copy_file(src_file,dst_file,self.logger)\n \n#-----------------------------------------------------------------------------\n# Installation class for Numeric\n#-----------------------------------------------------------------------------\n\nclass numeric_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'Numeric-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = numeric_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for f2py\n#-----------------------------------------------------------------------------\n\nclass f2py_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Typical file format: F2PY-2.13.175-1250.tar.gz\n self.package_base_name = 'F2PY-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = f2py_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for Atlas.\n# This is a binary install *NOT* a source install.\n# The source install is a pain to automate.\n#-----------------------------------------------------------------------------\n\nclass atlas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n #self.package_base_name = 'atlas' + version\n #self.package_dir_name = 'ATLAS'\n self.package_base_name = 'atlas-RH7.1-PIII'\n self.package_dir_name = 'atlas'\n self.package_url = atlas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self,**kw):\n pass\n def build_with_make(self,**kw):\n pass\n def install_with_make(self, **kw):\n # just copy the tree over.\n dst = os.path.join(self.dst_dir,'lib','atlas')\n self.logger.info(\"Installing Atlas\")\n copy_tree(self.package_dir,dst,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for scipy\n#-----------------------------------------------------------------------------\n\nclass scipy_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'scipy_snapshot'\n self.package_dir_name = 'scipy'\n self.package_url = scipy_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'setup'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n file = os.path.join(local_repository,self.tarball)\n up_to_date = 0\n try:\n file_time = os.stat(file)[stat.ST_MTIME] \n fyear,fmonth,fday = time.localtime(file_time)[:3]\n year,month,day = time.localtime()[:3]\n if year == year and month == month and day == day:\n up_to_date = 1\n self.logger.info(\"Repository file up to date: %s\" % file)\n except OSError, msg:\n pass\n return up_to_date\n \n#-----------------------------------------------------------------------------\n# Utilities\n#-----------------------------------------------------------------------------\n\n\n#if os.name == 'nt':\n# def exec_command(command):\n# \"\"\" not sure how to get exit status on nt. \"\"\"\n# in_pipe,out_pipe = os.popen4(command)\n# in_pipe.close()\n# text = out_pipe.read()\n# return 0, text\n#else:\n# import commands\n# exec_command = commands.getstatusoutput\n \n# This may not work on Win98... The above stuff was to handle these machines.\nimport commands\nexec_command = commands.getstatusoutput\n\ndef copy_file(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying %s->%s\" % (src,dst)) \n try:\n file_util.copy_file(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef copy_tree(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying directory tree %s->%s\" % (src,dst)) \n try:\n dir_util.copy_tree(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef remove_tree(directory,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Removing directory tree %s\" % directory) \n try:\n dir_util.remove_tree(directory)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef remove_file(file,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Remove file %s\" % file) \n try:\n os.remove(file)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef write_file(file,contents,logger=None,mode='wb'):\n if not logger:\n logger = logging\n logger.info('Write file: %s' % file)\n try:\n new_file = open(file,mode)\n new_file.write(contents)\n new_file.close()\n except Exception, e: \n logger.exception(\"Write failed\") \n raise\n\n# I know, I know...\nold_dir = []\n\ndef change_dir(d, logger = None):\n if not logger:\n logger = logging\n global old_dir \n cwd = os.getcwd() \n old_dir.append(cwd)\n d = os.path.abspath(d)\n if d != old_dir[-1]:\n logger.info(\"Change directory: %s\" % d) \n try:\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n #if d == '.':\n # import sys,traceback\n # f = sys._getframe()\n # traceback.print_stack(f)\n\ndef unchange_dir(logger=None):\n if not logger:\n logger = logging \n global old_dir\n try:\n cwd = os.getcwd()\n d = old_dir.pop(-1) \n try:\n if d != cwd:\n logger.info(\"Change directory : %s\" % d)\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n except IndexError:\n logger.exception(\"Change directory failed\")\n \ndef decompress_file(src,dst,logger = None):\n if not logger:\n logger = logging\n logger.info(\"Upacking %s->%s\" % (src,dst))\n try:\n f = gzip.open(src,'rb')\n contents = f.read(-1)\n f = open(dst, 'wb')\n f.write(contents)\n except Exception, e: \n logger.exception(\"Unpack failed\")\n raise \n\n \ndef untar_file(file,dst_dir='.',logger = None,silent_failure = 0): \n if not logger:\n logger = logging\n logger.info(\"Untarring file: %s\" % (file))\n try:\n run_command('tar -xf ' + file,directory = dst_dir,\n logger=logger, silent_failure = silent_failure)\n except Exception, e:\n if not silent_failure: \n logger.exception(\"Untar failed\")\n raise \n\ndef unpack_file(file,logger = None):\n \"\"\" equivalent to 'tar -xzvf file'\n \"\"\"\n dst = 'tmp.tar'\n decompress_file(file,dst,logger) \n untar_file(dst.logger)\n remove_file(dst,logger) \n\ndef run_command(cmd,directory='.',logger=None,silent_failure = 0):\n if not logger:\n logger = logging\n change_dir(directory,logger) \n try: \n msg = 'Command: %s' % cmd\n status,text = exec_command(cmd)\n if status:\n msg = msg + ' (failed)'\n logger.info(msg) \n if status and not silent_failure:\n logger.error('command failed with status: %d' % status) \n if text and not silent_failure:\n logger.info('Command Output:\\n'+text)\n finally:\n unchange_dir(logger)\n if status:\n raise ValueError,status\n return text \n\ndef mail_report(from_addr,to_addr,subject,mail_server,\n build_log, test_results,info):\n \n msg = ''\n msg = msg + 'To: %s\\n' % to_addr\n msg = msg + 'Subject: %s\\n' % subject\n msg = msg + '\\r\\n\\r\\n'\n\n for k,v in info.items(): \n msg = msg + '%s: %s\\n' % (k,v)\n msg = msg + test_results \n msg = msg + '-----------------------------\\n' \n msg = msg + '-------- BUILD LOG -------\\n' \n msg = msg + '-----------------------------\\n' \n msg = msg + build_log\n print msg\n \n # mail results\n import smtplib \n server = smtplib.SMTP(mail_server) \n server.sendmail(from_addr, to_addr, msg)\n server.quit()\n \n\ndef full_scipy_build(build_dir = '.',\n test_level = 10,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot'):\n \n # for now the atlas version is ignored. Only the \n # binaries for RH are supported at the moment.\n\n build_info = {'python_version' : python_version,\n 'test_level' : test_level,\n 'numeric_version': numeric_version,\n 'f2py_version' : f2py_version,\n 'atlas_version' : atlas_version,\n 'scipy_version' : scipy_version}\n \n dst_dir = os.path.join(build_dir,sys.platform)\n\n logger = logging.Logger(\"SciPy Test\")\n fmt = logging.Formatter(logging.BASIC_FORMAT)\n log_stream = cStringIO.StringIO()\n stream_handler = logging.StreamHandler(log_stream)\n stream_handler.setFormatter(fmt)\n logger.addHandler(stream_handler)\n # also write to stderr\n stderr = logging.StreamHandler()\n stderr.setFormatter(fmt)\n logger.addHandler(stderr)\n\n try:\n try: \n \n # before doing anything, we need to wipe the \n # /bin, /lib, /man, and /include directories\n # in dst_dir. Don't run as root.\n change_dir(dst_dir , logger)\n remove_tree('bin' , logger)\n remove_tree('lib' , logger)\n remove_tree('man' , logger)\n remove_tree('include', logger)\n unchange_dir(logger)\n \n python = python_installation(version=python_version,\n logger = logger,\n dst_dir = dst_dir)\n python.install()\n \n python_name = python.get_exe_name()\n \n numeric = numeric_installation(version=numeric_version,\n dst_dir = dst_dir,\n logger = logger,\n python_exe=python_name)\n numeric.install()\n \n f2py = f2py_installation(version=f2py_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n f2py.install() \n \n # download files don't have a version specified \n #lapack = lapack_installation(version='',\n # dst_dir = dst_dir\n # python_exe=python_name)\n #lapack.install() \n \n # download files don't have a version specified \n #blas = blas_installation(version='',\n # logger = logger,\n # dst_dir = dst_dir,\n # python_exe=python_name)\n #blas.install() \n \n # ATLAS\n atlas = atlas_installation(version=atlas_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n atlas.install()\n \n # version not currently used -- need to fix this.\n scipy = scipy_installation(version=scipy_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n scipy.install() \n \n # The change to tmp makes sure there isn't a scipy directory in \n # the local scope.\n # All tests are run.\n cmd = python_name +' -c \"import sys,scipy;suite=scipy.test(%d);\"'\\\n % test_level\n test_results = run_command(cmd, logger=logger,\n directory = tempfile.gettempdir())\n build_info['results'] = 'test completed (check below for pass/fail)'\n except Exception, msg:\n test_results = ''\n build_info['results'] = 'build failed: %s' % msg\n finally: \n to_addr = \"scipy-testlog@scipy.org\"\n from_addr = \"scipy-test@enthought.com\"\n subject = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n numeric_version,scipy_version) \n build_log = log_stream.getvalue()\n mail_report(from_addr,to_addr,subject,local_mail_server,\n build_log,test_results,build_info)\n\nif __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n level = 10\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n # an older python\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older numeric\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.3',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # This fails because multiarray doesn't have \n # arange defined.\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '19.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '18.4.1',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n", + "source_code_before": "from distutils import file_util\nfrom distutils import dir_util\nfrom distutils.errors import DistutilsFileError\n#import tarfile\nimport sys, os, stat, time\nimport gzip\nimport tempfile, cStringIO\nimport urllib\nimport logging\n\nif sys.platform == 'cygwin':\n local_repository = \"/cygdrive/i/tarballs\"\nelif sys.platform == 'win32': \n local_repository = \"i:\\tarballs\"\nelse:\n local_repository = \"/home/shared/tarballs\"\n\npython_ftp_url = \"ftp://ftp.python.org/pub/python\"\nnumeric_url = \"http://prdownloads.sourceforge.net/numpy\"\nf2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\nscipy_url = \"ftp://www.scipy.org/pub\"\nblas_url = \"http://www.netlib.org/blas\"\nlapack_url = \"http://www.netlib.org/lapack\"\n#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\natlas_url = \"http://www.scipy.org/Members/eric\"\n\n#-----------------------------------------------------------------------------\n# Generic installation class. \n# built to handle downloading/untarring/building/installing arbitrary software\n#-----------------------------------------------------------------------------\n\nclass package_installation: \n def __init__(self,version='', dst_dir = '.',\n logger = None, python_exe='python'):\n #---------------------------------------------------------------------\n # These should be defined in sub-class before calling this\n # constructor\n #---------------------------------------------------------------------\n # \n #self.package_url -- The name of the url where tarball can be found.\n #self.package_base_name -- The base name of the source tarball.\n #self.package_dir_name -- Top level directory of unpacked tarball\n #self.tarball_suffix -- usually tar.gz or .tgz\n #self.build_type -- 'make' or 'setup' for makefile or python setup file\n \n # Version of the software package.\n self.version = version\n\n # Only used by packages built with setup.py\n self.python_exe = python_exe\n \n # Directory where package is unpacked/built/installed\n self.dst_dir = os.path.abspath(dst_dir) \n \n # make sure the destination exists\n dir_util.mkpath(self.dst_dir)\n \n if not logger:\n self.logger = logging\n else:\n self.logger = logger \n\n # Construct any derived names built from the above names.\n self.init_names()\n \n def init_names(self): \n self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)\n self.tarball = self.package_base_name + '.' + self.tarball_suffix\n\n def get_source(self):\n \"\"\" Grab the source tarball from a repository.\n \n Try a local repository first. If the file isn't found,\n grab it from an ftp site.\n \"\"\"\n local_found = 0\n if self.local_source_up_to_date():\n try:\n self.get_source_local()\n local_found = 1 \n except DistutilsFileError:\n pass\n \n if not local_found:\n self.get_source_ftp()\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n return 1\n \n def get_source_local(self):\n \"\"\" Grab the requested tarball from a local repository of source\n tarballs. If it doesn't exist, an error is raised.\n \"\"\"\n file = os.path.join(local_repository,self.tarball) \n dst_file = os.path.join(self.dst_dir,self.tarball)\n self.logger.info(\"Searching local repository for %s\" % file)\n try:\n copy_file(file,dst_file,self.logger)\n except DistutilsFileError, msg:\n self.logger.info(\"Not found:\",msg)\n raise\n \n def get_source_ftp(self):\n \"\"\" Grab requested tarball from a ftp site specified as a url. \n \"\"\"\n url = '/'.join([self.package_url,self.tarball])\n \n self.logger.info('Opening: %s' % url)\n f = urllib.urlopen(url)\n self.logger.info('Downloading: this may take a while')\n contents = f.read(-1)\n f.close()\n self.logger.info('Finished download (size=%d)' % len(contents))\n \n output_file = os.path.join(self.dst_dir,self.tarball)\n write_file(output_file,contents,self.logger)\n\n # Put file in local repository so we don't have to download it again.\n self.logger.info(\"Caching file in repository\" )\n src_file = output_file\n repos_file = os.path.join(local_repository,self.tarball) \n copy_file(src_file,repos_file,self.logger)\n\n def unpack_source(self,sub_dir = None):\n \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir\n \"\"\" \n tarfile = os.path.join(self.dst_dir,self.tarball)\n old_dir = None\n \n # copy and move into sub directory if it is specified.\n if sub_dir:\n dst_dir = os.path.join(self.dst_dir,sub_dir)\n dst_file = os.path.join(dst_dir,self.tarball)\n copy_file(tarfile,dst_file)\n change_dir(dst_dir,self.logger)\n try:\n try:\n # occasionally the tarball is not zipped, try this first.\n untar_file(self.tarball,self.dst_dir,\n self.logger,silent_failure=1)\n except:\n # otherwise, handle the fact that it is zipped \n dst = os.path.join(self.dst_dir,'tmp.tar') \n decompress_file(tarfile,dst,self.logger) \n untar_file(dst,self.dst_dir,self.logger)\n remove_file(dst,self.logger)\n finally:\n if old_dir:\n unchange_dir(self.logger)\n\n def auto_configure(self):\n cmd = os.path.join('.','configure')\n text = run_command(cmd,self.package_dir,self.logger)\n\n def build_with_make(self):\n cmd = 'make'\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, prefix = None):\n if prefix is None:\n prefix = os.path.abspath(self.dst_dir)\n cmd = 'make install prefix=%s' % prefix\n text = run_command(cmd,self.package_dir,self.logger)\n\n def python_setup(self):\n cmd = self.python_exe + ' setup.py install'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def _make(self,**kw):\n \"\"\" This generally needs to be overrridden in the derived class,\n but this will suffice for the standard configure/make process. \n \"\"\"\n self.get_source()\n self.unpack_source()\n self.auto_configure()\n self.build_with_make()\n self.install_with_make()\n\n def _setup(self):\n \"\"\" Build with Python setup script.\n \"\"\"\n self.get_source()\n self.unpack_source()\n self.python_setup()\n\n def install(self):\n self.logger.info('####### Building: %s' % self.package_base_name)\n self.logger.info(' Version: %s' % self.version)\n self.logger.info(' Url: %s' % self.package_url)\n self.logger.info(' Install dir: %s' % self.dst_dir)\n self.logger.info(' Package dir: %s' % self.package_dir)\n self.logger.info(' Suffix: %s' % self.tarball_suffix)\n self.logger.info(' Build type: %s' % self.build_type)\n if self.build_type == 'setup':\n self._setup()\n else: \n self._make()\n self.logger.info('####### Finished Building: %s' % self.package_base_name) \n \n#-----------------------------------------------------------------------------\n# Installation class for Python itself.\n#-----------------------------------------------------------------------------\n \nclass python_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Python. \n self.package_base_name = 'Python-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = '/'.join([python_ftp_url,version])\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def write_install_config(self): \n \"\"\" Make doesn't seem to install scripts in the correct places.\n \n Writing this to the python directory will solve the problem.\n [install_script]\n install-dir= \n \"\"\"\n text = \"[install_scripts]\\n\"\\\n \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n file = os.path.join(self.package_dir,'setup.cfg') \n write_file(file,text,self.logger,mode='w')\n\n def install_with_make(self):\n \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n file is written to force installation in the correct place.\n \"\"\"\n self.write_install_config()\n package_installation.install_with_make(self)\n\n def get_exe_name(self):\n pyname = os.path.join('.','python')\n cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"\n text = run_command(cmd,self.package_dir,self.logger)\n exe = os.path.join(self.dst_dir,'bin','python'+text)\n return exe\n\n#-----------------------------------------------------------------------------\n# Installation class for Blas.\n#-----------------------------------------------------------------------------\n\nclass blas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for for \"slow\" blas\n self.package_base_name = 'blas'\n self.package_dir_name = 'BLAS'\n self.package_url = blas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def unpack_source(self,subdir=None):\n \"\"\" Dag. blas.tgz doesn't have directory information -- its\n just a tar ball of fortran source code. untar it in the\n BLAS directory\n \"\"\"\n package_installation.unpack_source(self,self.package_dir_name)\n \n def auto_configure(self):\n # nothing to do.\n pass\n def build_with_make(self, **kw):\n libname = 'blas_LINUX.a'\n cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over. \n src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n self.logger.info(\"Installing blas\")\n copy_file(src_file,dst_file,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for Lapack.\n#-----------------------------------------------------------------------------\n\nclass lapack_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Lapack 3.0 + updates \n self.package_base_name = 'lapack'\n self.package_dir_name = 'LAPACK'\n self.package_url = lapack_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self):\n # perhaps this should actually override auto_conifgure\n # before make, we need to copy the appropriate setup file in.\n # should work anywhere g77 works...\n make_inc = 'make.inc.' + self.platform\n src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n dst_file = os.path.join(self.package_dir,'make.inc')\n copy_file(src_file,dst_file,self.logger)\n\n def build_with_make(self, **kw):\n cmd = 'make install lapacklib'\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over.\n src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','liblapack.a')\n self.logger.info(\"Installing lapack\")\n copy_file(src_file,dst_file,self.logger)\n \n#-----------------------------------------------------------------------------\n# Installation class for Numeric\n#-----------------------------------------------------------------------------\n\nclass numeric_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'Numeric-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = numeric_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for f2py\n#-----------------------------------------------------------------------------\n\nclass f2py_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Typical file format: F2PY-2.13.175-1250.tar.gz\n self.package_base_name = 'F2PY-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = f2py_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for Atlas.\n# This is a binary install *NOT* a source install.\n# The source install is a pain to automate.\n#-----------------------------------------------------------------------------\n\nclass atlas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n #self.package_base_name = 'atlas' + version\n #self.package_dir_name = 'ATLAS'\n self.package_base_name = 'atlas-RH7.1-PIII'\n self.package_dir_name = 'atlas'\n self.package_url = atlas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self,**kw):\n pass\n def build_with_make(self,**kw):\n pass\n def install_with_make(self, **kw):\n # just copy the tree over.\n dst = os.path.join(self.dst_dir,'lib','atlas')\n self.logger.info(\"Installing Atlas\")\n copy_tree(self.package_dir,dst,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for scipy\n#-----------------------------------------------------------------------------\n\nclass scipy_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'scipy_snapshot'\n self.package_dir_name = 'scipy'\n self.package_url = scipy_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'setup'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n file = os.path.join(local_repository,self.tarball)\n up_to_date = 0\n try:\n file_time = os.stat(file)[stat.ST_MTIME] \n fyear,fmonth,fday = time.localtime(file_time)[:3]\n year,month,day = time.localtime()[:3]\n if year == year and month == month and day == day:\n up_to_date = 1\n self.logger.info(\"Repository file up to date: %s\" % file)\n except OSError, msg:\n pass\n return up_to_date\n \n#-----------------------------------------------------------------------------\n# Utilities\n#-----------------------------------------------------------------------------\n\n\n#if os.name == 'nt':\n# def exec_command(command):\n# \"\"\" not sure how to get exit status on nt. \"\"\"\n# in_pipe,out_pipe = os.popen4(command)\n# in_pipe.close()\n# text = out_pipe.read()\n# return 0, text\n#else:\n# import commands\n# exec_command = commands.getstatusoutput\n \n# This may not work on Win98... The above stuff was to handle these machines.\nimport commands\nexec_command = commands.getstatusoutput\n\ndef copy_file(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying %s->%s\" % (src,dst)) \n try:\n file_util.copy_file(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef copy_tree(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying directory tree %s->%s\" % (src,dst)) \n try:\n dir_util.copy_tree(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef remove_file(file,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Remove file %s\" % file) \n try:\n os.remove(file)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef write_file(file,contents,logger=None,mode='wb'):\n if not logger:\n logger = logging\n logger.info('Write file: %s' % file)\n try:\n new_file = open(file,mode)\n new_file.write(contents)\n new_file.close()\n except Exception, e: \n logger.exception(\"Write failed\") \n raise\n\n# I know, I know...\nold_dir = []\n\ndef change_dir(d, logger = None):\n if not logger:\n logger = logging\n global old_dir \n cwd = os.getcwd() \n old_dir.append(cwd)\n d = os.path.abspath(d)\n if d != old_dir[-1]:\n logger.info(\"Change directory: %s\" % d) \n try:\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n #if d == '.':\n # import sys,traceback\n # f = sys._getframe()\n # traceback.print_stack(f)\n\ndef unchange_dir(logger=None):\n if not logger:\n logger = logging \n global old_dir\n try:\n cwd = os.getcwd()\n d = old_dir.pop(-1) \n try:\n if d != cwd:\n logger.info(\"Change directory : %s\" % d)\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n except IndexError:\n logger.exception(\"Change directory failed\")\n \ndef decompress_file(src,dst,logger = None):\n if not logger:\n logger = logging\n logger.info(\"Upacking %s->%s\" % (src,dst))\n try:\n f = gzip.open(src,'rb')\n contents = f.read(-1)\n f = open(dst, 'wb')\n f.write(contents)\n except Exception, e: \n logger.exception(\"Unpack failed\")\n raise \n\n \ndef untar_file(file,dst_dir='.',logger = None,silent_failure = 0): \n if not logger:\n logger = logging\n logger.info(\"Untarring file: %s\" % (file))\n try:\n run_command('tar -xf ' + file,directory = dst_dir,\n logger=logger, silent_failure = silent_failure)\n except Exception, e:\n if not silent_failure: \n logger.exception(\"Untar failed\")\n raise \n\ndef unpack_file(file,logger = None):\n \"\"\" equivalent to 'tar -xzvf file'\n \"\"\"\n dst = 'tmp.tar'\n decompress_file(file,dst,logger) \n untar_file(dst.logger)\n remove_file(dst,logger) \n\ndef run_command(cmd,directory='.',logger=None,silent_failure = 0):\n if not logger:\n logger = logging\n change_dir(directory,logger) \n try: \n msg = 'Command: %s' % cmd\n status,text = exec_command(cmd)\n if status:\n msg = msg + ' (failed)'\n logger.info(msg) \n if status and not silent_failure:\n logger.error('command failed with status: %d' % status) \n #if text:\n # logger.info('Command Output:\\n'+text)\n finally:\n unchange_dir(logger)\n if status:\n raise ValueError,'Command had non-zero exit status'\n return text \n\ndef full_scipy_build(build_dir = '.',\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot'):\n \n # for now the atlas version is ignored. Only the \n # binaries for RH are supported at the moment.\n \n dst_dir = os.path.join(build_dir,sys.platform)\n\n logger = logging.Logger(\"SciPy Test\")\n fmt = logging.Formatter(logging.BASIC_FORMAT)\n log_stream = cStringIO.StringIO()\n stream_handler = logging.StreamHandler(log_stream)\n stream_handler.setFormatter(fmt)\n logger.addHandler(stream_handler)\n # also write to stderr\n stderr = logging.StreamHandler()\n stderr.setFormatter(fmt)\n logger.addHandler(stderr)\n \n python = python_installation(version=python_version,\n logger = logger,\n dst_dir = dst_dir)\n python.install()\n \n python_name = python.get_exe_name()\n\n numeric = numeric_installation(version=numeric_version,\n dst_dir = dst_dir,\n logger = logger,\n python_exe=python_name)\n numeric.install()\n \n f2py = f2py_installation(version=f2py_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n f2py.install() \n\n # download files don't have a version specified \n #lapack = lapack_installation(version='',\n # dst_dir = dst_dir\n # python_exe=python_name)\n #lapack.install() \n\n # download files don't have a version specified \n #blas = blas_installation(version='',\n # logger = logger,\n # dst_dir = dst_dir,\n # python_exe=python_name)\n #blas.install() \n \n # ATLAS\n atlas = atlas_installation(version=atlas_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n atlas.install()\n \n # version not currently used -- need to fix this.\n scipy = scipy_installation(version=scipy_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n scipy.install() \n\n # The change to tmp makes sure there isn't a scipy directory in \n # the local scope.\n # All tests are run.\n lvl = 1\n cmd = python_name + ' -c \"import sys,scipy;suite=scipy.test(%d);\"' % lvl\n test_results = run_command(cmd, logger=logger,\n directory = tempfile.gettempdir())\n \n vitals = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n numeric_version,scipy_version) \n \n msg = 'From: scipy-test@enthought.com\\n'\n msg = msg + 'To: knucklehead@enthought.com\\n'\n msg = msg + 'Subject: %s\\n' % vitals\n msg = msg + '\\r\\n\\r\\n'\n msg = msg + 'platform: %s,%s\\n' % (sys.platform,os.name)\n msg = msg + 'python_version: %s\\n' % python_version\n msg = msg + 'numeric_version: %s\\n' % numeric_version\n msg = msg + 'f2py_version: %s\\n' % f2py_version\n msg = msg + 'atlas_version(hard coded): %s\\n' % atlas_version\n msg = msg + 'scipy_version: %s\\n' % scipy_version\n msg = msg + test_results \n msg = msg + '-----------------------------\\n' \n msg = msg + '-------- BUILD LOG -------\\n' \n msg = msg + '-----------------------------\\n' \n msg = msg + log_stream.getvalue()\n # mail results\n import smtplib \n toaddrs = \"eric@enthought.com\"\n fromaddr = \"eric@enthought.com\"\n server = smtplib.SMTP('enthought.com') \n server.sendmail(fromaddr, toaddrs, msg)\n server.quit()\n print msg\n\n \nif __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n\n full_scipy_build(build_dir = build_dir,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older python\n full_scipy_build(build_dir = build_dir,\n python_version = '2.1.3',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older numeric\n full_scipy_build(build_dir = build_dir,\n python_version = '2.1.3',\n numeric_version = '20.3',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n python_version = '2.1.3',\n numeric_version = '20.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n python_version = '2.1.3',\n numeric_version = '19.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n python_version = '2.1.3',\n numeric_version = '18.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n", + "methods": [ + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 45, + "end_line": 76, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "init_names", + "long_name": "init_names( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 78, + "end_line": 80, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_source", + "long_name": "get_source( self )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 4, + "token_count": 39, + "parameters": [ + "self" + ], + "start_line": 82, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 99, + "end_line": 102, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "get_source_local", + "long_name": "get_source_local( self )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 2, + "token_count": 74, + "parameters": [ + "self" + ], + "start_line": 104, + "end_line": 115, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "get_source_ftp", + "long_name": "get_source_ftp( self )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 1, + "token_count": 136, + "parameters": [ + "self" + ], + "start_line": 117, + "end_line": 136, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , sub_dir = None )", + "filename": "auto_test.py", + "nloc": 20, + "complexity": 5, + "token_count": 153, + "parameters": [ + "self", + "sub_dir" + ], + "start_line": 138, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 165, + "end_line": 167, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 169, + "end_line": 171, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , prefix = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 2, + "token_count": 45, + "parameters": [ + "self", + "prefix" + ], + "start_line": 173, + "end_line": 177, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "python_setup", + "long_name": "python_setup( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 179, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 34, + "parameters": [ + "self", + "kw" + ], + "start_line": 183, + "end_line": 191, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "_setup", + "long_name": "_setup( self )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 21, + "parameters": [ + "self" + ], + "start_line": 193, + "end_line": 198, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 2, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 200, + "end_line": 212, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 73, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 220, + "end_line": 229, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 231, + "end_line": 241, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 243, + "end_line": 248, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_exe_name", + "long_name": "get_exe_name( self )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 56, + "parameters": [ + "self" + ], + "start_line": 250, + "end_line": 255, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 263, + "end_line": 273, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , subdir = None )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "subdir" + ], + "start_line": 275, + "end_line": 280, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 282, + "end_line": 284, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "kw" + ], + "start_line": 285, + "end_line": 288, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 290, + "end_line": 295, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 303, + "end_line": 313, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 315, + "end_line": 322, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "kw" + ], + "start_line": 324, + "end_line": 326, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 328, + "end_line": 333, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 341, + "end_line": 349, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 358, + "end_line": 367, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 378, + "end_line": 388, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 390, + "end_line": 391, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 392, + "end_line": 393, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "kw" + ], + "start_line": 394, + "end_line": 398, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 406, + "end_line": 414, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self" + ], + "start_line": 416, + "end_line": 430, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "copy_file", + "long_name": "copy_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 452, + "end_line": 460, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "copy_tree", + "long_name": "copy_tree( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 462, + "end_line": 470, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_tree", + "long_name": "remove_tree( directory , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "directory", + "logger" + ], + "start_line": 472, + "end_line": 480, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_file", + "long_name": "remove_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "file", + "logger" + ], + "start_line": 482, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_file", + "long_name": "write_file( file , contents , logger = None , mode = 'wb' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 3, + "token_count": 63, + "parameters": [ + "file", + "contents", + "logger", + "mode" + ], + "start_line": 492, + "end_line": 502, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "change_dir", + "long_name": "change_dir( d , logger = None )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 4, + "token_count": 78, + "parameters": [ + "d", + "logger" + ], + "start_line": 507, + "end_line": 520, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "unchange_dir", + "long_name": "unchange_dir( logger = None )", + "filename": "auto_test.py", + "nloc": 16, + "complexity": 5, + "token_count": 76, + "parameters": [ + "logger" + ], + "start_line": 526, + "end_line": 541, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "decompress_file", + "long_name": "decompress_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 12, + "complexity": 3, + "token_count": 77, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 543, + "end_line": 554, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "untar_file", + "long_name": "untar_file( file , dst_dir = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 4, + "token_count": 70, + "parameters": [ + "file", + "dst_dir", + "logger", + "silent_failure" + ], + "start_line": 557, + "end_line": 567, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "unpack_file", + "long_name": "unpack_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 33, + "parameters": [ + "file", + "logger" + ], + "start_line": 569, + "end_line": 575, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 19, + "complexity": 9, + "token_count": 102, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 577, + "end_line": 595, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 0 + }, + { + "name": "mail_report", + "long_name": "mail_report( from_addr , to_addr , subject , mail_server , build_log , test_results , info )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 2, + "token_count": 113, + "parameters": [ + "from_addr", + "to_addr", + "subject", + "mail_server", + "build_log", + "test_results", + "info" + ], + "start_line": 597, + "end_line": 618, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , test_level = 10 , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 72, + "complexity": 3, + "token_count": 396, + "parameters": [ + "build_dir", + "test_level", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 621, + "end_line": 729, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 109, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 33, + "end_line": 64, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "init_names", + "long_name": "init_names( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 66, + "end_line": 68, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_source", + "long_name": "get_source( self )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 4, + "token_count": 39, + "parameters": [ + "self" + ], + "start_line": 70, + "end_line": 85, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 87, + "end_line": 90, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "get_source_local", + "long_name": "get_source_local( self )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 2, + "token_count": 74, + "parameters": [ + "self" + ], + "start_line": 92, + "end_line": 103, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "get_source_ftp", + "long_name": "get_source_ftp( self )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 1, + "token_count": 136, + "parameters": [ + "self" + ], + "start_line": 105, + "end_line": 124, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , sub_dir = None )", + "filename": "auto_test.py", + "nloc": 20, + "complexity": 5, + "token_count": 153, + "parameters": [ + "self", + "sub_dir" + ], + "start_line": 126, + "end_line": 151, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 153, + "end_line": 155, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 157, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , prefix = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 2, + "token_count": 45, + "parameters": [ + "self", + "prefix" + ], + "start_line": 161, + "end_line": 165, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "python_setup", + "long_name": "python_setup( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 167, + "end_line": 169, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 34, + "parameters": [ + "self", + "kw" + ], + "start_line": 171, + "end_line": 179, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "_setup", + "long_name": "_setup( self )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 21, + "parameters": [ + "self" + ], + "start_line": 181, + "end_line": 186, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 2, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 188, + "end_line": 200, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 73, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 208, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 219, + "end_line": 229, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 231, + "end_line": 236, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_exe_name", + "long_name": "get_exe_name( self )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 56, + "parameters": [ + "self" + ], + "start_line": 238, + "end_line": 243, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 251, + "end_line": 261, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , subdir = None )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "subdir" + ], + "start_line": 263, + "end_line": 268, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 270, + "end_line": 272, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "kw" + ], + "start_line": 273, + "end_line": 276, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 278, + "end_line": 283, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 291, + "end_line": 301, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 303, + "end_line": 310, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "kw" + ], + "start_line": 312, + "end_line": 314, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 316, + "end_line": 321, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 329, + "end_line": 337, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 346, + "end_line": 355, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 366, + "end_line": 376, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 378, + "end_line": 379, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 380, + "end_line": 381, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "kw" + ], + "start_line": 382, + "end_line": 386, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 394, + "end_line": 402, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self" + ], + "start_line": 404, + "end_line": 418, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "copy_file", + "long_name": "copy_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 440, + "end_line": 448, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "copy_tree", + "long_name": "copy_tree( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 450, + "end_line": 458, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_file", + "long_name": "remove_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "file", + "logger" + ], + "start_line": 460, + "end_line": 468, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_file", + "long_name": "write_file( file , contents , logger = None , mode = 'wb' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 3, + "token_count": 63, + "parameters": [ + "file", + "contents", + "logger", + "mode" + ], + "start_line": 470, + "end_line": 480, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "change_dir", + "long_name": "change_dir( d , logger = None )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 4, + "token_count": 78, + "parameters": [ + "d", + "logger" + ], + "start_line": 485, + "end_line": 498, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "unchange_dir", + "long_name": "unchange_dir( logger = None )", + "filename": "auto_test.py", + "nloc": 16, + "complexity": 5, + "token_count": 76, + "parameters": [ + "logger" + ], + "start_line": 504, + "end_line": 519, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "decompress_file", + "long_name": "decompress_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 12, + "complexity": 3, + "token_count": 77, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 521, + "end_line": 532, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "untar_file", + "long_name": "untar_file( file , dst_dir = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 4, + "token_count": 70, + "parameters": [ + "file", + "dst_dir", + "logger", + "silent_failure" + ], + "start_line": 535, + "end_line": 545, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "unpack_file", + "long_name": "unpack_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 33, + "parameters": [ + "file", + "logger" + ], + "start_line": 547, + "end_line": 553, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 17, + "complexity": 7, + "token_count": 88, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 555, + "end_line": 573, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 69, + "complexity": 1, + "token_count": 408, + "parameters": [ + "build_dir", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 575, + "end_line": 677, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 103, + "top_nesting_level": 0 + } + ], + "changed_methods": [ + { + "name": "remove_tree", + "long_name": "remove_tree( directory , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "directory", + "logger" + ], + "start_line": 472, + "end_line": 480, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 19, + "complexity": 9, + "token_count": 102, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 577, + "end_line": 595, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 0 + }, + { + "name": "mail_report", + "long_name": "mail_report( from_addr , to_addr , subject , mail_server , build_log , test_results , info )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 2, + "token_count": 113, + "parameters": [ + "from_addr", + "to_addr", + "subject", + "mail_server", + "build_log", + "test_results", + "info" + ], + "start_line": 597, + "end_line": 618, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , test_level = 10 , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 72, + "complexity": 3, + "token_count": 396, + "parameters": [ + "build_dir", + "test_level", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 621, + "end_line": 729, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 109, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 69, + "complexity": 1, + "token_count": 408, + "parameters": [ + "build_dir", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 575, + "end_line": 677, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 103, + "top_nesting_level": 0 + } + ], + "nloc": 519, + "complexity": 96, + "token_count": 3388, + "diff_parsed": { + "added": [ + "\"\"\" Auto test tools for SciPy", + "", + " Do not run this as root! If you enter something", + " like /usr as your test directory, it'll delete", + " /usr/bin, usr/lib, etc. So don't do it!!!", + "", + "", + " Author: Eric Jones (eric@enthought.com)", + "\"\"\"", + "local_mail_server = \"enthought.com\"", + "", + "", + "def remove_tree(directory,logger=None):", + " if not logger:", + " logger = logging", + " logger.info(\"Removing directory tree %s\" % directory)", + " try:", + " dir_util.remove_tree(directory)", + " except Exception, e:", + " logger.exception(\"Remove failed\")", + " raise", + "", + " if text and not silent_failure:", + " logger.info('Command Output:\\n'+text)", + " raise ValueError,status", + "def mail_report(from_addr,to_addr,subject,mail_server,", + " build_log, test_results,info):", + "", + " msg = ''", + " msg = msg + 'To: %s\\n' % to_addr", + " msg = msg + 'Subject: %s\\n' % subject", + " msg = msg + '\\r\\n\\r\\n'", + "", + " for k,v in info.items():", + " msg = msg + '%s: %s\\n' % (k,v)", + " msg = msg + test_results", + " msg = msg + '-----------------------------\\n'", + " msg = msg + '-------- BUILD LOG -------\\n'", + " msg = msg + '-----------------------------\\n'", + " msg = msg + build_log", + " print msg", + "", + " # mail results", + " import smtplib", + " server = smtplib.SMTP(mail_server)", + " server.sendmail(from_addr, to_addr, msg)", + " server.quit()", + "", + "", + " test_level = 10,", + "", + " build_info = {'python_version' : python_version,", + " 'test_level' : test_level,", + " 'numeric_version': numeric_version,", + " 'f2py_version' : f2py_version,", + " 'atlas_version' : atlas_version,", + " 'scipy_version' : scipy_version}", + "", + " try:", + " try:", + "", + " # before doing anything, we need to wipe the", + " # /bin, /lib, /man, and /include directories", + " # in dst_dir. Don't run as root.", + " change_dir(dst_dir , logger)", + " remove_tree('bin' , logger)", + " remove_tree('lib' , logger)", + " remove_tree('man' , logger)", + " remove_tree('include', logger)", + " unchange_dir(logger)", + "", + " python = python_installation(version=python_version,", + " logger = logger,", + " dst_dir = dst_dir)", + " python.install()", + "", + " python_name = python.get_exe_name()", + "", + " numeric = numeric_installation(version=numeric_version,", + " dst_dir = dst_dir,", + " logger = logger,", + " python_exe=python_name)", + " numeric.install()", + "", + " f2py = f2py_installation(version=f2py_version,", + " logger = logger,", + " dst_dir = dst_dir,", + " python_exe=python_name)", + " f2py.install()", + "", + " # download files don't have a version specified", + " #lapack = lapack_installation(version='',", + " # dst_dir = dst_dir", + " # python_exe=python_name)", + " #lapack.install()", + "", + " # download files don't have a version specified", + " #blas = blas_installation(version='',", + " # logger = logger,", + " # dst_dir = dst_dir,", + " # python_exe=python_name)", + " #blas.install()", + "", + " # ATLAS", + " atlas = atlas_installation(version=atlas_version,", + " logger = logger,", + " dst_dir = dst_dir,", + " python_exe=python_name)", + " atlas.install()", + "", + " # version not currently used -- need to fix this.", + " scipy = scipy_installation(version=scipy_version,", + " logger = logger,", + " dst_dir = dst_dir,", + " python_exe=python_name)", + " scipy.install()", + "", + " # The change to tmp makes sure there isn't a scipy directory in", + " # the local scope.", + " # All tests are run.", + " cmd = python_name +' -c \"import sys,scipy;suite=scipy.test(%d);\"'\\", + " % test_level", + " test_results = run_command(cmd, logger=logger,", + " directory = tempfile.gettempdir())", + " build_info['results'] = 'test completed (check below for pass/fail)'", + " except Exception, msg:", + " test_results = ''", + " build_info['results'] = 'build failed: %s' % msg", + " finally:", + " to_addr = \"scipy-testlog@scipy.org\"", + " from_addr = \"scipy-test@enthought.com\"", + " subject = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,", + " numeric_version,scipy_version)", + " build_log = log_stream.getvalue()", + " mail_report(from_addr,to_addr,subject,local_mail_server,", + " build_log,test_results,build_info)", + " level = 10", + " test_level = level,", + " test_level = level,", + " test_level = level,", + " # This fails because multiarray doesn't have", + " # arange defined.", + " test_level = level,", + " numeric_version = '20.0.0',", + " test_level = level,", + " numeric_version = '19.0.0',", + " test_level = level,", + " numeric_version = '18.4.1',", + "" + ], + "deleted": [ + " #if text:", + " # logger.info('Command Output:\\n'+text)", + " raise ValueError,'Command had non-zero exit status'", + "", + "", + " python = python_installation(version=python_version,", + " logger = logger,", + " dst_dir = dst_dir)", + " python.install()", + "", + " python_name = python.get_exe_name()", + " numeric = numeric_installation(version=numeric_version,", + " dst_dir = dst_dir,", + " logger = logger,", + " python_exe=python_name)", + " numeric.install()", + "", + " f2py = f2py_installation(version=f2py_version,", + " logger = logger,", + " dst_dir = dst_dir,", + " python_exe=python_name)", + " f2py.install()", + "", + " # download files don't have a version specified", + " #lapack = lapack_installation(version='',", + " # dst_dir = dst_dir", + " # python_exe=python_name)", + " #lapack.install()", + "", + " # download files don't have a version specified", + " #blas = blas_installation(version='',", + " # logger = logger,", + " # dst_dir = dst_dir,", + " # python_exe=python_name)", + " #blas.install()", + "", + " # ATLAS", + " atlas = atlas_installation(version=atlas_version,", + " logger = logger,", + " dst_dir = dst_dir,", + " python_exe=python_name)", + " atlas.install()", + "", + " # version not currently used -- need to fix this.", + " scipy = scipy_installation(version=scipy_version,", + " logger = logger,", + " dst_dir = dst_dir,", + " python_exe=python_name)", + " scipy.install()", + "", + " # The change to tmp makes sure there isn't a scipy directory in", + " # the local scope.", + " # All tests are run.", + " lvl = 1", + " cmd = python_name + ' -c \"import sys,scipy;suite=scipy.test(%d);\"' % lvl", + " test_results = run_command(cmd, logger=logger,", + " directory = tempfile.gettempdir())", + "", + " vitals = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,", + " numeric_version,scipy_version)", + "", + " msg = 'From: scipy-test@enthought.com\\n'", + " msg = msg + 'To: knucklehead@enthought.com\\n'", + " msg = msg + 'Subject: %s\\n' % vitals", + " msg = msg + '\\r\\n\\r\\n'", + " msg = msg + 'platform: %s,%s\\n' % (sys.platform,os.name)", + " msg = msg + 'python_version: %s\\n' % python_version", + " msg = msg + 'numeric_version: %s\\n' % numeric_version", + " msg = msg + 'f2py_version: %s\\n' % f2py_version", + " msg = msg + 'atlas_version(hard coded): %s\\n' % atlas_version", + " msg = msg + 'scipy_version: %s\\n' % scipy_version", + " msg = msg + test_results", + " msg = msg + '-----------------------------\\n'", + " msg = msg + '-------- BUILD LOG -------\\n'", + " msg = msg + '-----------------------------\\n'", + " msg = msg + log_stream.getvalue()", + " # mail results", + " import smtplib", + " toaddrs = \"eric@enthought.com\"", + " fromaddr = \"eric@enthought.com\"", + " server = smtplib.SMTP('enthought.com')", + " server.sendmail(fromaddr, toaddrs, msg)", + " server.quit()", + " print msg", + "", + "", + "", + " numeric_version = '20.0',", + " numeric_version = '19.0',", + " numeric_version = '18.0'," + ] + } + } + ] + }, + { + "hash": "50ab5c0e56f6a86839839504fcb9dc80c055f4b4", + "msg": "added testing log comment", + "author": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "committer": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "author_date": "2002-04-12T16:28:06+00:00", + "author_timezone": 0, + "committer_date": "2002-04-12T16:28:06+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "a90a991b2e0631b9d725faf1e1b7907e5e3bd645" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 0, + "insertions": 1, + "lines": 1, + "files": 1, + "dmm_unit_size": 0.0, + "dmm_unit_complexity": 1.0, + "dmm_unit_interfacing": 0.0, + "modified_files": [ + { + "old_path": "scipy_distutils/auto_test.py", + "new_path": "scipy_distutils/auto_test.py", + "filename": "auto_test.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -711,6 +711,7 @@ def full_scipy_build(build_dir = '.',\n # The change to tmp makes sure there isn't a scipy directory in \n # the local scope.\n # All tests are run.\n+ logger.info('Beginning Test')\n cmd = python_name +' -c \"import sys,scipy;suite=scipy.test(%d);\"'\\\n % test_level\n test_results = run_command(cmd, logger=logger,\n", + "added_lines": 1, + "deleted_lines": 0, + "source_code": "\"\"\" Auto test tools for SciPy\n\n Do not run this as root! If you enter something\n like /usr as your test directory, it'll delete\n /usr/bin, usr/lib, etc. So don't do it!!!\n \n \n Author: Eric Jones (eric@enthought.com)\n\"\"\"\nfrom distutils import file_util\nfrom distutils import dir_util\nfrom distutils.errors import DistutilsFileError\n#import tarfile\nimport sys, os, stat, time\nimport gzip\nimport tempfile, cStringIO\nimport urllib\nimport logging\n\nif sys.platform == 'cygwin':\n local_repository = \"/cygdrive/i/tarballs\"\nelif sys.platform == 'win32': \n local_repository = \"i:\\tarballs\"\nelse:\n local_repository = \"/home/shared/tarballs\"\n\nlocal_mail_server = \"enthought.com\"\n\npython_ftp_url = \"ftp://ftp.python.org/pub/python\"\nnumeric_url = \"http://prdownloads.sourceforge.net/numpy\"\nf2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\nscipy_url = \"ftp://www.scipy.org/pub\"\nblas_url = \"http://www.netlib.org/blas\"\nlapack_url = \"http://www.netlib.org/lapack\"\n#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\natlas_url = \"http://www.scipy.org/Members/eric\"\n\n\n#-----------------------------------------------------------------------------\n# Generic installation class. \n# built to handle downloading/untarring/building/installing arbitrary software\n#-----------------------------------------------------------------------------\n\nclass package_installation: \n def __init__(self,version='', dst_dir = '.',\n logger = None, python_exe='python'):\n #---------------------------------------------------------------------\n # These should be defined in sub-class before calling this\n # constructor\n #---------------------------------------------------------------------\n # \n #self.package_url -- The name of the url where tarball can be found.\n #self.package_base_name -- The base name of the source tarball.\n #self.package_dir_name -- Top level directory of unpacked tarball\n #self.tarball_suffix -- usually tar.gz or .tgz\n #self.build_type -- 'make' or 'setup' for makefile or python setup file\n \n # Version of the software package.\n self.version = version\n\n # Only used by packages built with setup.py\n self.python_exe = python_exe\n \n # Directory where package is unpacked/built/installed\n self.dst_dir = os.path.abspath(dst_dir) \n \n # make sure the destination exists\n dir_util.mkpath(self.dst_dir)\n \n if not logger:\n self.logger = logging\n else:\n self.logger = logger \n\n # Construct any derived names built from the above names.\n self.init_names()\n \n def init_names(self): \n self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)\n self.tarball = self.package_base_name + '.' + self.tarball_suffix\n\n def get_source(self):\n \"\"\" Grab the source tarball from a repository.\n \n Try a local repository first. If the file isn't found,\n grab it from an ftp site.\n \"\"\"\n local_found = 0\n if self.local_source_up_to_date():\n try:\n self.get_source_local()\n local_found = 1 \n except DistutilsFileError:\n pass\n \n if not local_found:\n self.get_source_ftp()\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n return 1\n \n def get_source_local(self):\n \"\"\" Grab the requested tarball from a local repository of source\n tarballs. If it doesn't exist, an error is raised.\n \"\"\"\n file = os.path.join(local_repository,self.tarball) \n dst_file = os.path.join(self.dst_dir,self.tarball)\n self.logger.info(\"Searching local repository for %s\" % file)\n try:\n copy_file(file,dst_file,self.logger)\n except DistutilsFileError, msg:\n self.logger.info(\"Not found:\",msg)\n raise\n \n def get_source_ftp(self):\n \"\"\" Grab requested tarball from a ftp site specified as a url. \n \"\"\"\n url = '/'.join([self.package_url,self.tarball])\n \n self.logger.info('Opening: %s' % url)\n f = urllib.urlopen(url)\n self.logger.info('Downloading: this may take a while')\n contents = f.read(-1)\n f.close()\n self.logger.info('Finished download (size=%d)' % len(contents))\n \n output_file = os.path.join(self.dst_dir,self.tarball)\n write_file(output_file,contents,self.logger)\n\n # Put file in local repository so we don't have to download it again.\n self.logger.info(\"Caching file in repository\" )\n src_file = output_file\n repos_file = os.path.join(local_repository,self.tarball) \n copy_file(src_file,repos_file,self.logger)\n\n def unpack_source(self,sub_dir = None):\n \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir\n \"\"\" \n tarfile = os.path.join(self.dst_dir,self.tarball)\n old_dir = None\n \n # copy and move into sub directory if it is specified.\n if sub_dir:\n dst_dir = os.path.join(self.dst_dir,sub_dir)\n dst_file = os.path.join(dst_dir,self.tarball)\n copy_file(tarfile,dst_file)\n change_dir(dst_dir,self.logger)\n try:\n try:\n # occasionally the tarball is not zipped, try this first.\n untar_file(self.tarball,self.dst_dir,\n self.logger,silent_failure=1)\n except:\n # otherwise, handle the fact that it is zipped \n dst = os.path.join(self.dst_dir,'tmp.tar') \n decompress_file(tarfile,dst,self.logger) \n untar_file(dst,self.dst_dir,self.logger)\n remove_file(dst,self.logger)\n finally:\n if old_dir:\n unchange_dir(self.logger)\n\n def auto_configure(self):\n cmd = os.path.join('.','configure')\n text = run_command(cmd,self.package_dir,self.logger)\n\n def build_with_make(self):\n cmd = 'make'\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, prefix = None):\n if prefix is None:\n prefix = os.path.abspath(self.dst_dir)\n cmd = 'make install prefix=%s' % prefix\n text = run_command(cmd,self.package_dir,self.logger)\n\n def python_setup(self):\n cmd = self.python_exe + ' setup.py install'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def _make(self,**kw):\n \"\"\" This generally needs to be overrridden in the derived class,\n but this will suffice for the standard configure/make process. \n \"\"\"\n self.get_source()\n self.unpack_source()\n self.auto_configure()\n self.build_with_make()\n self.install_with_make()\n\n def _setup(self):\n \"\"\" Build with Python setup script.\n \"\"\"\n self.get_source()\n self.unpack_source()\n self.python_setup()\n\n def install(self):\n self.logger.info('####### Building: %s' % self.package_base_name)\n self.logger.info(' Version: %s' % self.version)\n self.logger.info(' Url: %s' % self.package_url)\n self.logger.info(' Install dir: %s' % self.dst_dir)\n self.logger.info(' Package dir: %s' % self.package_dir)\n self.logger.info(' Suffix: %s' % self.tarball_suffix)\n self.logger.info(' Build type: %s' % self.build_type)\n if self.build_type == 'setup':\n self._setup()\n else: \n self._make()\n self.logger.info('####### Finished Building: %s' % self.package_base_name) \n \n#-----------------------------------------------------------------------------\n# Installation class for Python itself.\n#-----------------------------------------------------------------------------\n \nclass python_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Python. \n self.package_base_name = 'Python-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = '/'.join([python_ftp_url,version])\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def write_install_config(self): \n \"\"\" Make doesn't seem to install scripts in the correct places.\n \n Writing this to the python directory will solve the problem.\n [install_script]\n install-dir= \n \"\"\"\n text = \"[install_scripts]\\n\"\\\n \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n file = os.path.join(self.package_dir,'setup.cfg') \n write_file(file,text,self.logger,mode='w')\n\n def install_with_make(self):\n \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n file is written to force installation in the correct place.\n \"\"\"\n self.write_install_config()\n package_installation.install_with_make(self)\n\n def get_exe_name(self):\n pyname = os.path.join('.','python')\n cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"\n text = run_command(cmd,self.package_dir,self.logger)\n exe = os.path.join(self.dst_dir,'bin','python'+text)\n return exe\n\n#-----------------------------------------------------------------------------\n# Installation class for Blas.\n#-----------------------------------------------------------------------------\n\nclass blas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for for \"slow\" blas\n self.package_base_name = 'blas'\n self.package_dir_name = 'BLAS'\n self.package_url = blas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def unpack_source(self,subdir=None):\n \"\"\" Dag. blas.tgz doesn't have directory information -- its\n just a tar ball of fortran source code. untar it in the\n BLAS directory\n \"\"\"\n package_installation.unpack_source(self,self.package_dir_name)\n \n def auto_configure(self):\n # nothing to do.\n pass\n def build_with_make(self, **kw):\n libname = 'blas_LINUX.a'\n cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over. \n src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n self.logger.info(\"Installing blas\")\n copy_file(src_file,dst_file,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for Lapack.\n#-----------------------------------------------------------------------------\n\nclass lapack_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Lapack 3.0 + updates \n self.package_base_name = 'lapack'\n self.package_dir_name = 'LAPACK'\n self.package_url = lapack_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self):\n # perhaps this should actually override auto_conifgure\n # before make, we need to copy the appropriate setup file in.\n # should work anywhere g77 works...\n make_inc = 'make.inc.' + self.platform\n src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n dst_file = os.path.join(self.package_dir,'make.inc')\n copy_file(src_file,dst_file,self.logger)\n\n def build_with_make(self, **kw):\n cmd = 'make install lapacklib'\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over.\n src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','liblapack.a')\n self.logger.info(\"Installing lapack\")\n copy_file(src_file,dst_file,self.logger)\n \n#-----------------------------------------------------------------------------\n# Installation class for Numeric\n#-----------------------------------------------------------------------------\n\nclass numeric_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'Numeric-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = numeric_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for f2py\n#-----------------------------------------------------------------------------\n\nclass f2py_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Typical file format: F2PY-2.13.175-1250.tar.gz\n self.package_base_name = 'F2PY-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = f2py_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for Atlas.\n# This is a binary install *NOT* a source install.\n# The source install is a pain to automate.\n#-----------------------------------------------------------------------------\n\nclass atlas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n #self.package_base_name = 'atlas' + version\n #self.package_dir_name = 'ATLAS'\n self.package_base_name = 'atlas-RH7.1-PIII'\n self.package_dir_name = 'atlas'\n self.package_url = atlas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self,**kw):\n pass\n def build_with_make(self,**kw):\n pass\n def install_with_make(self, **kw):\n # just copy the tree over.\n dst = os.path.join(self.dst_dir,'lib','atlas')\n self.logger.info(\"Installing Atlas\")\n copy_tree(self.package_dir,dst,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for scipy\n#-----------------------------------------------------------------------------\n\nclass scipy_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'scipy_snapshot'\n self.package_dir_name = 'scipy'\n self.package_url = scipy_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'setup'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n file = os.path.join(local_repository,self.tarball)\n up_to_date = 0\n try:\n file_time = os.stat(file)[stat.ST_MTIME] \n fyear,fmonth,fday = time.localtime(file_time)[:3]\n year,month,day = time.localtime()[:3]\n if year == year and month == month and day == day:\n up_to_date = 1\n self.logger.info(\"Repository file up to date: %s\" % file)\n except OSError, msg:\n pass\n return up_to_date\n \n#-----------------------------------------------------------------------------\n# Utilities\n#-----------------------------------------------------------------------------\n\n\n#if os.name == 'nt':\n# def exec_command(command):\n# \"\"\" not sure how to get exit status on nt. \"\"\"\n# in_pipe,out_pipe = os.popen4(command)\n# in_pipe.close()\n# text = out_pipe.read()\n# return 0, text\n#else:\n# import commands\n# exec_command = commands.getstatusoutput\n \n# This may not work on Win98... The above stuff was to handle these machines.\nimport commands\nexec_command = commands.getstatusoutput\n\ndef copy_file(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying %s->%s\" % (src,dst)) \n try:\n file_util.copy_file(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef copy_tree(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying directory tree %s->%s\" % (src,dst)) \n try:\n dir_util.copy_tree(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef remove_tree(directory,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Removing directory tree %s\" % directory) \n try:\n dir_util.remove_tree(directory)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef remove_file(file,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Remove file %s\" % file) \n try:\n os.remove(file)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef write_file(file,contents,logger=None,mode='wb'):\n if not logger:\n logger = logging\n logger.info('Write file: %s' % file)\n try:\n new_file = open(file,mode)\n new_file.write(contents)\n new_file.close()\n except Exception, e: \n logger.exception(\"Write failed\") \n raise\n\n# I know, I know...\nold_dir = []\n\ndef change_dir(d, logger = None):\n if not logger:\n logger = logging\n global old_dir \n cwd = os.getcwd() \n old_dir.append(cwd)\n d = os.path.abspath(d)\n if d != old_dir[-1]:\n logger.info(\"Change directory: %s\" % d) \n try:\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n #if d == '.':\n # import sys,traceback\n # f = sys._getframe()\n # traceback.print_stack(f)\n\ndef unchange_dir(logger=None):\n if not logger:\n logger = logging \n global old_dir\n try:\n cwd = os.getcwd()\n d = old_dir.pop(-1) \n try:\n if d != cwd:\n logger.info(\"Change directory : %s\" % d)\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n except IndexError:\n logger.exception(\"Change directory failed\")\n \ndef decompress_file(src,dst,logger = None):\n if not logger:\n logger = logging\n logger.info(\"Upacking %s->%s\" % (src,dst))\n try:\n f = gzip.open(src,'rb')\n contents = f.read(-1)\n f = open(dst, 'wb')\n f.write(contents)\n except Exception, e: \n logger.exception(\"Unpack failed\")\n raise \n\n \ndef untar_file(file,dst_dir='.',logger = None,silent_failure = 0): \n if not logger:\n logger = logging\n logger.info(\"Untarring file: %s\" % (file))\n try:\n run_command('tar -xf ' + file,directory = dst_dir,\n logger=logger, silent_failure = silent_failure)\n except Exception, e:\n if not silent_failure: \n logger.exception(\"Untar failed\")\n raise \n\ndef unpack_file(file,logger = None):\n \"\"\" equivalent to 'tar -xzvf file'\n \"\"\"\n dst = 'tmp.tar'\n decompress_file(file,dst,logger) \n untar_file(dst.logger)\n remove_file(dst,logger) \n\ndef run_command(cmd,directory='.',logger=None,silent_failure = 0):\n if not logger:\n logger = logging\n change_dir(directory,logger) \n try: \n msg = 'Command: %s' % cmd\n status,text = exec_command(cmd)\n if status:\n msg = msg + ' (failed)'\n logger.info(msg) \n if status and not silent_failure:\n logger.error('command failed with status: %d' % status) \n if text and not silent_failure:\n logger.info('Command Output:\\n'+text)\n finally:\n unchange_dir(logger)\n if status:\n raise ValueError,status\n return text \n\ndef mail_report(from_addr,to_addr,subject,mail_server,\n build_log, test_results,info):\n \n msg = ''\n msg = msg + 'To: %s\\n' % to_addr\n msg = msg + 'Subject: %s\\n' % subject\n msg = msg + '\\r\\n\\r\\n'\n\n for k,v in info.items(): \n msg = msg + '%s: %s\\n' % (k,v)\n msg = msg + test_results \n msg = msg + '-----------------------------\\n' \n msg = msg + '-------- BUILD LOG -------\\n' \n msg = msg + '-----------------------------\\n' \n msg = msg + build_log\n print msg\n \n # mail results\n import smtplib \n server = smtplib.SMTP(mail_server) \n server.sendmail(from_addr, to_addr, msg)\n server.quit()\n \n\ndef full_scipy_build(build_dir = '.',\n test_level = 10,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot'):\n \n # for now the atlas version is ignored. Only the \n # binaries for RH are supported at the moment.\n\n build_info = {'python_version' : python_version,\n 'test_level' : test_level,\n 'numeric_version': numeric_version,\n 'f2py_version' : f2py_version,\n 'atlas_version' : atlas_version,\n 'scipy_version' : scipy_version}\n \n dst_dir = os.path.join(build_dir,sys.platform)\n\n logger = logging.Logger(\"SciPy Test\")\n fmt = logging.Formatter(logging.BASIC_FORMAT)\n log_stream = cStringIO.StringIO()\n stream_handler = logging.StreamHandler(log_stream)\n stream_handler.setFormatter(fmt)\n logger.addHandler(stream_handler)\n # also write to stderr\n stderr = logging.StreamHandler()\n stderr.setFormatter(fmt)\n logger.addHandler(stderr)\n\n try:\n try: \n \n # before doing anything, we need to wipe the \n # /bin, /lib, /man, and /include directories\n # in dst_dir. Don't run as root.\n change_dir(dst_dir , logger)\n remove_tree('bin' , logger)\n remove_tree('lib' , logger)\n remove_tree('man' , logger)\n remove_tree('include', logger)\n unchange_dir(logger)\n \n python = python_installation(version=python_version,\n logger = logger,\n dst_dir = dst_dir)\n python.install()\n \n python_name = python.get_exe_name()\n \n numeric = numeric_installation(version=numeric_version,\n dst_dir = dst_dir,\n logger = logger,\n python_exe=python_name)\n numeric.install()\n \n f2py = f2py_installation(version=f2py_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n f2py.install() \n \n # download files don't have a version specified \n #lapack = lapack_installation(version='',\n # dst_dir = dst_dir\n # python_exe=python_name)\n #lapack.install() \n \n # download files don't have a version specified \n #blas = blas_installation(version='',\n # logger = logger,\n # dst_dir = dst_dir,\n # python_exe=python_name)\n #blas.install() \n \n # ATLAS\n atlas = atlas_installation(version=atlas_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n atlas.install()\n \n # version not currently used -- need to fix this.\n scipy = scipy_installation(version=scipy_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n scipy.install() \n \n # The change to tmp makes sure there isn't a scipy directory in \n # the local scope.\n # All tests are run.\n logger.info('Beginning Test')\n cmd = python_name +' -c \"import sys,scipy;suite=scipy.test(%d);\"'\\\n % test_level\n test_results = run_command(cmd, logger=logger,\n directory = tempfile.gettempdir())\n build_info['results'] = 'test completed (check below for pass/fail)'\n except Exception, msg:\n test_results = ''\n build_info['results'] = 'build failed: %s' % msg\n finally: \n to_addr = \"scipy-testlog@scipy.org\"\n from_addr = \"scipy-test@enthought.com\"\n subject = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n numeric_version,scipy_version) \n build_log = log_stream.getvalue()\n mail_report(from_addr,to_addr,subject,local_mail_server,\n build_log,test_results,build_info)\n\nif __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n level = 10\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n # an older python\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older numeric\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.3',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # This fails because multiarray doesn't have \n # arange defined.\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '19.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '18.4.1',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n", + "source_code_before": "\"\"\" Auto test tools for SciPy\n\n Do not run this as root! If you enter something\n like /usr as your test directory, it'll delete\n /usr/bin, usr/lib, etc. So don't do it!!!\n \n \n Author: Eric Jones (eric@enthought.com)\n\"\"\"\nfrom distutils import file_util\nfrom distutils import dir_util\nfrom distutils.errors import DistutilsFileError\n#import tarfile\nimport sys, os, stat, time\nimport gzip\nimport tempfile, cStringIO\nimport urllib\nimport logging\n\nif sys.platform == 'cygwin':\n local_repository = \"/cygdrive/i/tarballs\"\nelif sys.platform == 'win32': \n local_repository = \"i:\\tarballs\"\nelse:\n local_repository = \"/home/shared/tarballs\"\n\nlocal_mail_server = \"enthought.com\"\n\npython_ftp_url = \"ftp://ftp.python.org/pub/python\"\nnumeric_url = \"http://prdownloads.sourceforge.net/numpy\"\nf2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\nscipy_url = \"ftp://www.scipy.org/pub\"\nblas_url = \"http://www.netlib.org/blas\"\nlapack_url = \"http://www.netlib.org/lapack\"\n#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\natlas_url = \"http://www.scipy.org/Members/eric\"\n\n\n#-----------------------------------------------------------------------------\n# Generic installation class. \n# built to handle downloading/untarring/building/installing arbitrary software\n#-----------------------------------------------------------------------------\n\nclass package_installation: \n def __init__(self,version='', dst_dir = '.',\n logger = None, python_exe='python'):\n #---------------------------------------------------------------------\n # These should be defined in sub-class before calling this\n # constructor\n #---------------------------------------------------------------------\n # \n #self.package_url -- The name of the url where tarball can be found.\n #self.package_base_name -- The base name of the source tarball.\n #self.package_dir_name -- Top level directory of unpacked tarball\n #self.tarball_suffix -- usually tar.gz or .tgz\n #self.build_type -- 'make' or 'setup' for makefile or python setup file\n \n # Version of the software package.\n self.version = version\n\n # Only used by packages built with setup.py\n self.python_exe = python_exe\n \n # Directory where package is unpacked/built/installed\n self.dst_dir = os.path.abspath(dst_dir) \n \n # make sure the destination exists\n dir_util.mkpath(self.dst_dir)\n \n if not logger:\n self.logger = logging\n else:\n self.logger = logger \n\n # Construct any derived names built from the above names.\n self.init_names()\n \n def init_names(self): \n self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)\n self.tarball = self.package_base_name + '.' + self.tarball_suffix\n\n def get_source(self):\n \"\"\" Grab the source tarball from a repository.\n \n Try a local repository first. If the file isn't found,\n grab it from an ftp site.\n \"\"\"\n local_found = 0\n if self.local_source_up_to_date():\n try:\n self.get_source_local()\n local_found = 1 \n except DistutilsFileError:\n pass\n \n if not local_found:\n self.get_source_ftp()\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n return 1\n \n def get_source_local(self):\n \"\"\" Grab the requested tarball from a local repository of source\n tarballs. If it doesn't exist, an error is raised.\n \"\"\"\n file = os.path.join(local_repository,self.tarball) \n dst_file = os.path.join(self.dst_dir,self.tarball)\n self.logger.info(\"Searching local repository for %s\" % file)\n try:\n copy_file(file,dst_file,self.logger)\n except DistutilsFileError, msg:\n self.logger.info(\"Not found:\",msg)\n raise\n \n def get_source_ftp(self):\n \"\"\" Grab requested tarball from a ftp site specified as a url. \n \"\"\"\n url = '/'.join([self.package_url,self.tarball])\n \n self.logger.info('Opening: %s' % url)\n f = urllib.urlopen(url)\n self.logger.info('Downloading: this may take a while')\n contents = f.read(-1)\n f.close()\n self.logger.info('Finished download (size=%d)' % len(contents))\n \n output_file = os.path.join(self.dst_dir,self.tarball)\n write_file(output_file,contents,self.logger)\n\n # Put file in local repository so we don't have to download it again.\n self.logger.info(\"Caching file in repository\" )\n src_file = output_file\n repos_file = os.path.join(local_repository,self.tarball) \n copy_file(src_file,repos_file,self.logger)\n\n def unpack_source(self,sub_dir = None):\n \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir\n \"\"\" \n tarfile = os.path.join(self.dst_dir,self.tarball)\n old_dir = None\n \n # copy and move into sub directory if it is specified.\n if sub_dir:\n dst_dir = os.path.join(self.dst_dir,sub_dir)\n dst_file = os.path.join(dst_dir,self.tarball)\n copy_file(tarfile,dst_file)\n change_dir(dst_dir,self.logger)\n try:\n try:\n # occasionally the tarball is not zipped, try this first.\n untar_file(self.tarball,self.dst_dir,\n self.logger,silent_failure=1)\n except:\n # otherwise, handle the fact that it is zipped \n dst = os.path.join(self.dst_dir,'tmp.tar') \n decompress_file(tarfile,dst,self.logger) \n untar_file(dst,self.dst_dir,self.logger)\n remove_file(dst,self.logger)\n finally:\n if old_dir:\n unchange_dir(self.logger)\n\n def auto_configure(self):\n cmd = os.path.join('.','configure')\n text = run_command(cmd,self.package_dir,self.logger)\n\n def build_with_make(self):\n cmd = 'make'\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, prefix = None):\n if prefix is None:\n prefix = os.path.abspath(self.dst_dir)\n cmd = 'make install prefix=%s' % prefix\n text = run_command(cmd,self.package_dir,self.logger)\n\n def python_setup(self):\n cmd = self.python_exe + ' setup.py install'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def _make(self,**kw):\n \"\"\" This generally needs to be overrridden in the derived class,\n but this will suffice for the standard configure/make process. \n \"\"\"\n self.get_source()\n self.unpack_source()\n self.auto_configure()\n self.build_with_make()\n self.install_with_make()\n\n def _setup(self):\n \"\"\" Build with Python setup script.\n \"\"\"\n self.get_source()\n self.unpack_source()\n self.python_setup()\n\n def install(self):\n self.logger.info('####### Building: %s' % self.package_base_name)\n self.logger.info(' Version: %s' % self.version)\n self.logger.info(' Url: %s' % self.package_url)\n self.logger.info(' Install dir: %s' % self.dst_dir)\n self.logger.info(' Package dir: %s' % self.package_dir)\n self.logger.info(' Suffix: %s' % self.tarball_suffix)\n self.logger.info(' Build type: %s' % self.build_type)\n if self.build_type == 'setup':\n self._setup()\n else: \n self._make()\n self.logger.info('####### Finished Building: %s' % self.package_base_name) \n \n#-----------------------------------------------------------------------------\n# Installation class for Python itself.\n#-----------------------------------------------------------------------------\n \nclass python_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Python. \n self.package_base_name = 'Python-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = '/'.join([python_ftp_url,version])\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def write_install_config(self): \n \"\"\" Make doesn't seem to install scripts in the correct places.\n \n Writing this to the python directory will solve the problem.\n [install_script]\n install-dir= \n \"\"\"\n text = \"[install_scripts]\\n\"\\\n \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n file = os.path.join(self.package_dir,'setup.cfg') \n write_file(file,text,self.logger,mode='w')\n\n def install_with_make(self):\n \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n file is written to force installation in the correct place.\n \"\"\"\n self.write_install_config()\n package_installation.install_with_make(self)\n\n def get_exe_name(self):\n pyname = os.path.join('.','python')\n cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"\n text = run_command(cmd,self.package_dir,self.logger)\n exe = os.path.join(self.dst_dir,'bin','python'+text)\n return exe\n\n#-----------------------------------------------------------------------------\n# Installation class for Blas.\n#-----------------------------------------------------------------------------\n\nclass blas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for for \"slow\" blas\n self.package_base_name = 'blas'\n self.package_dir_name = 'BLAS'\n self.package_url = blas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def unpack_source(self,subdir=None):\n \"\"\" Dag. blas.tgz doesn't have directory information -- its\n just a tar ball of fortran source code. untar it in the\n BLAS directory\n \"\"\"\n package_installation.unpack_source(self,self.package_dir_name)\n \n def auto_configure(self):\n # nothing to do.\n pass\n def build_with_make(self, **kw):\n libname = 'blas_LINUX.a'\n cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over. \n src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n self.logger.info(\"Installing blas\")\n copy_file(src_file,dst_file,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for Lapack.\n#-----------------------------------------------------------------------------\n\nclass lapack_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Lapack 3.0 + updates \n self.package_base_name = 'lapack'\n self.package_dir_name = 'LAPACK'\n self.package_url = lapack_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self):\n # perhaps this should actually override auto_conifgure\n # before make, we need to copy the appropriate setup file in.\n # should work anywhere g77 works...\n make_inc = 'make.inc.' + self.platform\n src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n dst_file = os.path.join(self.package_dir,'make.inc')\n copy_file(src_file,dst_file,self.logger)\n\n def build_with_make(self, **kw):\n cmd = 'make install lapacklib'\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over.\n src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','liblapack.a')\n self.logger.info(\"Installing lapack\")\n copy_file(src_file,dst_file,self.logger)\n \n#-----------------------------------------------------------------------------\n# Installation class for Numeric\n#-----------------------------------------------------------------------------\n\nclass numeric_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'Numeric-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = numeric_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for f2py\n#-----------------------------------------------------------------------------\n\nclass f2py_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Typical file format: F2PY-2.13.175-1250.tar.gz\n self.package_base_name = 'F2PY-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = f2py_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for Atlas.\n# This is a binary install *NOT* a source install.\n# The source install is a pain to automate.\n#-----------------------------------------------------------------------------\n\nclass atlas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n #self.package_base_name = 'atlas' + version\n #self.package_dir_name = 'ATLAS'\n self.package_base_name = 'atlas-RH7.1-PIII'\n self.package_dir_name = 'atlas'\n self.package_url = atlas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self,**kw):\n pass\n def build_with_make(self,**kw):\n pass\n def install_with_make(self, **kw):\n # just copy the tree over.\n dst = os.path.join(self.dst_dir,'lib','atlas')\n self.logger.info(\"Installing Atlas\")\n copy_tree(self.package_dir,dst,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for scipy\n#-----------------------------------------------------------------------------\n\nclass scipy_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'scipy_snapshot'\n self.package_dir_name = 'scipy'\n self.package_url = scipy_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'setup'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n file = os.path.join(local_repository,self.tarball)\n up_to_date = 0\n try:\n file_time = os.stat(file)[stat.ST_MTIME] \n fyear,fmonth,fday = time.localtime(file_time)[:3]\n year,month,day = time.localtime()[:3]\n if year == year and month == month and day == day:\n up_to_date = 1\n self.logger.info(\"Repository file up to date: %s\" % file)\n except OSError, msg:\n pass\n return up_to_date\n \n#-----------------------------------------------------------------------------\n# Utilities\n#-----------------------------------------------------------------------------\n\n\n#if os.name == 'nt':\n# def exec_command(command):\n# \"\"\" not sure how to get exit status on nt. \"\"\"\n# in_pipe,out_pipe = os.popen4(command)\n# in_pipe.close()\n# text = out_pipe.read()\n# return 0, text\n#else:\n# import commands\n# exec_command = commands.getstatusoutput\n \n# This may not work on Win98... The above stuff was to handle these machines.\nimport commands\nexec_command = commands.getstatusoutput\n\ndef copy_file(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying %s->%s\" % (src,dst)) \n try:\n file_util.copy_file(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef copy_tree(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying directory tree %s->%s\" % (src,dst)) \n try:\n dir_util.copy_tree(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef remove_tree(directory,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Removing directory tree %s\" % directory) \n try:\n dir_util.remove_tree(directory)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef remove_file(file,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Remove file %s\" % file) \n try:\n os.remove(file)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef write_file(file,contents,logger=None,mode='wb'):\n if not logger:\n logger = logging\n logger.info('Write file: %s' % file)\n try:\n new_file = open(file,mode)\n new_file.write(contents)\n new_file.close()\n except Exception, e: \n logger.exception(\"Write failed\") \n raise\n\n# I know, I know...\nold_dir = []\n\ndef change_dir(d, logger = None):\n if not logger:\n logger = logging\n global old_dir \n cwd = os.getcwd() \n old_dir.append(cwd)\n d = os.path.abspath(d)\n if d != old_dir[-1]:\n logger.info(\"Change directory: %s\" % d) \n try:\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n #if d == '.':\n # import sys,traceback\n # f = sys._getframe()\n # traceback.print_stack(f)\n\ndef unchange_dir(logger=None):\n if not logger:\n logger = logging \n global old_dir\n try:\n cwd = os.getcwd()\n d = old_dir.pop(-1) \n try:\n if d != cwd:\n logger.info(\"Change directory : %s\" % d)\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n except IndexError:\n logger.exception(\"Change directory failed\")\n \ndef decompress_file(src,dst,logger = None):\n if not logger:\n logger = logging\n logger.info(\"Upacking %s->%s\" % (src,dst))\n try:\n f = gzip.open(src,'rb')\n contents = f.read(-1)\n f = open(dst, 'wb')\n f.write(contents)\n except Exception, e: \n logger.exception(\"Unpack failed\")\n raise \n\n \ndef untar_file(file,dst_dir='.',logger = None,silent_failure = 0): \n if not logger:\n logger = logging\n logger.info(\"Untarring file: %s\" % (file))\n try:\n run_command('tar -xf ' + file,directory = dst_dir,\n logger=logger, silent_failure = silent_failure)\n except Exception, e:\n if not silent_failure: \n logger.exception(\"Untar failed\")\n raise \n\ndef unpack_file(file,logger = None):\n \"\"\" equivalent to 'tar -xzvf file'\n \"\"\"\n dst = 'tmp.tar'\n decompress_file(file,dst,logger) \n untar_file(dst.logger)\n remove_file(dst,logger) \n\ndef run_command(cmd,directory='.',logger=None,silent_failure = 0):\n if not logger:\n logger = logging\n change_dir(directory,logger) \n try: \n msg = 'Command: %s' % cmd\n status,text = exec_command(cmd)\n if status:\n msg = msg + ' (failed)'\n logger.info(msg) \n if status and not silent_failure:\n logger.error('command failed with status: %d' % status) \n if text and not silent_failure:\n logger.info('Command Output:\\n'+text)\n finally:\n unchange_dir(logger)\n if status:\n raise ValueError,status\n return text \n\ndef mail_report(from_addr,to_addr,subject,mail_server,\n build_log, test_results,info):\n \n msg = ''\n msg = msg + 'To: %s\\n' % to_addr\n msg = msg + 'Subject: %s\\n' % subject\n msg = msg + '\\r\\n\\r\\n'\n\n for k,v in info.items(): \n msg = msg + '%s: %s\\n' % (k,v)\n msg = msg + test_results \n msg = msg + '-----------------------------\\n' \n msg = msg + '-------- BUILD LOG -------\\n' \n msg = msg + '-----------------------------\\n' \n msg = msg + build_log\n print msg\n \n # mail results\n import smtplib \n server = smtplib.SMTP(mail_server) \n server.sendmail(from_addr, to_addr, msg)\n server.quit()\n \n\ndef full_scipy_build(build_dir = '.',\n test_level = 10,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot'):\n \n # for now the atlas version is ignored. Only the \n # binaries for RH are supported at the moment.\n\n build_info = {'python_version' : python_version,\n 'test_level' : test_level,\n 'numeric_version': numeric_version,\n 'f2py_version' : f2py_version,\n 'atlas_version' : atlas_version,\n 'scipy_version' : scipy_version}\n \n dst_dir = os.path.join(build_dir,sys.platform)\n\n logger = logging.Logger(\"SciPy Test\")\n fmt = logging.Formatter(logging.BASIC_FORMAT)\n log_stream = cStringIO.StringIO()\n stream_handler = logging.StreamHandler(log_stream)\n stream_handler.setFormatter(fmt)\n logger.addHandler(stream_handler)\n # also write to stderr\n stderr = logging.StreamHandler()\n stderr.setFormatter(fmt)\n logger.addHandler(stderr)\n\n try:\n try: \n \n # before doing anything, we need to wipe the \n # /bin, /lib, /man, and /include directories\n # in dst_dir. Don't run as root.\n change_dir(dst_dir , logger)\n remove_tree('bin' , logger)\n remove_tree('lib' , logger)\n remove_tree('man' , logger)\n remove_tree('include', logger)\n unchange_dir(logger)\n \n python = python_installation(version=python_version,\n logger = logger,\n dst_dir = dst_dir)\n python.install()\n \n python_name = python.get_exe_name()\n \n numeric = numeric_installation(version=numeric_version,\n dst_dir = dst_dir,\n logger = logger,\n python_exe=python_name)\n numeric.install()\n \n f2py = f2py_installation(version=f2py_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n f2py.install() \n \n # download files don't have a version specified \n #lapack = lapack_installation(version='',\n # dst_dir = dst_dir\n # python_exe=python_name)\n #lapack.install() \n \n # download files don't have a version specified \n #blas = blas_installation(version='',\n # logger = logger,\n # dst_dir = dst_dir,\n # python_exe=python_name)\n #blas.install() \n \n # ATLAS\n atlas = atlas_installation(version=atlas_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n atlas.install()\n \n # version not currently used -- need to fix this.\n scipy = scipy_installation(version=scipy_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n scipy.install() \n \n # The change to tmp makes sure there isn't a scipy directory in \n # the local scope.\n # All tests are run.\n cmd = python_name +' -c \"import sys,scipy;suite=scipy.test(%d);\"'\\\n % test_level\n test_results = run_command(cmd, logger=logger,\n directory = tempfile.gettempdir())\n build_info['results'] = 'test completed (check below for pass/fail)'\n except Exception, msg:\n test_results = ''\n build_info['results'] = 'build failed: %s' % msg\n finally: \n to_addr = \"scipy-testlog@scipy.org\"\n from_addr = \"scipy-test@enthought.com\"\n subject = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n numeric_version,scipy_version) \n build_log = log_stream.getvalue()\n mail_report(from_addr,to_addr,subject,local_mail_server,\n build_log,test_results,build_info)\n\nif __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n level = 10\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n # an older python\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older numeric\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.3',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # This fails because multiarray doesn't have \n # arange defined.\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '19.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '18.4.1',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n", + "methods": [ + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 45, + "end_line": 76, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "init_names", + "long_name": "init_names( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 78, + "end_line": 80, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_source", + "long_name": "get_source( self )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 4, + "token_count": 39, + "parameters": [ + "self" + ], + "start_line": 82, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 99, + "end_line": 102, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "get_source_local", + "long_name": "get_source_local( self )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 2, + "token_count": 74, + "parameters": [ + "self" + ], + "start_line": 104, + "end_line": 115, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "get_source_ftp", + "long_name": "get_source_ftp( self )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 1, + "token_count": 136, + "parameters": [ + "self" + ], + "start_line": 117, + "end_line": 136, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , sub_dir = None )", + "filename": "auto_test.py", + "nloc": 20, + "complexity": 5, + "token_count": 153, + "parameters": [ + "self", + "sub_dir" + ], + "start_line": 138, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 165, + "end_line": 167, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 169, + "end_line": 171, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , prefix = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 2, + "token_count": 45, + "parameters": [ + "self", + "prefix" + ], + "start_line": 173, + "end_line": 177, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "python_setup", + "long_name": "python_setup( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 179, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 34, + "parameters": [ + "self", + "kw" + ], + "start_line": 183, + "end_line": 191, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "_setup", + "long_name": "_setup( self )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 21, + "parameters": [ + "self" + ], + "start_line": 193, + "end_line": 198, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 2, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 200, + "end_line": 212, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 73, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 220, + "end_line": 229, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 231, + "end_line": 241, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 243, + "end_line": 248, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_exe_name", + "long_name": "get_exe_name( self )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 56, + "parameters": [ + "self" + ], + "start_line": 250, + "end_line": 255, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 263, + "end_line": 273, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , subdir = None )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "subdir" + ], + "start_line": 275, + "end_line": 280, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 282, + "end_line": 284, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "kw" + ], + "start_line": 285, + "end_line": 288, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 290, + "end_line": 295, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 303, + "end_line": 313, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 315, + "end_line": 322, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "kw" + ], + "start_line": 324, + "end_line": 326, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 328, + "end_line": 333, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 341, + "end_line": 349, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 358, + "end_line": 367, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 378, + "end_line": 388, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 390, + "end_line": 391, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 392, + "end_line": 393, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "kw" + ], + "start_line": 394, + "end_line": 398, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 406, + "end_line": 414, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self" + ], + "start_line": 416, + "end_line": 430, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "copy_file", + "long_name": "copy_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 452, + "end_line": 460, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "copy_tree", + "long_name": "copy_tree( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 462, + "end_line": 470, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_tree", + "long_name": "remove_tree( directory , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "directory", + "logger" + ], + "start_line": 472, + "end_line": 480, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_file", + "long_name": "remove_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "file", + "logger" + ], + "start_line": 482, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_file", + "long_name": "write_file( file , contents , logger = None , mode = 'wb' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 3, + "token_count": 63, + "parameters": [ + "file", + "contents", + "logger", + "mode" + ], + "start_line": 492, + "end_line": 502, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "change_dir", + "long_name": "change_dir( d , logger = None )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 4, + "token_count": 78, + "parameters": [ + "d", + "logger" + ], + "start_line": 507, + "end_line": 520, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "unchange_dir", + "long_name": "unchange_dir( logger = None )", + "filename": "auto_test.py", + "nloc": 16, + "complexity": 5, + "token_count": 76, + "parameters": [ + "logger" + ], + "start_line": 526, + "end_line": 541, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "decompress_file", + "long_name": "decompress_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 12, + "complexity": 3, + "token_count": 77, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 543, + "end_line": 554, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "untar_file", + "long_name": "untar_file( file , dst_dir = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 4, + "token_count": 70, + "parameters": [ + "file", + "dst_dir", + "logger", + "silent_failure" + ], + "start_line": 557, + "end_line": 567, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "unpack_file", + "long_name": "unpack_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 33, + "parameters": [ + "file", + "logger" + ], + "start_line": 569, + "end_line": 575, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 19, + "complexity": 9, + "token_count": 102, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 577, + "end_line": 595, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 0 + }, + { + "name": "mail_report", + "long_name": "mail_report( from_addr , to_addr , subject , mail_server , build_log , test_results , info )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 2, + "token_count": 113, + "parameters": [ + "from_addr", + "to_addr", + "subject", + "mail_server", + "build_log", + "test_results", + "info" + ], + "start_line": 597, + "end_line": 618, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , test_level = 10 , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 73, + "complexity": 3, + "token_count": 402, + "parameters": [ + "build_dir", + "test_level", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 621, + "end_line": 730, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 110, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 45, + "end_line": 76, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "init_names", + "long_name": "init_names( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 78, + "end_line": 80, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_source", + "long_name": "get_source( self )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 4, + "token_count": 39, + "parameters": [ + "self" + ], + "start_line": 82, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 99, + "end_line": 102, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "get_source_local", + "long_name": "get_source_local( self )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 2, + "token_count": 74, + "parameters": [ + "self" + ], + "start_line": 104, + "end_line": 115, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "get_source_ftp", + "long_name": "get_source_ftp( self )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 1, + "token_count": 136, + "parameters": [ + "self" + ], + "start_line": 117, + "end_line": 136, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , sub_dir = None )", + "filename": "auto_test.py", + "nloc": 20, + "complexity": 5, + "token_count": 153, + "parameters": [ + "self", + "sub_dir" + ], + "start_line": 138, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 165, + "end_line": 167, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 169, + "end_line": 171, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , prefix = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 2, + "token_count": 45, + "parameters": [ + "self", + "prefix" + ], + "start_line": 173, + "end_line": 177, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "python_setup", + "long_name": "python_setup( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 179, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 34, + "parameters": [ + "self", + "kw" + ], + "start_line": 183, + "end_line": 191, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "_setup", + "long_name": "_setup( self )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 21, + "parameters": [ + "self" + ], + "start_line": 193, + "end_line": 198, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 2, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 200, + "end_line": 212, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 73, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 220, + "end_line": 229, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 231, + "end_line": 241, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 243, + "end_line": 248, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_exe_name", + "long_name": "get_exe_name( self )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 56, + "parameters": [ + "self" + ], + "start_line": 250, + "end_line": 255, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 263, + "end_line": 273, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , subdir = None )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "subdir" + ], + "start_line": 275, + "end_line": 280, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 282, + "end_line": 284, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "kw" + ], + "start_line": 285, + "end_line": 288, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 290, + "end_line": 295, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 303, + "end_line": 313, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 315, + "end_line": 322, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "kw" + ], + "start_line": 324, + "end_line": 326, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 328, + "end_line": 333, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 341, + "end_line": 349, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 358, + "end_line": 367, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 378, + "end_line": 388, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 390, + "end_line": 391, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 392, + "end_line": 393, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "kw" + ], + "start_line": 394, + "end_line": 398, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 406, + "end_line": 414, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self" + ], + "start_line": 416, + "end_line": 430, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "copy_file", + "long_name": "copy_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 452, + "end_line": 460, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "copy_tree", + "long_name": "copy_tree( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 462, + "end_line": 470, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_tree", + "long_name": "remove_tree( directory , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "directory", + "logger" + ], + "start_line": 472, + "end_line": 480, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_file", + "long_name": "remove_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "file", + "logger" + ], + "start_line": 482, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_file", + "long_name": "write_file( file , contents , logger = None , mode = 'wb' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 3, + "token_count": 63, + "parameters": [ + "file", + "contents", + "logger", + "mode" + ], + "start_line": 492, + "end_line": 502, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "change_dir", + "long_name": "change_dir( d , logger = None )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 4, + "token_count": 78, + "parameters": [ + "d", + "logger" + ], + "start_line": 507, + "end_line": 520, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "unchange_dir", + "long_name": "unchange_dir( logger = None )", + "filename": "auto_test.py", + "nloc": 16, + "complexity": 5, + "token_count": 76, + "parameters": [ + "logger" + ], + "start_line": 526, + "end_line": 541, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "decompress_file", + "long_name": "decompress_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 12, + "complexity": 3, + "token_count": 77, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 543, + "end_line": 554, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "untar_file", + "long_name": "untar_file( file , dst_dir = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 4, + "token_count": 70, + "parameters": [ + "file", + "dst_dir", + "logger", + "silent_failure" + ], + "start_line": 557, + "end_line": 567, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "unpack_file", + "long_name": "unpack_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 33, + "parameters": [ + "file", + "logger" + ], + "start_line": 569, + "end_line": 575, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 19, + "complexity": 9, + "token_count": 102, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 577, + "end_line": 595, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 0 + }, + { + "name": "mail_report", + "long_name": "mail_report( from_addr , to_addr , subject , mail_server , build_log , test_results , info )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 2, + "token_count": 113, + "parameters": [ + "from_addr", + "to_addr", + "subject", + "mail_server", + "build_log", + "test_results", + "info" + ], + "start_line": 597, + "end_line": 618, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , test_level = 10 , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 72, + "complexity": 3, + "token_count": 396, + "parameters": [ + "build_dir", + "test_level", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 621, + "end_line": 729, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 109, + "top_nesting_level": 0 + } + ], + "changed_methods": [ + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , test_level = 10 , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 73, + "complexity": 3, + "token_count": 402, + "parameters": [ + "build_dir", + "test_level", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 621, + "end_line": 730, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 110, + "top_nesting_level": 0 + } + ], + "nloc": 520, + "complexity": 96, + "token_count": 3394, + "diff_parsed": { + "added": [ + " logger.info('Beginning Test')" + ], + "deleted": [] + } + } + ] + }, + { + "hash": "bd759c9e5f0f523bf6e85793ea2cdaab5f181015", + "msg": "script output is much less verbose now. Instead of 700K files on complete tests, they are more like 18K.", + "author": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "committer": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "author_date": "2002-04-12T20:09:50+00:00", + "author_timezone": 0, + "committer_date": "2002-04-12T20:09:50+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "50ab5c0e56f6a86839839504fcb9dc80c055f4b4" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 43, + "insertions": 66, + "lines": 109, + "files": 1, + "dmm_unit_size": 0.0, + "dmm_unit_complexity": 1.0, + "dmm_unit_interfacing": 1.0, + "modified_files": [ + { + "old_path": "scipy_distutils/auto_test.py", + "new_path": "scipy_distutils/auto_test.py", + "filename": "auto_test.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -64,14 +64,14 @@ def __init__(self,version='', dst_dir = '.',\n # Directory where package is unpacked/built/installed\n self.dst_dir = os.path.abspath(dst_dir) \n \n- # make sure the destination exists\n- dir_util.mkpath(self.dst_dir)\n- \n if not logger:\n self.logger = logging\n else:\n self.logger = logger \n \n+ # make sure the destination exists\n+ make_dir(self.dst_dir,logger=self.logger)\n+\n # Construct any derived names built from the above names.\n self.init_names()\n \n@@ -162,40 +162,44 @@ def unpack_source(self,sub_dir = None):\n if old_dir:\n unchange_dir(self.logger)\n \n+ #def auto_configure(self):\n+ # cmd = os.path.join('.','configure')\n+ # try:\n+ # text = run_command(cmd,self.package_dir,self.logger,log_output=0)\n+ # except ValueError, e:\n+ # status, text = e\n+ # self.logger.exception('Configuration Error:\\n'+text)\n def auto_configure(self):\n cmd = os.path.join('.','configure')\n text = run_command(cmd,self.package_dir,self.logger)\n-\n+ \n def build_with_make(self):\n cmd = 'make'\n text = run_command(cmd,self.package_dir,self.logger)\n-\n+ \n def install_with_make(self, prefix = None):\n if prefix is None:\n prefix = os.path.abspath(self.dst_dir)\n cmd = 'make install prefix=%s' % prefix\n text = run_command(cmd,self.package_dir,self.logger)\n-\n+ \n def python_setup(self):\n cmd = self.python_exe + ' setup.py install'\n text = run_command(cmd,self.package_dir,self.logger)\n- \n+ \n def _make(self,**kw):\n \"\"\" This generally needs to be overrridden in the derived class,\n but this will suffice for the standard configure/make process. \n \"\"\"\n- self.get_source()\n- self.unpack_source()\n+ self.logger.info(\"### Begin Configure: %s\" % self.package_base_name)\n self.auto_configure()\n+ self.logger.info(\"### Finished Configure: %s\" % self.package_base_name)\n+ self.logger.info(\"### Begin Build: %s\" % self.package_base_name)\n self.build_with_make()\n+ self.logger.info(\"### Finished Build: %s\" % self.package_base_name)\n+ self.logger.info(\"### Begin Install: %s\" % self.package_base_name)\n self.install_with_make()\n-\n- def _setup(self):\n- \"\"\" Build with Python setup script.\n- \"\"\"\n- self.get_source()\n- self.unpack_source()\n- self.python_setup()\n+ self.logger.info(\"### Finished Install: %s\" % self.package_base_name)\n \n def install(self):\n self.logger.info('####### Building: %s' % self.package_base_name)\n@@ -205,8 +209,14 @@ def install(self):\n self.logger.info(' Package dir: %s' % self.package_dir)\n self.logger.info(' Suffix: %s' % self.tarball_suffix)\n self.logger.info(' Build type: %s' % self.build_type)\n+\n+ self.logger.info(\"### Begin Get Source: %s\" % self.package_base_name)\n+ self.get_source()\n+ self.unpack_source()\n+ self.logger.info(\"### Finished Get Source: %s\" % self.package_base_name)\n+\n if self.build_type == 'setup':\n- self._setup()\n+ self.python_setup()\n else: \n self._make()\n self.logger.info('####### Finished Building: %s' % self.package_base_name) \n@@ -235,15 +245,17 @@ def write_install_config(self):\n [install_script]\n install-dir= \n \"\"\"\n+ self.logger.info('### Writing Install Script Hack')\n text = \"[install_scripts]\\n\"\\\n \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n file = os.path.join(self.package_dir,'setup.cfg') \n write_file(file,text,self.logger,mode='w')\n+ self.logger.info('### Finished writing Install Script Hack')\n \n def install_with_make(self):\n \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n file is written to force installation in the correct place.\n- \"\"\"\n+ \"\"\" \n self.write_install_config()\n package_installation.install_with_make(self)\n \n@@ -286,14 +298,14 @@ def build_with_make(self, **kw):\n libname = 'blas_LINUX.a'\n cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n text = run_command(cmd,self.package_dir,self.logger)\n-\n+ \n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over. \n src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n self.logger.info(\"Installing blas\")\n copy_file(src_file,dst_file,self.logger)\n-\n+ \n #-----------------------------------------------------------------------------\n # Installation class for Lapack.\n #-----------------------------------------------------------------------------\n@@ -320,18 +332,17 @@ def auto_configure(self):\n src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n dst_file = os.path.join(self.package_dir,'make.inc')\n copy_file(src_file,dst_file,self.logger)\n-\n+ \n def build_with_make(self, **kw):\n cmd = 'make install lapacklib'\n text = run_command(cmd,self.package_dir,self.logger)\n-\n+ \n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over.\n src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n- dst_file = os.path.join(self.dst_dir,'lib','liblapack.a')\n- self.logger.info(\"Installing lapack\")\n+ dst_file = os.path.join(self.dst_dir,'lib','liblapack.a') \n copy_file(src_file,dst_file,self.logger)\n- \n+\n #-----------------------------------------------------------------------------\n # Installation class for Numeric\n #-----------------------------------------------------------------------------\n@@ -476,7 +487,7 @@ def remove_tree(directory,logger=None):\n try:\n dir_util.remove_tree(directory)\n except Exception, e: \n- logger.exception(\"Remove failed\") \n+ logger.exception(\"Remove failed: %s\" % e) \n raise\n \n def remove_file(file,logger=None):\n@@ -501,6 +512,16 @@ def write_file(file,contents,logger=None,mode='wb'):\n logger.exception(\"Write failed\") \n raise\n \n+def make_dir(name,logger=None):\n+ if not logger:\n+ logger = logging\n+ logger.info('Make directory: %s' % name)\n+ try: \n+ dir_util.mkpath(os.path.abspath(name))\n+ except Exception, e: \n+ logger.exception(\"Make Directory failed\") \n+ raise\n+\n # I know, I know...\n old_dir = []\n \n@@ -574,24 +595,24 @@ def unpack_file(file,logger = None):\n untar_file(dst.logger)\n remove_file(dst,logger) \n \n+\n def run_command(cmd,directory='.',logger=None,silent_failure = 0):\n if not logger:\n logger = logging\n change_dir(directory,logger) \n try: \n- msg = 'Command: %s' % cmd\n- status,text = exec_command(cmd)\n- if status:\n- msg = msg + ' (failed)'\n+ msg = 'Running: %s' % cmd\n logger.info(msg) \n- if status and not silent_failure:\n- logger.error('command failed with status: %d' % status) \n- if text and not silent_failure:\n- logger.info('Command Output:\\n'+text)\n+ status,text = exec_command(cmd)\n+ if status and silent_failure:\n+ msg = '(failed silently)'\n+ logger.info(msg) \n+ if status and text and not silent_failure:\n+ logger.error('Command Failed (status=%d)\\n'% status +text)\n finally:\n unchange_dir(logger)\n if status:\n- raise ValueError,status\n+ raise ValueError, (status,text)\n return text \n \n def mail_report(from_addr,to_addr,subject,mail_server,\n@@ -604,7 +625,7 @@ def mail_report(from_addr,to_addr,subject,mail_server,\n \n for k,v in info.items(): \n msg = msg + '%s: %s\\n' % (k,v)\n- msg = msg + test_results \n+ msg = msg + test_results + '\\n'\n msg = msg + '-----------------------------\\n' \n msg = msg + '-------- BUILD LOG -------\\n' \n msg = msg + '-----------------------------\\n' \n@@ -654,12 +675,12 @@ def full_scipy_build(build_dir = '.',\n \n # before doing anything, we need to wipe the \n # /bin, /lib, /man, and /include directories\n- # in dst_dir. Don't run as root.\n+ # in dst_dir. Don't run as root. \n+ make_dir(dst_dir,logger=logger) \n change_dir(dst_dir , logger)\n- remove_tree('bin' , logger)\n- remove_tree('lib' , logger)\n- remove_tree('man' , logger)\n- remove_tree('include', logger)\n+ for d in ['bin','lib','man','include']:\n+ try: remove_tree(d, logger)\n+ except OSError: pass \n unchange_dir(logger)\n \n python = python_installation(version=python_version,\n@@ -720,6 +741,7 @@ def full_scipy_build(build_dir = '.',\n except Exception, msg:\n test_results = ''\n build_info['results'] = 'build failed: %s' % msg\n+ logger.exception('Build failed')\n finally: \n to_addr = \"scipy-testlog@scipy.org\"\n from_addr = \"scipy-test@enthought.com\"\n@@ -731,7 +753,8 @@ def full_scipy_build(build_dir = '.',\n \n if __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n- level = 10\n+ level = 1\n+ \"\"\"\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.2.1',\n@@ -774,7 +797,7 @@ def full_scipy_build(build_dir = '.',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n-\n+ \"\"\"\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n", + "added_lines": 66, + "deleted_lines": 43, + "source_code": "\"\"\" Auto test tools for SciPy\n\n Do not run this as root! If you enter something\n like /usr as your test directory, it'll delete\n /usr/bin, usr/lib, etc. So don't do it!!!\n \n \n Author: Eric Jones (eric@enthought.com)\n\"\"\"\nfrom distutils import file_util\nfrom distutils import dir_util\nfrom distutils.errors import DistutilsFileError\n#import tarfile\nimport sys, os, stat, time\nimport gzip\nimport tempfile, cStringIO\nimport urllib\nimport logging\n\nif sys.platform == 'cygwin':\n local_repository = \"/cygdrive/i/tarballs\"\nelif sys.platform == 'win32': \n local_repository = \"i:\\tarballs\"\nelse:\n local_repository = \"/home/shared/tarballs\"\n\nlocal_mail_server = \"enthought.com\"\n\npython_ftp_url = \"ftp://ftp.python.org/pub/python\"\nnumeric_url = \"http://prdownloads.sourceforge.net/numpy\"\nf2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\nscipy_url = \"ftp://www.scipy.org/pub\"\nblas_url = \"http://www.netlib.org/blas\"\nlapack_url = \"http://www.netlib.org/lapack\"\n#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\natlas_url = \"http://www.scipy.org/Members/eric\"\n\n\n#-----------------------------------------------------------------------------\n# Generic installation class. \n# built to handle downloading/untarring/building/installing arbitrary software\n#-----------------------------------------------------------------------------\n\nclass package_installation: \n def __init__(self,version='', dst_dir = '.',\n logger = None, python_exe='python'):\n #---------------------------------------------------------------------\n # These should be defined in sub-class before calling this\n # constructor\n #---------------------------------------------------------------------\n # \n #self.package_url -- The name of the url where tarball can be found.\n #self.package_base_name -- The base name of the source tarball.\n #self.package_dir_name -- Top level directory of unpacked tarball\n #self.tarball_suffix -- usually tar.gz or .tgz\n #self.build_type -- 'make' or 'setup' for makefile or python setup file\n \n # Version of the software package.\n self.version = version\n\n # Only used by packages built with setup.py\n self.python_exe = python_exe\n \n # Directory where package is unpacked/built/installed\n self.dst_dir = os.path.abspath(dst_dir) \n \n if not logger:\n self.logger = logging\n else:\n self.logger = logger \n\n # make sure the destination exists\n make_dir(self.dst_dir,logger=self.logger)\n\n # Construct any derived names built from the above names.\n self.init_names()\n \n def init_names(self): \n self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)\n self.tarball = self.package_base_name + '.' + self.tarball_suffix\n\n def get_source(self):\n \"\"\" Grab the source tarball from a repository.\n \n Try a local repository first. If the file isn't found,\n grab it from an ftp site.\n \"\"\"\n local_found = 0\n if self.local_source_up_to_date():\n try:\n self.get_source_local()\n local_found = 1 \n except DistutilsFileError:\n pass\n \n if not local_found:\n self.get_source_ftp()\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n return 1\n \n def get_source_local(self):\n \"\"\" Grab the requested tarball from a local repository of source\n tarballs. If it doesn't exist, an error is raised.\n \"\"\"\n file = os.path.join(local_repository,self.tarball) \n dst_file = os.path.join(self.dst_dir,self.tarball)\n self.logger.info(\"Searching local repository for %s\" % file)\n try:\n copy_file(file,dst_file,self.logger)\n except DistutilsFileError, msg:\n self.logger.info(\"Not found:\",msg)\n raise\n \n def get_source_ftp(self):\n \"\"\" Grab requested tarball from a ftp site specified as a url. \n \"\"\"\n url = '/'.join([self.package_url,self.tarball])\n \n self.logger.info('Opening: %s' % url)\n f = urllib.urlopen(url)\n self.logger.info('Downloading: this may take a while')\n contents = f.read(-1)\n f.close()\n self.logger.info('Finished download (size=%d)' % len(contents))\n \n output_file = os.path.join(self.dst_dir,self.tarball)\n write_file(output_file,contents,self.logger)\n\n # Put file in local repository so we don't have to download it again.\n self.logger.info(\"Caching file in repository\" )\n src_file = output_file\n repos_file = os.path.join(local_repository,self.tarball) \n copy_file(src_file,repos_file,self.logger)\n\n def unpack_source(self,sub_dir = None):\n \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir\n \"\"\" \n tarfile = os.path.join(self.dst_dir,self.tarball)\n old_dir = None\n \n # copy and move into sub directory if it is specified.\n if sub_dir:\n dst_dir = os.path.join(self.dst_dir,sub_dir)\n dst_file = os.path.join(dst_dir,self.tarball)\n copy_file(tarfile,dst_file)\n change_dir(dst_dir,self.logger)\n try:\n try:\n # occasionally the tarball is not zipped, try this first.\n untar_file(self.tarball,self.dst_dir,\n self.logger,silent_failure=1)\n except:\n # otherwise, handle the fact that it is zipped \n dst = os.path.join(self.dst_dir,'tmp.tar') \n decompress_file(tarfile,dst,self.logger) \n untar_file(dst,self.dst_dir,self.logger)\n remove_file(dst,self.logger)\n finally:\n if old_dir:\n unchange_dir(self.logger)\n\n #def auto_configure(self):\n # cmd = os.path.join('.','configure')\n # try:\n # text = run_command(cmd,self.package_dir,self.logger,log_output=0)\n # except ValueError, e:\n # status, text = e\n # self.logger.exception('Configuration Error:\\n'+text)\n def auto_configure(self):\n cmd = os.path.join('.','configure')\n text = run_command(cmd,self.package_dir,self.logger)\n \n def build_with_make(self):\n cmd = 'make'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, prefix = None):\n if prefix is None:\n prefix = os.path.abspath(self.dst_dir)\n cmd = 'make install prefix=%s' % prefix\n text = run_command(cmd,self.package_dir,self.logger)\n \n def python_setup(self):\n cmd = self.python_exe + ' setup.py install'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def _make(self,**kw):\n \"\"\" This generally needs to be overrridden in the derived class,\n but this will suffice for the standard configure/make process. \n \"\"\"\n self.logger.info(\"### Begin Configure: %s\" % self.package_base_name)\n self.auto_configure()\n self.logger.info(\"### Finished Configure: %s\" % self.package_base_name)\n self.logger.info(\"### Begin Build: %s\" % self.package_base_name)\n self.build_with_make()\n self.logger.info(\"### Finished Build: %s\" % self.package_base_name)\n self.logger.info(\"### Begin Install: %s\" % self.package_base_name)\n self.install_with_make()\n self.logger.info(\"### Finished Install: %s\" % self.package_base_name)\n\n def install(self):\n self.logger.info('####### Building: %s' % self.package_base_name)\n self.logger.info(' Version: %s' % self.version)\n self.logger.info(' Url: %s' % self.package_url)\n self.logger.info(' Install dir: %s' % self.dst_dir)\n self.logger.info(' Package dir: %s' % self.package_dir)\n self.logger.info(' Suffix: %s' % self.tarball_suffix)\n self.logger.info(' Build type: %s' % self.build_type)\n\n self.logger.info(\"### Begin Get Source: %s\" % self.package_base_name)\n self.get_source()\n self.unpack_source()\n self.logger.info(\"### Finished Get Source: %s\" % self.package_base_name)\n\n if self.build_type == 'setup':\n self.python_setup()\n else: \n self._make()\n self.logger.info('####### Finished Building: %s' % self.package_base_name) \n \n#-----------------------------------------------------------------------------\n# Installation class for Python itself.\n#-----------------------------------------------------------------------------\n \nclass python_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Python. \n self.package_base_name = 'Python-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = '/'.join([python_ftp_url,version])\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def write_install_config(self): \n \"\"\" Make doesn't seem to install scripts in the correct places.\n \n Writing this to the python directory will solve the problem.\n [install_script]\n install-dir= \n \"\"\"\n self.logger.info('### Writing Install Script Hack')\n text = \"[install_scripts]\\n\"\\\n \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n file = os.path.join(self.package_dir,'setup.cfg') \n write_file(file,text,self.logger,mode='w')\n self.logger.info('### Finished writing Install Script Hack')\n\n def install_with_make(self):\n \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n file is written to force installation in the correct place.\n \"\"\" \n self.write_install_config()\n package_installation.install_with_make(self)\n\n def get_exe_name(self):\n pyname = os.path.join('.','python')\n cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"\n text = run_command(cmd,self.package_dir,self.logger)\n exe = os.path.join(self.dst_dir,'bin','python'+text)\n return exe\n\n#-----------------------------------------------------------------------------\n# Installation class for Blas.\n#-----------------------------------------------------------------------------\n\nclass blas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for for \"slow\" blas\n self.package_base_name = 'blas'\n self.package_dir_name = 'BLAS'\n self.package_url = blas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def unpack_source(self,subdir=None):\n \"\"\" Dag. blas.tgz doesn't have directory information -- its\n just a tar ball of fortran source code. untar it in the\n BLAS directory\n \"\"\"\n package_installation.unpack_source(self,self.package_dir_name)\n \n def auto_configure(self):\n # nothing to do.\n pass\n def build_with_make(self, **kw):\n libname = 'blas_LINUX.a'\n cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over. \n src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n self.logger.info(\"Installing blas\")\n copy_file(src_file,dst_file,self.logger)\n \n#-----------------------------------------------------------------------------\n# Installation class for Lapack.\n#-----------------------------------------------------------------------------\n\nclass lapack_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Lapack 3.0 + updates \n self.package_base_name = 'lapack'\n self.package_dir_name = 'LAPACK'\n self.package_url = lapack_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self):\n # perhaps this should actually override auto_conifgure\n # before make, we need to copy the appropriate setup file in.\n # should work anywhere g77 works...\n make_inc = 'make.inc.' + self.platform\n src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n dst_file = os.path.join(self.package_dir,'make.inc')\n copy_file(src_file,dst_file,self.logger)\n \n def build_with_make(self, **kw):\n cmd = 'make install lapacklib'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over.\n src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','liblapack.a') \n copy_file(src_file,dst_file,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for Numeric\n#-----------------------------------------------------------------------------\n\nclass numeric_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'Numeric-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = numeric_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for f2py\n#-----------------------------------------------------------------------------\n\nclass f2py_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Typical file format: F2PY-2.13.175-1250.tar.gz\n self.package_base_name = 'F2PY-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = f2py_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for Atlas.\n# This is a binary install *NOT* a source install.\n# The source install is a pain to automate.\n#-----------------------------------------------------------------------------\n\nclass atlas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n #self.package_base_name = 'atlas' + version\n #self.package_dir_name = 'ATLAS'\n self.package_base_name = 'atlas-RH7.1-PIII'\n self.package_dir_name = 'atlas'\n self.package_url = atlas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self,**kw):\n pass\n def build_with_make(self,**kw):\n pass\n def install_with_make(self, **kw):\n # just copy the tree over.\n dst = os.path.join(self.dst_dir,'lib','atlas')\n self.logger.info(\"Installing Atlas\")\n copy_tree(self.package_dir,dst,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for scipy\n#-----------------------------------------------------------------------------\n\nclass scipy_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'scipy_snapshot'\n self.package_dir_name = 'scipy'\n self.package_url = scipy_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'setup'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n file = os.path.join(local_repository,self.tarball)\n up_to_date = 0\n try:\n file_time = os.stat(file)[stat.ST_MTIME] \n fyear,fmonth,fday = time.localtime(file_time)[:3]\n year,month,day = time.localtime()[:3]\n if year == year and month == month and day == day:\n up_to_date = 1\n self.logger.info(\"Repository file up to date: %s\" % file)\n except OSError, msg:\n pass\n return up_to_date\n \n#-----------------------------------------------------------------------------\n# Utilities\n#-----------------------------------------------------------------------------\n\n\n#if os.name == 'nt':\n# def exec_command(command):\n# \"\"\" not sure how to get exit status on nt. \"\"\"\n# in_pipe,out_pipe = os.popen4(command)\n# in_pipe.close()\n# text = out_pipe.read()\n# return 0, text\n#else:\n# import commands\n# exec_command = commands.getstatusoutput\n \n# This may not work on Win98... The above stuff was to handle these machines.\nimport commands\nexec_command = commands.getstatusoutput\n\ndef copy_file(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying %s->%s\" % (src,dst)) \n try:\n file_util.copy_file(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef copy_tree(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying directory tree %s->%s\" % (src,dst)) \n try:\n dir_util.copy_tree(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef remove_tree(directory,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Removing directory tree %s\" % directory) \n try:\n dir_util.remove_tree(directory)\n except Exception, e: \n logger.exception(\"Remove failed: %s\" % e) \n raise\n\ndef remove_file(file,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Remove file %s\" % file) \n try:\n os.remove(file)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef write_file(file,contents,logger=None,mode='wb'):\n if not logger:\n logger = logging\n logger.info('Write file: %s' % file)\n try:\n new_file = open(file,mode)\n new_file.write(contents)\n new_file.close()\n except Exception, e: \n logger.exception(\"Write failed\") \n raise\n\ndef make_dir(name,logger=None):\n if not logger:\n logger = logging\n logger.info('Make directory: %s' % name)\n try: \n dir_util.mkpath(os.path.abspath(name))\n except Exception, e: \n logger.exception(\"Make Directory failed\") \n raise\n\n# I know, I know...\nold_dir = []\n\ndef change_dir(d, logger = None):\n if not logger:\n logger = logging\n global old_dir \n cwd = os.getcwd() \n old_dir.append(cwd)\n d = os.path.abspath(d)\n if d != old_dir[-1]:\n logger.info(\"Change directory: %s\" % d) \n try:\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n #if d == '.':\n # import sys,traceback\n # f = sys._getframe()\n # traceback.print_stack(f)\n\ndef unchange_dir(logger=None):\n if not logger:\n logger = logging \n global old_dir\n try:\n cwd = os.getcwd()\n d = old_dir.pop(-1) \n try:\n if d != cwd:\n logger.info(\"Change directory : %s\" % d)\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n except IndexError:\n logger.exception(\"Change directory failed\")\n \ndef decompress_file(src,dst,logger = None):\n if not logger:\n logger = logging\n logger.info(\"Upacking %s->%s\" % (src,dst))\n try:\n f = gzip.open(src,'rb')\n contents = f.read(-1)\n f = open(dst, 'wb')\n f.write(contents)\n except Exception, e: \n logger.exception(\"Unpack failed\")\n raise \n\n \ndef untar_file(file,dst_dir='.',logger = None,silent_failure = 0): \n if not logger:\n logger = logging\n logger.info(\"Untarring file: %s\" % (file))\n try:\n run_command('tar -xf ' + file,directory = dst_dir,\n logger=logger, silent_failure = silent_failure)\n except Exception, e:\n if not silent_failure: \n logger.exception(\"Untar failed\")\n raise \n\ndef unpack_file(file,logger = None):\n \"\"\" equivalent to 'tar -xzvf file'\n \"\"\"\n dst = 'tmp.tar'\n decompress_file(file,dst,logger) \n untar_file(dst.logger)\n remove_file(dst,logger) \n\n\ndef run_command(cmd,directory='.',logger=None,silent_failure = 0):\n if not logger:\n logger = logging\n change_dir(directory,logger) \n try: \n msg = 'Running: %s' % cmd\n logger.info(msg) \n status,text = exec_command(cmd)\n if status and silent_failure:\n msg = '(failed silently)'\n logger.info(msg) \n if status and text and not silent_failure:\n logger.error('Command Failed (status=%d)\\n'% status +text)\n finally:\n unchange_dir(logger)\n if status:\n raise ValueError, (status,text)\n return text \n\ndef mail_report(from_addr,to_addr,subject,mail_server,\n build_log, test_results,info):\n \n msg = ''\n msg = msg + 'To: %s\\n' % to_addr\n msg = msg + 'Subject: %s\\n' % subject\n msg = msg + '\\r\\n\\r\\n'\n\n for k,v in info.items(): \n msg = msg + '%s: %s\\n' % (k,v)\n msg = msg + test_results + '\\n'\n msg = msg + '-----------------------------\\n' \n msg = msg + '-------- BUILD LOG -------\\n' \n msg = msg + '-----------------------------\\n' \n msg = msg + build_log\n print msg\n \n # mail results\n import smtplib \n server = smtplib.SMTP(mail_server) \n server.sendmail(from_addr, to_addr, msg)\n server.quit()\n \n\ndef full_scipy_build(build_dir = '.',\n test_level = 10,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot'):\n \n # for now the atlas version is ignored. Only the \n # binaries for RH are supported at the moment.\n\n build_info = {'python_version' : python_version,\n 'test_level' : test_level,\n 'numeric_version': numeric_version,\n 'f2py_version' : f2py_version,\n 'atlas_version' : atlas_version,\n 'scipy_version' : scipy_version}\n \n dst_dir = os.path.join(build_dir,sys.platform)\n\n logger = logging.Logger(\"SciPy Test\")\n fmt = logging.Formatter(logging.BASIC_FORMAT)\n log_stream = cStringIO.StringIO()\n stream_handler = logging.StreamHandler(log_stream)\n stream_handler.setFormatter(fmt)\n logger.addHandler(stream_handler)\n # also write to stderr\n stderr = logging.StreamHandler()\n stderr.setFormatter(fmt)\n logger.addHandler(stderr)\n\n try:\n try: \n \n # before doing anything, we need to wipe the \n # /bin, /lib, /man, and /include directories\n # in dst_dir. Don't run as root. \n make_dir(dst_dir,logger=logger) \n change_dir(dst_dir , logger)\n for d in ['bin','lib','man','include']:\n try: remove_tree(d, logger)\n except OSError: pass \n unchange_dir(logger)\n \n python = python_installation(version=python_version,\n logger = logger,\n dst_dir = dst_dir)\n python.install()\n \n python_name = python.get_exe_name()\n \n numeric = numeric_installation(version=numeric_version,\n dst_dir = dst_dir,\n logger = logger,\n python_exe=python_name)\n numeric.install()\n \n f2py = f2py_installation(version=f2py_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n f2py.install() \n \n # download files don't have a version specified \n #lapack = lapack_installation(version='',\n # dst_dir = dst_dir\n # python_exe=python_name)\n #lapack.install() \n \n # download files don't have a version specified \n #blas = blas_installation(version='',\n # logger = logger,\n # dst_dir = dst_dir,\n # python_exe=python_name)\n #blas.install() \n \n # ATLAS\n atlas = atlas_installation(version=atlas_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n atlas.install()\n \n # version not currently used -- need to fix this.\n scipy = scipy_installation(version=scipy_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n scipy.install() \n \n # The change to tmp makes sure there isn't a scipy directory in \n # the local scope.\n # All tests are run.\n logger.info('Beginning Test')\n cmd = python_name +' -c \"import sys,scipy;suite=scipy.test(%d);\"'\\\n % test_level\n test_results = run_command(cmd, logger=logger,\n directory = tempfile.gettempdir())\n build_info['results'] = 'test completed (check below for pass/fail)'\n except Exception, msg:\n test_results = ''\n build_info['results'] = 'build failed: %s' % msg\n logger.exception('Build failed')\n finally: \n to_addr = \"scipy-testlog@scipy.org\"\n from_addr = \"scipy-test@enthought.com\"\n subject = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n numeric_version,scipy_version) \n build_log = log_stream.getvalue()\n mail_report(from_addr,to_addr,subject,local_mail_server,\n build_log,test_results,build_info)\n\nif __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n level = 1\n \"\"\"\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n # an older python\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older numeric\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.3',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # This fails because multiarray doesn't have \n # arange defined.\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '19.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n \"\"\"\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '18.4.1',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n", + "source_code_before": "\"\"\" Auto test tools for SciPy\n\n Do not run this as root! If you enter something\n like /usr as your test directory, it'll delete\n /usr/bin, usr/lib, etc. So don't do it!!!\n \n \n Author: Eric Jones (eric@enthought.com)\n\"\"\"\nfrom distutils import file_util\nfrom distutils import dir_util\nfrom distutils.errors import DistutilsFileError\n#import tarfile\nimport sys, os, stat, time\nimport gzip\nimport tempfile, cStringIO\nimport urllib\nimport logging\n\nif sys.platform == 'cygwin':\n local_repository = \"/cygdrive/i/tarballs\"\nelif sys.platform == 'win32': \n local_repository = \"i:\\tarballs\"\nelse:\n local_repository = \"/home/shared/tarballs\"\n\nlocal_mail_server = \"enthought.com\"\n\npython_ftp_url = \"ftp://ftp.python.org/pub/python\"\nnumeric_url = \"http://prdownloads.sourceforge.net/numpy\"\nf2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\nscipy_url = \"ftp://www.scipy.org/pub\"\nblas_url = \"http://www.netlib.org/blas\"\nlapack_url = \"http://www.netlib.org/lapack\"\n#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\natlas_url = \"http://www.scipy.org/Members/eric\"\n\n\n#-----------------------------------------------------------------------------\n# Generic installation class. \n# built to handle downloading/untarring/building/installing arbitrary software\n#-----------------------------------------------------------------------------\n\nclass package_installation: \n def __init__(self,version='', dst_dir = '.',\n logger = None, python_exe='python'):\n #---------------------------------------------------------------------\n # These should be defined in sub-class before calling this\n # constructor\n #---------------------------------------------------------------------\n # \n #self.package_url -- The name of the url where tarball can be found.\n #self.package_base_name -- The base name of the source tarball.\n #self.package_dir_name -- Top level directory of unpacked tarball\n #self.tarball_suffix -- usually tar.gz or .tgz\n #self.build_type -- 'make' or 'setup' for makefile or python setup file\n \n # Version of the software package.\n self.version = version\n\n # Only used by packages built with setup.py\n self.python_exe = python_exe\n \n # Directory where package is unpacked/built/installed\n self.dst_dir = os.path.abspath(dst_dir) \n \n # make sure the destination exists\n dir_util.mkpath(self.dst_dir)\n \n if not logger:\n self.logger = logging\n else:\n self.logger = logger \n\n # Construct any derived names built from the above names.\n self.init_names()\n \n def init_names(self): \n self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)\n self.tarball = self.package_base_name + '.' + self.tarball_suffix\n\n def get_source(self):\n \"\"\" Grab the source tarball from a repository.\n \n Try a local repository first. If the file isn't found,\n grab it from an ftp site.\n \"\"\"\n local_found = 0\n if self.local_source_up_to_date():\n try:\n self.get_source_local()\n local_found = 1 \n except DistutilsFileError:\n pass\n \n if not local_found:\n self.get_source_ftp()\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n return 1\n \n def get_source_local(self):\n \"\"\" Grab the requested tarball from a local repository of source\n tarballs. If it doesn't exist, an error is raised.\n \"\"\"\n file = os.path.join(local_repository,self.tarball) \n dst_file = os.path.join(self.dst_dir,self.tarball)\n self.logger.info(\"Searching local repository for %s\" % file)\n try:\n copy_file(file,dst_file,self.logger)\n except DistutilsFileError, msg:\n self.logger.info(\"Not found:\",msg)\n raise\n \n def get_source_ftp(self):\n \"\"\" Grab requested tarball from a ftp site specified as a url. \n \"\"\"\n url = '/'.join([self.package_url,self.tarball])\n \n self.logger.info('Opening: %s' % url)\n f = urllib.urlopen(url)\n self.logger.info('Downloading: this may take a while')\n contents = f.read(-1)\n f.close()\n self.logger.info('Finished download (size=%d)' % len(contents))\n \n output_file = os.path.join(self.dst_dir,self.tarball)\n write_file(output_file,contents,self.logger)\n\n # Put file in local repository so we don't have to download it again.\n self.logger.info(\"Caching file in repository\" )\n src_file = output_file\n repos_file = os.path.join(local_repository,self.tarball) \n copy_file(src_file,repos_file,self.logger)\n\n def unpack_source(self,sub_dir = None):\n \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir\n \"\"\" \n tarfile = os.path.join(self.dst_dir,self.tarball)\n old_dir = None\n \n # copy and move into sub directory if it is specified.\n if sub_dir:\n dst_dir = os.path.join(self.dst_dir,sub_dir)\n dst_file = os.path.join(dst_dir,self.tarball)\n copy_file(tarfile,dst_file)\n change_dir(dst_dir,self.logger)\n try:\n try:\n # occasionally the tarball is not zipped, try this first.\n untar_file(self.tarball,self.dst_dir,\n self.logger,silent_failure=1)\n except:\n # otherwise, handle the fact that it is zipped \n dst = os.path.join(self.dst_dir,'tmp.tar') \n decompress_file(tarfile,dst,self.logger) \n untar_file(dst,self.dst_dir,self.logger)\n remove_file(dst,self.logger)\n finally:\n if old_dir:\n unchange_dir(self.logger)\n\n def auto_configure(self):\n cmd = os.path.join('.','configure')\n text = run_command(cmd,self.package_dir,self.logger)\n\n def build_with_make(self):\n cmd = 'make'\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, prefix = None):\n if prefix is None:\n prefix = os.path.abspath(self.dst_dir)\n cmd = 'make install prefix=%s' % prefix\n text = run_command(cmd,self.package_dir,self.logger)\n\n def python_setup(self):\n cmd = self.python_exe + ' setup.py install'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def _make(self,**kw):\n \"\"\" This generally needs to be overrridden in the derived class,\n but this will suffice for the standard configure/make process. \n \"\"\"\n self.get_source()\n self.unpack_source()\n self.auto_configure()\n self.build_with_make()\n self.install_with_make()\n\n def _setup(self):\n \"\"\" Build with Python setup script.\n \"\"\"\n self.get_source()\n self.unpack_source()\n self.python_setup()\n\n def install(self):\n self.logger.info('####### Building: %s' % self.package_base_name)\n self.logger.info(' Version: %s' % self.version)\n self.logger.info(' Url: %s' % self.package_url)\n self.logger.info(' Install dir: %s' % self.dst_dir)\n self.logger.info(' Package dir: %s' % self.package_dir)\n self.logger.info(' Suffix: %s' % self.tarball_suffix)\n self.logger.info(' Build type: %s' % self.build_type)\n if self.build_type == 'setup':\n self._setup()\n else: \n self._make()\n self.logger.info('####### Finished Building: %s' % self.package_base_name) \n \n#-----------------------------------------------------------------------------\n# Installation class for Python itself.\n#-----------------------------------------------------------------------------\n \nclass python_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Python. \n self.package_base_name = 'Python-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = '/'.join([python_ftp_url,version])\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def write_install_config(self): \n \"\"\" Make doesn't seem to install scripts in the correct places.\n \n Writing this to the python directory will solve the problem.\n [install_script]\n install-dir= \n \"\"\"\n text = \"[install_scripts]\\n\"\\\n \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n file = os.path.join(self.package_dir,'setup.cfg') \n write_file(file,text,self.logger,mode='w')\n\n def install_with_make(self):\n \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n file is written to force installation in the correct place.\n \"\"\"\n self.write_install_config()\n package_installation.install_with_make(self)\n\n def get_exe_name(self):\n pyname = os.path.join('.','python')\n cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"\n text = run_command(cmd,self.package_dir,self.logger)\n exe = os.path.join(self.dst_dir,'bin','python'+text)\n return exe\n\n#-----------------------------------------------------------------------------\n# Installation class for Blas.\n#-----------------------------------------------------------------------------\n\nclass blas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for for \"slow\" blas\n self.package_base_name = 'blas'\n self.package_dir_name = 'BLAS'\n self.package_url = blas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def unpack_source(self,subdir=None):\n \"\"\" Dag. blas.tgz doesn't have directory information -- its\n just a tar ball of fortran source code. untar it in the\n BLAS directory\n \"\"\"\n package_installation.unpack_source(self,self.package_dir_name)\n \n def auto_configure(self):\n # nothing to do.\n pass\n def build_with_make(self, **kw):\n libname = 'blas_LINUX.a'\n cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over. \n src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n self.logger.info(\"Installing blas\")\n copy_file(src_file,dst_file,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for Lapack.\n#-----------------------------------------------------------------------------\n\nclass lapack_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Lapack 3.0 + updates \n self.package_base_name = 'lapack'\n self.package_dir_name = 'LAPACK'\n self.package_url = lapack_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self):\n # perhaps this should actually override auto_conifgure\n # before make, we need to copy the appropriate setup file in.\n # should work anywhere g77 works...\n make_inc = 'make.inc.' + self.platform\n src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n dst_file = os.path.join(self.package_dir,'make.inc')\n copy_file(src_file,dst_file,self.logger)\n\n def build_with_make(self, **kw):\n cmd = 'make install lapacklib'\n text = run_command(cmd,self.package_dir,self.logger)\n\n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over.\n src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','liblapack.a')\n self.logger.info(\"Installing lapack\")\n copy_file(src_file,dst_file,self.logger)\n \n#-----------------------------------------------------------------------------\n# Installation class for Numeric\n#-----------------------------------------------------------------------------\n\nclass numeric_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'Numeric-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = numeric_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for f2py\n#-----------------------------------------------------------------------------\n\nclass f2py_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Typical file format: F2PY-2.13.175-1250.tar.gz\n self.package_base_name = 'F2PY-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = f2py_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for Atlas.\n# This is a binary install *NOT* a source install.\n# The source install is a pain to automate.\n#-----------------------------------------------------------------------------\n\nclass atlas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n #self.package_base_name = 'atlas' + version\n #self.package_dir_name = 'ATLAS'\n self.package_base_name = 'atlas-RH7.1-PIII'\n self.package_dir_name = 'atlas'\n self.package_url = atlas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self,**kw):\n pass\n def build_with_make(self,**kw):\n pass\n def install_with_make(self, **kw):\n # just copy the tree over.\n dst = os.path.join(self.dst_dir,'lib','atlas')\n self.logger.info(\"Installing Atlas\")\n copy_tree(self.package_dir,dst,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for scipy\n#-----------------------------------------------------------------------------\n\nclass scipy_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'scipy_snapshot'\n self.package_dir_name = 'scipy'\n self.package_url = scipy_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'setup'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n file = os.path.join(local_repository,self.tarball)\n up_to_date = 0\n try:\n file_time = os.stat(file)[stat.ST_MTIME] \n fyear,fmonth,fday = time.localtime(file_time)[:3]\n year,month,day = time.localtime()[:3]\n if year == year and month == month and day == day:\n up_to_date = 1\n self.logger.info(\"Repository file up to date: %s\" % file)\n except OSError, msg:\n pass\n return up_to_date\n \n#-----------------------------------------------------------------------------\n# Utilities\n#-----------------------------------------------------------------------------\n\n\n#if os.name == 'nt':\n# def exec_command(command):\n# \"\"\" not sure how to get exit status on nt. \"\"\"\n# in_pipe,out_pipe = os.popen4(command)\n# in_pipe.close()\n# text = out_pipe.read()\n# return 0, text\n#else:\n# import commands\n# exec_command = commands.getstatusoutput\n \n# This may not work on Win98... The above stuff was to handle these machines.\nimport commands\nexec_command = commands.getstatusoutput\n\ndef copy_file(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying %s->%s\" % (src,dst)) \n try:\n file_util.copy_file(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef copy_tree(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying directory tree %s->%s\" % (src,dst)) \n try:\n dir_util.copy_tree(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef remove_tree(directory,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Removing directory tree %s\" % directory) \n try:\n dir_util.remove_tree(directory)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef remove_file(file,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Remove file %s\" % file) \n try:\n os.remove(file)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef write_file(file,contents,logger=None,mode='wb'):\n if not logger:\n logger = logging\n logger.info('Write file: %s' % file)\n try:\n new_file = open(file,mode)\n new_file.write(contents)\n new_file.close()\n except Exception, e: \n logger.exception(\"Write failed\") \n raise\n\n# I know, I know...\nold_dir = []\n\ndef change_dir(d, logger = None):\n if not logger:\n logger = logging\n global old_dir \n cwd = os.getcwd() \n old_dir.append(cwd)\n d = os.path.abspath(d)\n if d != old_dir[-1]:\n logger.info(\"Change directory: %s\" % d) \n try:\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n #if d == '.':\n # import sys,traceback\n # f = sys._getframe()\n # traceback.print_stack(f)\n\ndef unchange_dir(logger=None):\n if not logger:\n logger = logging \n global old_dir\n try:\n cwd = os.getcwd()\n d = old_dir.pop(-1) \n try:\n if d != cwd:\n logger.info(\"Change directory : %s\" % d)\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n except IndexError:\n logger.exception(\"Change directory failed\")\n \ndef decompress_file(src,dst,logger = None):\n if not logger:\n logger = logging\n logger.info(\"Upacking %s->%s\" % (src,dst))\n try:\n f = gzip.open(src,'rb')\n contents = f.read(-1)\n f = open(dst, 'wb')\n f.write(contents)\n except Exception, e: \n logger.exception(\"Unpack failed\")\n raise \n\n \ndef untar_file(file,dst_dir='.',logger = None,silent_failure = 0): \n if not logger:\n logger = logging\n logger.info(\"Untarring file: %s\" % (file))\n try:\n run_command('tar -xf ' + file,directory = dst_dir,\n logger=logger, silent_failure = silent_failure)\n except Exception, e:\n if not silent_failure: \n logger.exception(\"Untar failed\")\n raise \n\ndef unpack_file(file,logger = None):\n \"\"\" equivalent to 'tar -xzvf file'\n \"\"\"\n dst = 'tmp.tar'\n decompress_file(file,dst,logger) \n untar_file(dst.logger)\n remove_file(dst,logger) \n\ndef run_command(cmd,directory='.',logger=None,silent_failure = 0):\n if not logger:\n logger = logging\n change_dir(directory,logger) \n try: \n msg = 'Command: %s' % cmd\n status,text = exec_command(cmd)\n if status:\n msg = msg + ' (failed)'\n logger.info(msg) \n if status and not silent_failure:\n logger.error('command failed with status: %d' % status) \n if text and not silent_failure:\n logger.info('Command Output:\\n'+text)\n finally:\n unchange_dir(logger)\n if status:\n raise ValueError,status\n return text \n\ndef mail_report(from_addr,to_addr,subject,mail_server,\n build_log, test_results,info):\n \n msg = ''\n msg = msg + 'To: %s\\n' % to_addr\n msg = msg + 'Subject: %s\\n' % subject\n msg = msg + '\\r\\n\\r\\n'\n\n for k,v in info.items(): \n msg = msg + '%s: %s\\n' % (k,v)\n msg = msg + test_results \n msg = msg + '-----------------------------\\n' \n msg = msg + '-------- BUILD LOG -------\\n' \n msg = msg + '-----------------------------\\n' \n msg = msg + build_log\n print msg\n \n # mail results\n import smtplib \n server = smtplib.SMTP(mail_server) \n server.sendmail(from_addr, to_addr, msg)\n server.quit()\n \n\ndef full_scipy_build(build_dir = '.',\n test_level = 10,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot'):\n \n # for now the atlas version is ignored. Only the \n # binaries for RH are supported at the moment.\n\n build_info = {'python_version' : python_version,\n 'test_level' : test_level,\n 'numeric_version': numeric_version,\n 'f2py_version' : f2py_version,\n 'atlas_version' : atlas_version,\n 'scipy_version' : scipy_version}\n \n dst_dir = os.path.join(build_dir,sys.platform)\n\n logger = logging.Logger(\"SciPy Test\")\n fmt = logging.Formatter(logging.BASIC_FORMAT)\n log_stream = cStringIO.StringIO()\n stream_handler = logging.StreamHandler(log_stream)\n stream_handler.setFormatter(fmt)\n logger.addHandler(stream_handler)\n # also write to stderr\n stderr = logging.StreamHandler()\n stderr.setFormatter(fmt)\n logger.addHandler(stderr)\n\n try:\n try: \n \n # before doing anything, we need to wipe the \n # /bin, /lib, /man, and /include directories\n # in dst_dir. Don't run as root.\n change_dir(dst_dir , logger)\n remove_tree('bin' , logger)\n remove_tree('lib' , logger)\n remove_tree('man' , logger)\n remove_tree('include', logger)\n unchange_dir(logger)\n \n python = python_installation(version=python_version,\n logger = logger,\n dst_dir = dst_dir)\n python.install()\n \n python_name = python.get_exe_name()\n \n numeric = numeric_installation(version=numeric_version,\n dst_dir = dst_dir,\n logger = logger,\n python_exe=python_name)\n numeric.install()\n \n f2py = f2py_installation(version=f2py_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n f2py.install() \n \n # download files don't have a version specified \n #lapack = lapack_installation(version='',\n # dst_dir = dst_dir\n # python_exe=python_name)\n #lapack.install() \n \n # download files don't have a version specified \n #blas = blas_installation(version='',\n # logger = logger,\n # dst_dir = dst_dir,\n # python_exe=python_name)\n #blas.install() \n \n # ATLAS\n atlas = atlas_installation(version=atlas_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n atlas.install()\n \n # version not currently used -- need to fix this.\n scipy = scipy_installation(version=scipy_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n scipy.install() \n \n # The change to tmp makes sure there isn't a scipy directory in \n # the local scope.\n # All tests are run.\n logger.info('Beginning Test')\n cmd = python_name +' -c \"import sys,scipy;suite=scipy.test(%d);\"'\\\n % test_level\n test_results = run_command(cmd, logger=logger,\n directory = tempfile.gettempdir())\n build_info['results'] = 'test completed (check below for pass/fail)'\n except Exception, msg:\n test_results = ''\n build_info['results'] = 'build failed: %s' % msg\n finally: \n to_addr = \"scipy-testlog@scipy.org\"\n from_addr = \"scipy-test@enthought.com\"\n subject = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n numeric_version,scipy_version) \n build_log = log_stream.getvalue()\n mail_report(from_addr,to_addr,subject,local_mail_server,\n build_log,test_results,build_info)\n\nif __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n level = 10\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n # an older python\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older numeric\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.3',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # This fails because multiarray doesn't have \n # arange defined.\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '19.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '18.4.1',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n", + "methods": [ + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 76, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 45, + "end_line": 76, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "init_names", + "long_name": "init_names( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 78, + "end_line": 80, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_source", + "long_name": "get_source( self )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 4, + "token_count": 39, + "parameters": [ + "self" + ], + "start_line": 82, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 99, + "end_line": 102, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "get_source_local", + "long_name": "get_source_local( self )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 2, + "token_count": 74, + "parameters": [ + "self" + ], + "start_line": 104, + "end_line": 115, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "get_source_ftp", + "long_name": "get_source_ftp( self )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 1, + "token_count": 136, + "parameters": [ + "self" + ], + "start_line": 117, + "end_line": 136, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , sub_dir = None )", + "filename": "auto_test.py", + "nloc": 20, + "complexity": 5, + "token_count": 153, + "parameters": [ + "self", + "sub_dir" + ], + "start_line": 138, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 172, + "end_line": 174, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 176, + "end_line": 178, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , prefix = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 2, + "token_count": 45, + "parameters": [ + "self", + "prefix" + ], + "start_line": 180, + "end_line": 184, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "python_setup", + "long_name": "python_setup( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 186, + "end_line": 188, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 1, + "token_count": 96, + "parameters": [ + "self", + "kw" + ], + "start_line": 190, + "end_line": 202, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 17, + "complexity": 2, + "token_count": 154, + "parameters": [ + "self" + ], + "start_line": 204, + "end_line": 222, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 73, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 230, + "end_line": 239, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 68, + "parameters": [ + "self" + ], + "start_line": 241, + "end_line": 253, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 260, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_exe_name", + "long_name": "get_exe_name( self )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 56, + "parameters": [ + "self" + ], + "start_line": 262, + "end_line": 267, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 275, + "end_line": 285, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , subdir = None )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "subdir" + ], + "start_line": 287, + "end_line": 292, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 294, + "end_line": 296, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "kw" + ], + "start_line": 297, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 302, + "end_line": 307, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 315, + "end_line": 325, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 327, + "end_line": 334, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "kw" + ], + "start_line": 336, + "end_line": 338, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self", + "kw" + ], + "start_line": 340, + "end_line": 344, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 352, + "end_line": 360, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 369, + "end_line": 378, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 389, + "end_line": 399, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 401, + "end_line": 402, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 403, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "kw" + ], + "start_line": 405, + "end_line": 409, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 417, + "end_line": 425, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self" + ], + "start_line": 427, + "end_line": 441, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "copy_file", + "long_name": "copy_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 463, + "end_line": 471, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "copy_tree", + "long_name": "copy_tree( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 473, + "end_line": 481, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_tree", + "long_name": "remove_tree( directory , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 46, + "parameters": [ + "directory", + "logger" + ], + "start_line": 483, + "end_line": 491, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_file", + "long_name": "remove_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "file", + "logger" + ], + "start_line": 493, + "end_line": 501, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_file", + "long_name": "write_file( file , contents , logger = None , mode = 'wb' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 3, + "token_count": 63, + "parameters": [ + "file", + "contents", + "logger", + "mode" + ], + "start_line": 503, + "end_line": 513, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "make_dir", + "long_name": "make_dir( name , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 51, + "parameters": [ + "name", + "logger" + ], + "start_line": 515, + "end_line": 523, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "change_dir", + "long_name": "change_dir( d , logger = None )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 4, + "token_count": 78, + "parameters": [ + "d", + "logger" + ], + "start_line": 528, + "end_line": 541, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "unchange_dir", + "long_name": "unchange_dir( logger = None )", + "filename": "auto_test.py", + "nloc": 16, + "complexity": 5, + "token_count": 76, + "parameters": [ + "logger" + ], + "start_line": 547, + "end_line": 562, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "decompress_file", + "long_name": "decompress_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 12, + "complexity": 3, + "token_count": 77, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 564, + "end_line": 575, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "untar_file", + "long_name": "untar_file( file , dst_dir = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 4, + "token_count": 70, + "parameters": [ + "file", + "dst_dir", + "logger", + "silent_failure" + ], + "start_line": 578, + "end_line": 588, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "unpack_file", + "long_name": "unpack_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 33, + "parameters": [ + "file", + "logger" + ], + "start_line": 590, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 9, + "token_count": 102, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 599, + "end_line": 616, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 0 + }, + { + "name": "mail_report", + "long_name": "mail_report( from_addr , to_addr , subject , mail_server , build_log , test_results , info )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 2, + "token_count": 115, + "parameters": [ + "from_addr", + "to_addr", + "subject", + "mail_server", + "build_log", + "test_results", + "info" + ], + "start_line": 618, + "end_line": 639, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , test_level = 10 , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 74, + "complexity": 5, + "token_count": 417, + "parameters": [ + "build_dir", + "test_level", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 642, + "end_line": 752, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 111, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 45, + "end_line": 76, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "init_names", + "long_name": "init_names( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 78, + "end_line": 80, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_source", + "long_name": "get_source( self )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 4, + "token_count": 39, + "parameters": [ + "self" + ], + "start_line": 82, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 99, + "end_line": 102, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "get_source_local", + "long_name": "get_source_local( self )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 2, + "token_count": 74, + "parameters": [ + "self" + ], + "start_line": 104, + "end_line": 115, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "get_source_ftp", + "long_name": "get_source_ftp( self )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 1, + "token_count": 136, + "parameters": [ + "self" + ], + "start_line": 117, + "end_line": 136, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , sub_dir = None )", + "filename": "auto_test.py", + "nloc": 20, + "complexity": 5, + "token_count": 153, + "parameters": [ + "self", + "sub_dir" + ], + "start_line": 138, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 165, + "end_line": 167, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 169, + "end_line": 171, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , prefix = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 2, + "token_count": 45, + "parameters": [ + "self", + "prefix" + ], + "start_line": 173, + "end_line": 177, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "python_setup", + "long_name": "python_setup( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 179, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 34, + "parameters": [ + "self", + "kw" + ], + "start_line": 183, + "end_line": 191, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "_setup", + "long_name": "_setup( self )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 21, + "parameters": [ + "self" + ], + "start_line": 193, + "end_line": 198, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 2, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 200, + "end_line": 212, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 73, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 220, + "end_line": 229, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 231, + "end_line": 241, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 243, + "end_line": 248, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_exe_name", + "long_name": "get_exe_name( self )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 56, + "parameters": [ + "self" + ], + "start_line": 250, + "end_line": 255, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 263, + "end_line": 273, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , subdir = None )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "subdir" + ], + "start_line": 275, + "end_line": 280, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 282, + "end_line": 284, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "kw" + ], + "start_line": 285, + "end_line": 288, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 290, + "end_line": 295, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 303, + "end_line": 313, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 315, + "end_line": 322, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "kw" + ], + "start_line": 324, + "end_line": 326, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 328, + "end_line": 333, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 341, + "end_line": 349, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 358, + "end_line": 367, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 378, + "end_line": 388, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 390, + "end_line": 391, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 392, + "end_line": 393, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "kw" + ], + "start_line": 394, + "end_line": 398, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 406, + "end_line": 414, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self" + ], + "start_line": 416, + "end_line": 430, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "copy_file", + "long_name": "copy_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 452, + "end_line": 460, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "copy_tree", + "long_name": "copy_tree( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 462, + "end_line": 470, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_tree", + "long_name": "remove_tree( directory , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "directory", + "logger" + ], + "start_line": 472, + "end_line": 480, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_file", + "long_name": "remove_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "file", + "logger" + ], + "start_line": 482, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_file", + "long_name": "write_file( file , contents , logger = None , mode = 'wb' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 3, + "token_count": 63, + "parameters": [ + "file", + "contents", + "logger", + "mode" + ], + "start_line": 492, + "end_line": 502, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "change_dir", + "long_name": "change_dir( d , logger = None )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 4, + "token_count": 78, + "parameters": [ + "d", + "logger" + ], + "start_line": 507, + "end_line": 520, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "unchange_dir", + "long_name": "unchange_dir( logger = None )", + "filename": "auto_test.py", + "nloc": 16, + "complexity": 5, + "token_count": 76, + "parameters": [ + "logger" + ], + "start_line": 526, + "end_line": 541, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "decompress_file", + "long_name": "decompress_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 12, + "complexity": 3, + "token_count": 77, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 543, + "end_line": 554, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "untar_file", + "long_name": "untar_file( file , dst_dir = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 4, + "token_count": 70, + "parameters": [ + "file", + "dst_dir", + "logger", + "silent_failure" + ], + "start_line": 557, + "end_line": 567, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "unpack_file", + "long_name": "unpack_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 33, + "parameters": [ + "file", + "logger" + ], + "start_line": 569, + "end_line": 575, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 19, + "complexity": 9, + "token_count": 102, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 577, + "end_line": 595, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 0 + }, + { + "name": "mail_report", + "long_name": "mail_report( from_addr , to_addr , subject , mail_server , build_log , test_results , info )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 2, + "token_count": 113, + "parameters": [ + "from_addr", + "to_addr", + "subject", + "mail_server", + "build_log", + "test_results", + "info" + ], + "start_line": 597, + "end_line": 618, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , test_level = 10 , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 73, + "complexity": 3, + "token_count": 402, + "parameters": [ + "build_dir", + "test_level", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 621, + "end_line": 730, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 110, + "top_nesting_level": 0 + } + ], + "changed_methods": [ + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 76, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 45, + "end_line": 76, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "remove_tree", + "long_name": "remove_tree( directory , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 46, + "parameters": [ + "directory", + "logger" + ], + "start_line": 483, + "end_line": 491, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 68, + "parameters": [ + "self" + ], + "start_line": 241, + "end_line": 253, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 260, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "mail_report", + "long_name": "mail_report( from_addr , to_addr , subject , mail_server , build_log , test_results , info )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 2, + "token_count": 115, + "parameters": [ + "from_addr", + "to_addr", + "subject", + "mail_server", + "build_log", + "test_results", + "info" + ], + "start_line": 618, + "end_line": 639, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 1, + "token_count": 96, + "parameters": [ + "self", + "kw" + ], + "start_line": 190, + "end_line": 202, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "make_dir", + "long_name": "make_dir( name , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 51, + "parameters": [ + "name", + "logger" + ], + "start_line": 515, + "end_line": 523, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self", + "kw" + ], + "start_line": 340, + "end_line": 344, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "_setup", + "long_name": "_setup( self )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 21, + "parameters": [ + "self" + ], + "start_line": 193, + "end_line": 198, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 17, + "complexity": 2, + "token_count": 154, + "parameters": [ + "self" + ], + "start_line": 204, + "end_line": 222, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 9, + "token_count": 102, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 599, + "end_line": 616, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , test_level = 10 , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 74, + "complexity": 5, + "token_count": 417, + "parameters": [ + "build_dir", + "test_level", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 642, + "end_line": 752, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 111, + "top_nesting_level": 0 + } + ], + "nloc": 543, + "complexity": 100, + "token_count": 3402, + "diff_parsed": { + "added": [ + " # make sure the destination exists", + " make_dir(self.dst_dir,logger=self.logger)", + "", + " #def auto_configure(self):", + " # cmd = os.path.join('.','configure')", + " # try:", + " # text = run_command(cmd,self.package_dir,self.logger,log_output=0)", + " # except ValueError, e:", + " # status, text = e", + " # self.logger.exception('Configuration Error:\\n'+text)", + "", + "", + "", + "", + " self.logger.info(\"### Begin Configure: %s\" % self.package_base_name)", + " self.logger.info(\"### Finished Configure: %s\" % self.package_base_name)", + " self.logger.info(\"### Begin Build: %s\" % self.package_base_name)", + " self.logger.info(\"### Finished Build: %s\" % self.package_base_name)", + " self.logger.info(\"### Begin Install: %s\" % self.package_base_name)", + " self.logger.info(\"### Finished Install: %s\" % self.package_base_name)", + "", + " self.logger.info(\"### Begin Get Source: %s\" % self.package_base_name)", + " self.get_source()", + " self.unpack_source()", + " self.logger.info(\"### Finished Get Source: %s\" % self.package_base_name)", + "", + " self.python_setup()", + " self.logger.info('### Writing Install Script Hack')", + " self.logger.info('### Finished writing Install Script Hack')", + " \"\"\"", + "", + "", + "", + "", + " dst_file = os.path.join(self.dst_dir,'lib','liblapack.a')", + "", + " logger.exception(\"Remove failed: %s\" % e)", + "def make_dir(name,logger=None):", + " if not logger:", + " logger = logging", + " logger.info('Make directory: %s' % name)", + " try:", + " dir_util.mkpath(os.path.abspath(name))", + " except Exception, e:", + " logger.exception(\"Make Directory failed\")", + " raise", + "", + "", + " msg = 'Running: %s' % cmd", + " status,text = exec_command(cmd)", + " if status and silent_failure:", + " msg = '(failed silently)'", + " logger.info(msg)", + " if status and text and not silent_failure:", + " logger.error('Command Failed (status=%d)\\n'% status +text)", + " raise ValueError, (status,text)", + " msg = msg + test_results + '\\n'", + " # in dst_dir. Don't run as root.", + " make_dir(dst_dir,logger=logger)", + " for d in ['bin','lib','man','include']:", + " try: remove_tree(d, logger)", + " except OSError: pass", + " logger.exception('Build failed')", + " level = 1", + " \"\"\"", + " \"\"\"" + ], + "deleted": [ + " # make sure the destination exists", + " dir_util.mkpath(self.dst_dir)", + "", + "", + "", + "", + "", + " self.get_source()", + " self.unpack_source()", + "", + " def _setup(self):", + " \"\"\" Build with Python setup script.", + " \"\"\"", + " self.get_source()", + " self.unpack_source()", + " self.python_setup()", + " self._setup()", + " \"\"\"", + "", + "", + "", + "", + " dst_file = os.path.join(self.dst_dir,'lib','liblapack.a')", + " self.logger.info(\"Installing lapack\")", + "", + " logger.exception(\"Remove failed\")", + " msg = 'Command: %s' % cmd", + " status,text = exec_command(cmd)", + " if status:", + " msg = msg + ' (failed)'", + " if status and not silent_failure:", + " logger.error('command failed with status: %d' % status)", + " if text and not silent_failure:", + " logger.info('Command Output:\\n'+text)", + " raise ValueError,status", + " msg = msg + test_results", + " # in dst_dir. Don't run as root.", + " remove_tree('bin' , logger)", + " remove_tree('lib' , logger)", + " remove_tree('man' , logger)", + " remove_tree('include', logger)", + " level = 10", + "" + ] + } + } + ] + }, + { + "hash": "45cb47b2e52da076bf098f1175531cd368ddeba8", + "msg": "Changed mathieu_A to mathieu_even_coef and mathieu_B to mathieu_odd_coef", + "author": { + "name": "Travis Oliphant", + "email": "oliphant@enthought.com" + }, + "committer": { + "name": "Travis Oliphant", + "email": "oliphant@enthought.com" + }, + "author_date": "2002-04-13T20:56:32+00:00", + "author_timezone": 0, + "committer_date": "2002-04-13T20:56:32+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "bd759c9e5f0f523bf6e85793ea2cdaab5f181015" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 2, + "insertions": 3, + "lines": 5, + "files": 1, + "dmm_unit_size": 0.0, + "dmm_unit_complexity": 0.0, + "dmm_unit_interfacing": 1.0, + "modified_files": [ + { + "old_path": "scipy_base/polynomial.py", + "new_path": "scipy_base/polynomial.py", + "filename": "polynomial.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -5,7 +5,7 @@\n from type_check import isscalar\n from matrix_base import diag\n from shape_base import hstack, atleast_1d\n-from function_base import trim_zeros\n+from function_base import trim_zeros, sort_complex\n \n __all__ = ['poly','roots','polyint','polyder','polyadd','polysub','polymul',\n 'polydiv','polyval','poly1d']\n@@ -36,7 +36,8 @@ def poly(seq_of_zeros):\n seq_of_zeros = atleast_1d(seq_of_zeros) \n sh = shape(seq_of_zeros)\n if len(sh) == 2 and sh[0] == sh[1]:\n- seq_of_zeros, vecs = MLab.eig(seq_of_zeros)\n+ eig = get_eigval_func()\n+ seq_of_zeros=eig(seq_of_zeros)\n elif len(sh) ==1:\n pass\n else:\n", + "added_lines": 3, + "deleted_lines": 2, + "source_code": "import Numeric\nfrom Numeric import *\nfrom scimath import *\n\nfrom type_check import isscalar\nfrom matrix_base import diag\nfrom shape_base import hstack, atleast_1d\nfrom function_base import trim_zeros, sort_complex\n\n__all__ = ['poly','roots','polyint','polyder','polyadd','polysub','polymul',\n 'polydiv','polyval','poly1d']\n \ndef get_eigval_func():\n try:\n import scipy.linalg\n eigvals = scipy.linalg.eigvals\n except:\n try:\n import LinearAlgebra\n eigvals = LinearAlgebra.eigenvalues\n except:\n raise ImportError, \"You must have scipy.linalg our LinearAlgebra to use this function.\"\n return eigvals\n\ndef poly(seq_of_zeros):\n \"\"\" Return a sequence representing a polynomial given a sequence of roots.\n\n If the input is a matrix, return the characteristic polynomial.\n \n Example:\n \n >>> b = roots([1,3,1,5,6])\n >>> poly(b)\n array([1., 3., 1., 5., 6.])\n \"\"\"\n seq_of_zeros = atleast_1d(seq_of_zeros) \n sh = shape(seq_of_zeros)\n if len(sh) == 2 and sh[0] == sh[1]:\n eig = get_eigval_func()\n seq_of_zeros=eig(seq_of_zeros)\n elif len(sh) ==1:\n pass\n else:\n raise ValueError, \"input must be 1d or square 2d array.\"\n\n if len(seq_of_zeros) == 0:\n return 1.0\n\n a = [1]\n for k in range(len(seq_of_zeros)):\n a = convolve(a,[1, -seq_of_zeros[k]], mode=2)\n\n \n if a.typecode() in ['F','D']:\n # if complex roots are all complex conjugates, the roots are real.\n roots = asarray(seq_of_zeros,'D')\n pos_roots = sort_complex(compress(roots.imag > 0,roots))\n neg_roots = conjugate(sort_complex(compress(roots.imag < 0,roots)))\n if (len(pos_roots) == len(neg_roots) and\n alltrue(neg_roots == pos_roots)):\n a = a.real.copy()\n\n return a\n\ndef roots(p):\n \"\"\" Return the roots of the polynomial coefficients in p.\n\n The values in the rank-1 array p are coefficients of a polynomial.\n If the length of p is n+1 then the polynomial is\n p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n]\n \"\"\"\n # If input is scalar, this makes it an array\n eig = get_eigval_func()\n p = atleast_1d(p)\n if len(p.shape) != 1:\n raise ValueError,\"Input must be a rank-1 array.\"\n \n # find non-zero array entries\n non_zero = nonzero(ravel(p))\n\n # find the number of trailing zeros -- this is the number of roots at 0.\n trailing_zeros = len(p) - non_zero[-1] - 1\n\n # strip leading and trailing zeros\n p = p[int(non_zero[0]):int(non_zero[-1])+1]\n \n # casting: if incoming array isn't floating point, make it floating point.\n if p.typecode() not in ['f','d','F','D']:\n p = p.astype('d')\n\n N = len(p)\n if N > 1:\n # build companion matrix and find its eigenvalues (the roots)\n A = diag(ones((N-2,),p.typecode()),-1)\n A[0,:] = -p[1:] / p[0]\n roots = eig(A)\n\n # tack any zeros onto the back of the array \n roots = hstack((roots,zeros(trailing_zeros,roots.typecode())))\n return roots\n\ndef polyint(p,m=1,k=None):\n \"\"\"Return the mth analytical integral of the polynomial p.\n\n If k is None, then zero-valued constants of integration are used.\n otherwise, k should be a list of length m (or a scalar if m=1) to\n represent the constants of integration to use for each integration\n (starting with k[0])\n \"\"\"\n m = int(m)\n if m < 0:\n raise ValueError, \"Order of integral must be positive (see polyder)\"\n if k is None:\n k = Numeric.zeros(m)\n k = atleast_1d(k)\n if len(k) == 1 and m > 1:\n k = k[0]*Numeric.ones(m)\n if len(k) < m:\n raise ValueError, \\\n \"k must be a scalar or a rank-1 array of length 1 or >m.\"\n if m == 0:\n return p\n else:\n truepoly = isinstance(p,poly1d)\n p = Numeric.asarray(p)\n y = Numeric.zeros(len(p)+1,'d')\n y[:-1] = p*1.0/Numeric.arange(len(p),0,-1)\n y[-1] = k[0] \n val = polyint(y,m-1,k=k[1:])\n if truepoly:\n val = poly1d(val)\n return val\n \ndef polyder(p,m=1):\n \"\"\"Return the mth derivative of the polynomial p.\n \"\"\"\n m = int(m)\n truepoly = isinstance(p,poly1d)\n p = Numeric.asarray(p)\n n = len(p)-1\n y = p[:-1] * Numeric.arange(n,0,-1)\n if m < 0:\n raise ValueError, \"Order of derivative must be positive (see polyint)\"\n if m == 0:\n return p\n else:\n val = polyder(y,m-1)\n if truepoly:\n val = poly1d(val)\n return val\n\ndef polyval(p,x):\n \"\"\"Evaluate the polymnomial p at x.\n\n Description:\n\n If p is of length N, this function returns the value:\n p[0]*(x**N-1) + p[1]*(x**N-2) + ... + p[N-2]*x + p[N-1]\n \"\"\"\n x = Numeric.asarray(x)\n p = Numeric.asarray(p)\n y = Numeric.zeros(x.shape,x.typecode())\n for i in range(len(p)):\n y = x * y + p[i]\n return y\n\ndef polyadd(a1,a2):\n \"\"\"Adds two polynomials represented as lists\n \"\"\"\n truepoly = (isinstance(a1,poly1d) or isinstance(a2,poly1d))\n a1,a2 = map(atleast_1d,(a1,a2))\n diff = len(a2) - len(a1)\n if diff == 0:\n return a1 + a2\n elif diff > 0:\n zr = Numeric.zeros(diff)\n val = Numeric.concatenate((zr,a1)) + a2\n else:\n zr = Numeric.zeros(abs(diff))\n val = a1 + Numeric.concatenate((zr,a2))\n if truepoly:\n val = poly1d(val)\n return val\n\ndef polysub(a1,a2):\n \"\"\"Subtracts two polynomials represented as lists\n \"\"\"\n truepoly = (isinstance(a1,poly1d) or isinstance(a2,poly1d))\n a1,a2 = map(atleast_1d,(a1,a2))\n diff = len(a2) - len(a1)\n if diff == 0:\n return a1 - a2\n elif diff > 0:\n zr = Numeric.zeros(diff)\n val = Numeric.concatenate((zr,a1)) - a2\n else:\n zr = Numeric.zeros(abs(diff))\n val = a1 - Numeric.concatenate((zr,a2))\n if truepoly:\n val = poly1d(val)\n return val\n\n\ndef polymul(a1,a2):\n \"\"\"Multiplies two polynomials represented as lists.\n \"\"\"\n truepoly = (isinstance(a1,poly1d) or isinstance(a2,poly1d))\n val = Numeric.convolve(a1,a2)\n if truepoly:\n val = poly1d(val)\n return val\n\ndef polydiv(a1,a2):\n \"\"\"Computes q and r polynomials so that a1(s) = q(s)*a2(s) + r(s)\n \"\"\"\n truepoly = (isinstance(a1,poly1d) or isinstance(a2,poly1d))\n q, r = deconvolve(a1,a2)\n while Numeric.allclose(r[0], 0, rtol=1e-14) and (r.shape[-1] > 1):\n r = r[1:]\n if truepoly:\n q, r = map(poly1d,(q,r))\n return q, r\n\ndef deconvolve(signal, divisor):\n \"\"\"Deconvolves divisor out of signal.\n \"\"\"\n try:\n import scipy.signal\n except:\n print \"You need scipy.signal to use this function.\"\n num = atleast_1d(signal)\n den = atleast_1d(divisor)\n N = len(num)\n D = len(den)\n if D > N:\n quot = [];\n rem = num;\n else:\n input = Numeric.ones(N-D+1,Numeric.Float)\n input[1:] = 0\n quot = scipy.signal.lfilter(num, den, input)\n rem = num - Numeric.convolve(den,quot,mode=2)\n return quot, rem\n\nimport re\n_poly_mat = re.compile(r\"[*][*]([0-9]*)\")\ndef _raise_power(astr, wrap=70):\n n = 0\n line1 = ''\n line2 = ''\n output = ' '\n while 1:\n mat = _poly_mat.search(astr,n)\n if mat is None:\n break\n span = mat.span()\n power = mat.groups()[0]\n partstr = astr[n:span[0]]\n n = span[1]\n toadd2 = partstr + ' '*(len(power)-1)\n toadd1 = ' '*(len(partstr)-1) + power\n if ((len(line2)+len(toadd2) > wrap) or \\\n (len(line1)+len(toadd1) > wrap)):\n output += line1 + \"\\n\" + line2 + \"\\n \"\n line1 = toadd1\n line2 = toadd2\n else: \n line2 += partstr + ' '*(len(power)-1)\n line1 += ' '*(len(partstr)-1) + power\n output += line1 + \"\\n\" + line2\n return output + astr[n:]\n \n \nclass poly1d:\n \"\"\"A one-dimensional polynomial class.\n\n p = poly1d([1,2,3]) constructs the polynomial x**2 + 2 x + 3\n\n p(0.5) evaluates the polynomial at the location\n p.r is a list of roots\n p.c is the coefficient array [1,2,3]\n p.order is the polynomial order (after leading zeros in p.c are removed)\n p[k] is the coefficient on the kth power of x (backwards from\n sequencing the coefficient array.\n\n polynomials can be added, substracted, multplied and divided (returns\n quotient and remainder).\n asarray(p) will also give the coefficient array, so polynomials can\n be used in all functions that accept arrays.\n \"\"\"\n def __init__(self, c_or_r, r=0):\n if isinstance(c_or_r,poly1d):\n for key in c_or_r.__dict__.keys():\n self.__dict__[key] = c_or_r.__dict__[key]\n return\n if r:\n c_or_r = poly(c_or_r)\n c_or_r = atleast_1d(c_or_r)\n if len(c_or_r.shape) > 1:\n raise ValueError, \"Polynomial must be 1d only.\"\n c_or_r = trim_zeros(c_or_r, trim='f')\n if len(c_or_r) == 0:\n c_or_r = Numeric.array([0])\n self.__dict__['coeffs'] = c_or_r\n self.__dict__['order'] = len(c_or_r) - 1\n\n def __array__(self,t=None):\n if t:\n return Numeric.asarray(self.coeffs,t)\n else:\n return Numeric.asarray(self.coeffs)\n\n def __repr__(self):\n vals = repr(self.coeffs)\n vals = vals[6:-1]\n return \"poly1d(%s)\" % vals\n\n def __len__(self):\n return self.order\n\n def __str__(self):\n N = self.order\n thestr = \"0\"\n for k in range(len(self.coeffs)):\n coefstr ='%.4g' % abs(self.coeffs[k])\n if coefstr[-4:] == '0000':\n coefstr = coefstr[:-5]\n power = (N-k)\n if power == 0:\n if coefstr != '0':\n newstr = '%s' % (coefstr,)\n else:\n if k == 0:\n newstr = '0'\n else:\n newstr = ''\n elif power == 1:\n if coefstr == '0':\n newstr = ''\n elif coefstr == '1':\n newstr = 'x'\n else: \n newstr = '%s x' % (coefstr,)\n else:\n if coefstr == '0':\n newstr = ''\n elif coefstr == '1':\n newstr = 'x**%d' % (power,)\n else: \n newstr = '%s x**%d' % (coefstr, power)\n\n if k > 0:\n if newstr != '':\n if self.coeffs[k] < 0:\n thestr = \"%s - %s\" % (thestr, newstr)\n else:\n thestr = \"%s + %s\" % (thestr, newstr)\n elif (k == 0) and (newstr != '') and (self.coeffs[k] < 0):\n thestr = \"-%s\" % (newstr,)\n else:\n thestr = newstr\n return _raise_power(thestr)\n \n\n def __call__(self, val):\n return polyval(self.coeffs, val)\n\n def __mul__(self, other):\n if isscalar(other):\n return poly1d(other*self.coeffs)\n else:\n other = poly1d(other)\n return poly1d(polymul(self.coeffs, other.coeffs))\n\n def __rmul__(self, other):\n if isscalar(other):\n return poly1d(other*self.coeffs)\n else:\n other = poly1d(other)\n return poly1d(polymul(self.coeffs, other.coeffs)) \n\n def __add__(self, other):\n if isscalar(other):\n return poly1d(other+self.coeffs)\n else:\n other = poly1d(other)\n return poly1d(polyadd(self.coeffs, other.coeffs)) \n \n def __radd__(self, other):\n if isscalar(other):\n return poly1d(other+self.coeffs)\n else:\n other = poly1d(other)\n return poly1d(polyadd(self.coeffs, other.coeffs))\n\n def __pow__(self, val):\n if not isscalar(val) or int(val) != val or val < 0:\n raise ValueError, \"Power to non-negative integers only.\"\n res = [1]\n for k in range(val):\n res = polymul(self.coeffs, res)\n return poly1d(res)\n\n def __sub__(self, other):\n if isscalar(other):\n return poly1d(self.coeffs-other)\n else:\n other = poly1d(other)\n return poly1d(polysub(self.coeffs, other.coeffs))\n\n def __rsub__(self, other):\n if isscalar(other):\n return poly1d(other-self.coeffs)\n else:\n other = poly1d(other)\n return poly1d(polysub(other.coeffs, self.coeffs))\n\n def __div__(self, other):\n if isscalar(other):\n return poly1d(self.coeffs/other)\n else:\n other = poly1d(other)\n return map(poly1d,polydiv(self.coeffs, other.coeffs))\n\n def __rdiv__(self, other):\n if isscalar(other):\n return poly1d(other/self.coeffs)\n else:\n other = poly1d(other)\n return map(poly1d,polydiv(other.coeffs, self.coeffs))\n\n def __setattr__(self, key, val):\n raise ValueError, \"Attributes cannot be changed this way.\"\n\n def __getattr__(self, key):\n if key == '__coerce__':\n raise KeyError\n if key in ['r','roots']:\n return roots(self.coeffs)\n elif key in ['c','coef','coefficients']:\n return self.coeffs\n elif key in ['o']:\n return self.order\n else:\n return self.__dict__[key]\n \n def __getitem__(self, val):\n ind = self.order - val\n if val > self.order:\n return 0\n if val < 0:\n return 0\n return self.coeffs[ind]\n\n def __setitem__(self, key, val):\n ind = self.order - key\n if key < 0:\n raise ValueError, \"Does not support negative powers.\"\n if key > self.order:\n zr = Numeric.zeros(key-self.order,self.coeffs.typecode())\n self.__dict__['coeffs'] = Numeric.concatenate((zr,self.coeffs))\n self.__dict__['order'] = key\n ind = 0\n self.__dict__['coeffs'][ind] = val\n return\n\n def integ(self, m=1, k=0):\n return poly1d(polyint(self.coeffs,m=m,k=k))\n\n def deriv(self, m=1):\n return poly1d(polyder(self.coeffs,m=m))\n", + "source_code_before": "import Numeric\nfrom Numeric import *\nfrom scimath import *\n\nfrom type_check import isscalar\nfrom matrix_base import diag\nfrom shape_base import hstack, atleast_1d\nfrom function_base import trim_zeros\n\n__all__ = ['poly','roots','polyint','polyder','polyadd','polysub','polymul',\n 'polydiv','polyval','poly1d']\n \ndef get_eigval_func():\n try:\n import scipy.linalg\n eigvals = scipy.linalg.eigvals\n except:\n try:\n import LinearAlgebra\n eigvals = LinearAlgebra.eigenvalues\n except:\n raise ImportError, \"You must have scipy.linalg our LinearAlgebra to use this function.\"\n return eigvals\n\ndef poly(seq_of_zeros):\n \"\"\" Return a sequence representing a polynomial given a sequence of roots.\n\n If the input is a matrix, return the characteristic polynomial.\n \n Example:\n \n >>> b = roots([1,3,1,5,6])\n >>> poly(b)\n array([1., 3., 1., 5., 6.])\n \"\"\"\n seq_of_zeros = atleast_1d(seq_of_zeros) \n sh = shape(seq_of_zeros)\n if len(sh) == 2 and sh[0] == sh[1]:\n seq_of_zeros, vecs = MLab.eig(seq_of_zeros)\n elif len(sh) ==1:\n pass\n else:\n raise ValueError, \"input must be 1d or square 2d array.\"\n\n if len(seq_of_zeros) == 0:\n return 1.0\n\n a = [1]\n for k in range(len(seq_of_zeros)):\n a = convolve(a,[1, -seq_of_zeros[k]], mode=2)\n\n \n if a.typecode() in ['F','D']:\n # if complex roots are all complex conjugates, the roots are real.\n roots = asarray(seq_of_zeros,'D')\n pos_roots = sort_complex(compress(roots.imag > 0,roots))\n neg_roots = conjugate(sort_complex(compress(roots.imag < 0,roots)))\n if (len(pos_roots) == len(neg_roots) and\n alltrue(neg_roots == pos_roots)):\n a = a.real.copy()\n\n return a\n\ndef roots(p):\n \"\"\" Return the roots of the polynomial coefficients in p.\n\n The values in the rank-1 array p are coefficients of a polynomial.\n If the length of p is n+1 then the polynomial is\n p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n]\n \"\"\"\n # If input is scalar, this makes it an array\n eig = get_eigval_func()\n p = atleast_1d(p)\n if len(p.shape) != 1:\n raise ValueError,\"Input must be a rank-1 array.\"\n \n # find non-zero array entries\n non_zero = nonzero(ravel(p))\n\n # find the number of trailing zeros -- this is the number of roots at 0.\n trailing_zeros = len(p) - non_zero[-1] - 1\n\n # strip leading and trailing zeros\n p = p[int(non_zero[0]):int(non_zero[-1])+1]\n \n # casting: if incoming array isn't floating point, make it floating point.\n if p.typecode() not in ['f','d','F','D']:\n p = p.astype('d')\n\n N = len(p)\n if N > 1:\n # build companion matrix and find its eigenvalues (the roots)\n A = diag(ones((N-2,),p.typecode()),-1)\n A[0,:] = -p[1:] / p[0]\n roots = eig(A)\n\n # tack any zeros onto the back of the array \n roots = hstack((roots,zeros(trailing_zeros,roots.typecode())))\n return roots\n\ndef polyint(p,m=1,k=None):\n \"\"\"Return the mth analytical integral of the polynomial p.\n\n If k is None, then zero-valued constants of integration are used.\n otherwise, k should be a list of length m (or a scalar if m=1) to\n represent the constants of integration to use for each integration\n (starting with k[0])\n \"\"\"\n m = int(m)\n if m < 0:\n raise ValueError, \"Order of integral must be positive (see polyder)\"\n if k is None:\n k = Numeric.zeros(m)\n k = atleast_1d(k)\n if len(k) == 1 and m > 1:\n k = k[0]*Numeric.ones(m)\n if len(k) < m:\n raise ValueError, \\\n \"k must be a scalar or a rank-1 array of length 1 or >m.\"\n if m == 0:\n return p\n else:\n truepoly = isinstance(p,poly1d)\n p = Numeric.asarray(p)\n y = Numeric.zeros(len(p)+1,'d')\n y[:-1] = p*1.0/Numeric.arange(len(p),0,-1)\n y[-1] = k[0] \n val = polyint(y,m-1,k=k[1:])\n if truepoly:\n val = poly1d(val)\n return val\n \ndef polyder(p,m=1):\n \"\"\"Return the mth derivative of the polynomial p.\n \"\"\"\n m = int(m)\n truepoly = isinstance(p,poly1d)\n p = Numeric.asarray(p)\n n = len(p)-1\n y = p[:-1] * Numeric.arange(n,0,-1)\n if m < 0:\n raise ValueError, \"Order of derivative must be positive (see polyint)\"\n if m == 0:\n return p\n else:\n val = polyder(y,m-1)\n if truepoly:\n val = poly1d(val)\n return val\n\ndef polyval(p,x):\n \"\"\"Evaluate the polymnomial p at x.\n\n Description:\n\n If p is of length N, this function returns the value:\n p[0]*(x**N-1) + p[1]*(x**N-2) + ... + p[N-2]*x + p[N-1]\n \"\"\"\n x = Numeric.asarray(x)\n p = Numeric.asarray(p)\n y = Numeric.zeros(x.shape,x.typecode())\n for i in range(len(p)):\n y = x * y + p[i]\n return y\n\ndef polyadd(a1,a2):\n \"\"\"Adds two polynomials represented as lists\n \"\"\"\n truepoly = (isinstance(a1,poly1d) or isinstance(a2,poly1d))\n a1,a2 = map(atleast_1d,(a1,a2))\n diff = len(a2) - len(a1)\n if diff == 0:\n return a1 + a2\n elif diff > 0:\n zr = Numeric.zeros(diff)\n val = Numeric.concatenate((zr,a1)) + a2\n else:\n zr = Numeric.zeros(abs(diff))\n val = a1 + Numeric.concatenate((zr,a2))\n if truepoly:\n val = poly1d(val)\n return val\n\ndef polysub(a1,a2):\n \"\"\"Subtracts two polynomials represented as lists\n \"\"\"\n truepoly = (isinstance(a1,poly1d) or isinstance(a2,poly1d))\n a1,a2 = map(atleast_1d,(a1,a2))\n diff = len(a2) - len(a1)\n if diff == 0:\n return a1 - a2\n elif diff > 0:\n zr = Numeric.zeros(diff)\n val = Numeric.concatenate((zr,a1)) - a2\n else:\n zr = Numeric.zeros(abs(diff))\n val = a1 - Numeric.concatenate((zr,a2))\n if truepoly:\n val = poly1d(val)\n return val\n\n\ndef polymul(a1,a2):\n \"\"\"Multiplies two polynomials represented as lists.\n \"\"\"\n truepoly = (isinstance(a1,poly1d) or isinstance(a2,poly1d))\n val = Numeric.convolve(a1,a2)\n if truepoly:\n val = poly1d(val)\n return val\n\ndef polydiv(a1,a2):\n \"\"\"Computes q and r polynomials so that a1(s) = q(s)*a2(s) + r(s)\n \"\"\"\n truepoly = (isinstance(a1,poly1d) or isinstance(a2,poly1d))\n q, r = deconvolve(a1,a2)\n while Numeric.allclose(r[0], 0, rtol=1e-14) and (r.shape[-1] > 1):\n r = r[1:]\n if truepoly:\n q, r = map(poly1d,(q,r))\n return q, r\n\ndef deconvolve(signal, divisor):\n \"\"\"Deconvolves divisor out of signal.\n \"\"\"\n try:\n import scipy.signal\n except:\n print \"You need scipy.signal to use this function.\"\n num = atleast_1d(signal)\n den = atleast_1d(divisor)\n N = len(num)\n D = len(den)\n if D > N:\n quot = [];\n rem = num;\n else:\n input = Numeric.ones(N-D+1,Numeric.Float)\n input[1:] = 0\n quot = scipy.signal.lfilter(num, den, input)\n rem = num - Numeric.convolve(den,quot,mode=2)\n return quot, rem\n\nimport re\n_poly_mat = re.compile(r\"[*][*]([0-9]*)\")\ndef _raise_power(astr, wrap=70):\n n = 0\n line1 = ''\n line2 = ''\n output = ' '\n while 1:\n mat = _poly_mat.search(astr,n)\n if mat is None:\n break\n span = mat.span()\n power = mat.groups()[0]\n partstr = astr[n:span[0]]\n n = span[1]\n toadd2 = partstr + ' '*(len(power)-1)\n toadd1 = ' '*(len(partstr)-1) + power\n if ((len(line2)+len(toadd2) > wrap) or \\\n (len(line1)+len(toadd1) > wrap)):\n output += line1 + \"\\n\" + line2 + \"\\n \"\n line1 = toadd1\n line2 = toadd2\n else: \n line2 += partstr + ' '*(len(power)-1)\n line1 += ' '*(len(partstr)-1) + power\n output += line1 + \"\\n\" + line2\n return output + astr[n:]\n \n \nclass poly1d:\n \"\"\"A one-dimensional polynomial class.\n\n p = poly1d([1,2,3]) constructs the polynomial x**2 + 2 x + 3\n\n p(0.5) evaluates the polynomial at the location\n p.r is a list of roots\n p.c is the coefficient array [1,2,3]\n p.order is the polynomial order (after leading zeros in p.c are removed)\n p[k] is the coefficient on the kth power of x (backwards from\n sequencing the coefficient array.\n\n polynomials can be added, substracted, multplied and divided (returns\n quotient and remainder).\n asarray(p) will also give the coefficient array, so polynomials can\n be used in all functions that accept arrays.\n \"\"\"\n def __init__(self, c_or_r, r=0):\n if isinstance(c_or_r,poly1d):\n for key in c_or_r.__dict__.keys():\n self.__dict__[key] = c_or_r.__dict__[key]\n return\n if r:\n c_or_r = poly(c_or_r)\n c_or_r = atleast_1d(c_or_r)\n if len(c_or_r.shape) > 1:\n raise ValueError, \"Polynomial must be 1d only.\"\n c_or_r = trim_zeros(c_or_r, trim='f')\n if len(c_or_r) == 0:\n c_or_r = Numeric.array([0])\n self.__dict__['coeffs'] = c_or_r\n self.__dict__['order'] = len(c_or_r) - 1\n\n def __array__(self,t=None):\n if t:\n return Numeric.asarray(self.coeffs,t)\n else:\n return Numeric.asarray(self.coeffs)\n\n def __repr__(self):\n vals = repr(self.coeffs)\n vals = vals[6:-1]\n return \"poly1d(%s)\" % vals\n\n def __len__(self):\n return self.order\n\n def __str__(self):\n N = self.order\n thestr = \"0\"\n for k in range(len(self.coeffs)):\n coefstr ='%.4g' % abs(self.coeffs[k])\n if coefstr[-4:] == '0000':\n coefstr = coefstr[:-5]\n power = (N-k)\n if power == 0:\n if coefstr != '0':\n newstr = '%s' % (coefstr,)\n else:\n if k == 0:\n newstr = '0'\n else:\n newstr = ''\n elif power == 1:\n if coefstr == '0':\n newstr = ''\n elif coefstr == '1':\n newstr = 'x'\n else: \n newstr = '%s x' % (coefstr,)\n else:\n if coefstr == '0':\n newstr = ''\n elif coefstr == '1':\n newstr = 'x**%d' % (power,)\n else: \n newstr = '%s x**%d' % (coefstr, power)\n\n if k > 0:\n if newstr != '':\n if self.coeffs[k] < 0:\n thestr = \"%s - %s\" % (thestr, newstr)\n else:\n thestr = \"%s + %s\" % (thestr, newstr)\n elif (k == 0) and (newstr != '') and (self.coeffs[k] < 0):\n thestr = \"-%s\" % (newstr,)\n else:\n thestr = newstr\n return _raise_power(thestr)\n \n\n def __call__(self, val):\n return polyval(self.coeffs, val)\n\n def __mul__(self, other):\n if isscalar(other):\n return poly1d(other*self.coeffs)\n else:\n other = poly1d(other)\n return poly1d(polymul(self.coeffs, other.coeffs))\n\n def __rmul__(self, other):\n if isscalar(other):\n return poly1d(other*self.coeffs)\n else:\n other = poly1d(other)\n return poly1d(polymul(self.coeffs, other.coeffs)) \n\n def __add__(self, other):\n if isscalar(other):\n return poly1d(other+self.coeffs)\n else:\n other = poly1d(other)\n return poly1d(polyadd(self.coeffs, other.coeffs)) \n \n def __radd__(self, other):\n if isscalar(other):\n return poly1d(other+self.coeffs)\n else:\n other = poly1d(other)\n return poly1d(polyadd(self.coeffs, other.coeffs))\n\n def __pow__(self, val):\n if not isscalar(val) or int(val) != val or val < 0:\n raise ValueError, \"Power to non-negative integers only.\"\n res = [1]\n for k in range(val):\n res = polymul(self.coeffs, res)\n return poly1d(res)\n\n def __sub__(self, other):\n if isscalar(other):\n return poly1d(self.coeffs-other)\n else:\n other = poly1d(other)\n return poly1d(polysub(self.coeffs, other.coeffs))\n\n def __rsub__(self, other):\n if isscalar(other):\n return poly1d(other-self.coeffs)\n else:\n other = poly1d(other)\n return poly1d(polysub(other.coeffs, self.coeffs))\n\n def __div__(self, other):\n if isscalar(other):\n return poly1d(self.coeffs/other)\n else:\n other = poly1d(other)\n return map(poly1d,polydiv(self.coeffs, other.coeffs))\n\n def __rdiv__(self, other):\n if isscalar(other):\n return poly1d(other/self.coeffs)\n else:\n other = poly1d(other)\n return map(poly1d,polydiv(other.coeffs, self.coeffs))\n\n def __setattr__(self, key, val):\n raise ValueError, \"Attributes cannot be changed this way.\"\n\n def __getattr__(self, key):\n if key == '__coerce__':\n raise KeyError\n if key in ['r','roots']:\n return roots(self.coeffs)\n elif key in ['c','coef','coefficients']:\n return self.coeffs\n elif key in ['o']:\n return self.order\n else:\n return self.__dict__[key]\n \n def __getitem__(self, val):\n ind = self.order - val\n if val > self.order:\n return 0\n if val < 0:\n return 0\n return self.coeffs[ind]\n\n def __setitem__(self, key, val):\n ind = self.order - key\n if key < 0:\n raise ValueError, \"Does not support negative powers.\"\n if key > self.order:\n zr = Numeric.zeros(key-self.order,self.coeffs.typecode())\n self.__dict__['coeffs'] = Numeric.concatenate((zr,self.coeffs))\n self.__dict__['order'] = key\n ind = 0\n self.__dict__['coeffs'][ind] = val\n return\n\n def integ(self, m=1, k=0):\n return poly1d(polyint(self.coeffs,m=m,k=k))\n\n def deriv(self, m=1):\n return poly1d(polyder(self.coeffs,m=m))\n", + "methods": [ + { + "name": "get_eigval_func", + "long_name": "get_eigval_func( )", + "filename": "polynomial.py", + "nloc": 11, + "complexity": 3, + "token_count": 36, + "parameters": [], + "start_line": 13, + "end_line": 23, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "poly", + "long_name": "poly( seq_of_zeros )", + "filename": "polynomial.py", + "nloc": 23, + "complexity": 9, + "token_count": 195, + "parameters": [ + "seq_of_zeros" + ], + "start_line": 25, + "end_line": 63, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 39, + "top_nesting_level": 0 + }, + { + "name": "roots", + "long_name": "roots( p )", + "filename": "polynomial.py", + "nloc": 17, + "complexity": 4, + "token_count": 182, + "parameters": [ + "p" + ], + "start_line": 65, + "end_line": 100, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 36, + "top_nesting_level": 0 + }, + { + "name": "polyint", + "long_name": "polyint( p , m = 1 , k = None )", + "filename": "polynomial.py", + "nloc": 24, + "complexity": 8, + "token_count": 192, + "parameters": [ + "p", + "m", + "k" + ], + "start_line": 102, + "end_line": 132, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 31, + "top_nesting_level": 0 + }, + { + "name": "polyder", + "long_name": "polyder( p , m = 1 )", + "filename": "polynomial.py", + "nloc": 15, + "complexity": 4, + "token_count": 99, + "parameters": [ + "p", + "m" + ], + "start_line": 134, + "end_line": 150, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 0 + }, + { + "name": "polyval", + "long_name": "polyval( p , x )", + "filename": "polynomial.py", + "nloc": 7, + "complexity": 2, + "token_count": 63, + "parameters": [ + "p", + "x" + ], + "start_line": 152, + "end_line": 165, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "polyadd", + "long_name": "polyadd( a1 , a2 )", + "filename": "polynomial.py", + "nloc": 15, + "complexity": 5, + "token_count": 124, + "parameters": [ + "a1", + "a2" + ], + "start_line": 167, + "end_line": 183, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 0 + }, + { + "name": "polysub", + "long_name": "polysub( a1 , a2 )", + "filename": "polynomial.py", + "nloc": 15, + "complexity": 5, + "token_count": 124, + "parameters": [ + "a1", + "a2" + ], + "start_line": 185, + "end_line": 201, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 0 + }, + { + "name": "polymul", + "long_name": "polymul( a1 , a2 )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 3, + "token_count": 46, + "parameters": [ + "a1", + "a2" + ], + "start_line": 204, + "end_line": 211, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + }, + { + "name": "polydiv", + "long_name": "polydiv( a1 , a2 )", + "filename": "polynomial.py", + "nloc": 8, + "complexity": 5, + "token_count": 94, + "parameters": [ + "a1", + "a2" + ], + "start_line": 213, + "end_line": 222, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 0 + }, + { + "name": "deconvolve", + "long_name": "deconvolve( signal , divisor )", + "filename": "polynomial.py", + "nloc": 18, + "complexity": 3, + "token_count": 115, + "parameters": [ + "signal", + "divisor" + ], + "start_line": 224, + "end_line": 243, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 0 + }, + { + "name": "_raise_power", + "long_name": "_raise_power( astr , wrap = 70 )", + "filename": "polynomial.py", + "nloc": 25, + "complexity": 5, + "token_count": 194, + "parameters": [ + "astr", + "wrap" + ], + "start_line": 247, + "end_line": 271, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , c_or_r , r = 0 )", + "filename": "polynomial.py", + "nloc": 15, + "complexity": 6, + "token_count": 122, + "parameters": [ + "self", + "c_or_r", + "r" + ], + "start_line": 291, + "end_line": 305, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "__array__", + "long_name": "__array__( self , t = None )", + "filename": "polynomial.py", + "nloc": 5, + "complexity": 2, + "token_count": 34, + "parameters": [ + "self", + "t" + ], + "start_line": 307, + "end_line": 311, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__repr__", + "long_name": "__repr__( self )", + "filename": "polynomial.py", + "nloc": 4, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 313, + "end_line": 316, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "__len__", + "long_name": "__len__( self )", + "filename": "polynomial.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 318, + "end_line": 319, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "polynomial.py", + "nloc": 41, + "complexity": 17, + "token_count": 244, + "parameters": [ + "self" + ], + "start_line": 321, + "end_line": 362, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 42, + "top_nesting_level": 1 + }, + { + "name": "__call__", + "long_name": "__call__( self , val )", + "filename": "polynomial.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "self", + "val" + ], + "start_line": 365, + "end_line": 366, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__mul__", + "long_name": "__mul__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 44, + "parameters": [ + "self", + "other" + ], + "start_line": 368, + "end_line": 373, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__rmul__", + "long_name": "__rmul__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 44, + "parameters": [ + "self", + "other" + ], + "start_line": 375, + "end_line": 380, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__add__", + "long_name": "__add__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 44, + "parameters": [ + "self", + "other" + ], + "start_line": 382, + "end_line": 387, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__radd__", + "long_name": "__radd__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 44, + "parameters": [ + "self", + "other" + ], + "start_line": 389, + "end_line": 394, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__pow__", + "long_name": "__pow__( self , val )", + "filename": "polynomial.py", + "nloc": 7, + "complexity": 5, + "token_count": 57, + "parameters": [ + "self", + "val" + ], + "start_line": 396, + "end_line": 402, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "__sub__", + "long_name": "__sub__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 44, + "parameters": [ + "self", + "other" + ], + "start_line": 404, + "end_line": 409, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__rsub__", + "long_name": "__rsub__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 44, + "parameters": [ + "self", + "other" + ], + "start_line": 411, + "end_line": 416, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__div__", + "long_name": "__div__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 46, + "parameters": [ + "self", + "other" + ], + "start_line": 418, + "end_line": 423, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__rdiv__", + "long_name": "__rdiv__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 46, + "parameters": [ + "self", + "other" + ], + "start_line": 425, + "end_line": 430, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__setattr__", + "long_name": "__setattr__( self , key , val )", + "filename": "polynomial.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self", + "key", + "val" + ], + "start_line": 432, + "end_line": 433, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__getattr__", + "long_name": "__getattr__( self , key )", + "filename": "polynomial.py", + "nloc": 11, + "complexity": 5, + "token_count": 65, + "parameters": [ + "self", + "key" + ], + "start_line": 435, + "end_line": 445, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "__getitem__", + "long_name": "__getitem__( self , val )", + "filename": "polynomial.py", + "nloc": 7, + "complexity": 3, + "token_count": 37, + "parameters": [ + "self", + "val" + ], + "start_line": 447, + "end_line": 453, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "__setitem__", + "long_name": "__setitem__( self , key , val )", + "filename": "polynomial.py", + "nloc": 11, + "complexity": 3, + "token_count": 94, + "parameters": [ + "self", + "key", + "val" + ], + "start_line": 455, + "end_line": 465, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "integ", + "long_name": "integ( self , m = 1 , k = 0 )", + "filename": "polynomial.py", + "nloc": 2, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "m", + "k" + ], + "start_line": 467, + "end_line": 468, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "deriv", + "long_name": "deriv( self , m = 1 )", + "filename": "polynomial.py", + "nloc": 2, + "complexity": 1, + "token_count": 23, + "parameters": [ + "self", + "m" + ], + "start_line": 470, + "end_line": 471, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + } + ], + "methods_before": [ + { + "name": "get_eigval_func", + "long_name": "get_eigval_func( )", + "filename": "polynomial.py", + "nloc": 11, + "complexity": 3, + "token_count": 36, + "parameters": [], + "start_line": 13, + "end_line": 23, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "poly", + "long_name": "poly( seq_of_zeros )", + "filename": "polynomial.py", + "nloc": 22, + "complexity": 9, + "token_count": 194, + "parameters": [ + "seq_of_zeros" + ], + "start_line": 25, + "end_line": 62, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 38, + "top_nesting_level": 0 + }, + { + "name": "roots", + "long_name": "roots( p )", + "filename": "polynomial.py", + "nloc": 17, + "complexity": 4, + "token_count": 182, + "parameters": [ + "p" + ], + "start_line": 64, + "end_line": 99, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 36, + "top_nesting_level": 0 + }, + { + "name": "polyint", + "long_name": "polyint( p , m = 1 , k = None )", + "filename": "polynomial.py", + "nloc": 24, + "complexity": 8, + "token_count": 192, + "parameters": [ + "p", + "m", + "k" + ], + "start_line": 101, + "end_line": 131, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 31, + "top_nesting_level": 0 + }, + { + "name": "polyder", + "long_name": "polyder( p , m = 1 )", + "filename": "polynomial.py", + "nloc": 15, + "complexity": 4, + "token_count": 99, + "parameters": [ + "p", + "m" + ], + "start_line": 133, + "end_line": 149, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 0 + }, + { + "name": "polyval", + "long_name": "polyval( p , x )", + "filename": "polynomial.py", + "nloc": 7, + "complexity": 2, + "token_count": 63, + "parameters": [ + "p", + "x" + ], + "start_line": 151, + "end_line": 164, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "polyadd", + "long_name": "polyadd( a1 , a2 )", + "filename": "polynomial.py", + "nloc": 15, + "complexity": 5, + "token_count": 124, + "parameters": [ + "a1", + "a2" + ], + "start_line": 166, + "end_line": 182, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 0 + }, + { + "name": "polysub", + "long_name": "polysub( a1 , a2 )", + "filename": "polynomial.py", + "nloc": 15, + "complexity": 5, + "token_count": 124, + "parameters": [ + "a1", + "a2" + ], + "start_line": 184, + "end_line": 200, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 0 + }, + { + "name": "polymul", + "long_name": "polymul( a1 , a2 )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 3, + "token_count": 46, + "parameters": [ + "a1", + "a2" + ], + "start_line": 203, + "end_line": 210, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + }, + { + "name": "polydiv", + "long_name": "polydiv( a1 , a2 )", + "filename": "polynomial.py", + "nloc": 8, + "complexity": 5, + "token_count": 94, + "parameters": [ + "a1", + "a2" + ], + "start_line": 212, + "end_line": 221, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 0 + }, + { + "name": "deconvolve", + "long_name": "deconvolve( signal , divisor )", + "filename": "polynomial.py", + "nloc": 18, + "complexity": 3, + "token_count": 115, + "parameters": [ + "signal", + "divisor" + ], + "start_line": 223, + "end_line": 242, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 0 + }, + { + "name": "_raise_power", + "long_name": "_raise_power( astr , wrap = 70 )", + "filename": "polynomial.py", + "nloc": 25, + "complexity": 5, + "token_count": 194, + "parameters": [ + "astr", + "wrap" + ], + "start_line": 246, + "end_line": 270, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , c_or_r , r = 0 )", + "filename": "polynomial.py", + "nloc": 15, + "complexity": 6, + "token_count": 122, + "parameters": [ + "self", + "c_or_r", + "r" + ], + "start_line": 290, + "end_line": 304, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "__array__", + "long_name": "__array__( self , t = None )", + "filename": "polynomial.py", + "nloc": 5, + "complexity": 2, + "token_count": 34, + "parameters": [ + "self", + "t" + ], + "start_line": 306, + "end_line": 310, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__repr__", + "long_name": "__repr__( self )", + "filename": "polynomial.py", + "nloc": 4, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 312, + "end_line": 315, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "__len__", + "long_name": "__len__( self )", + "filename": "polynomial.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 317, + "end_line": 318, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "polynomial.py", + "nloc": 41, + "complexity": 17, + "token_count": 244, + "parameters": [ + "self" + ], + "start_line": 320, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 42, + "top_nesting_level": 1 + }, + { + "name": "__call__", + "long_name": "__call__( self , val )", + "filename": "polynomial.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "self", + "val" + ], + "start_line": 364, + "end_line": 365, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__mul__", + "long_name": "__mul__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 44, + "parameters": [ + "self", + "other" + ], + "start_line": 367, + "end_line": 372, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__rmul__", + "long_name": "__rmul__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 44, + "parameters": [ + "self", + "other" + ], + "start_line": 374, + "end_line": 379, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__add__", + "long_name": "__add__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 44, + "parameters": [ + "self", + "other" + ], + "start_line": 381, + "end_line": 386, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__radd__", + "long_name": "__radd__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 44, + "parameters": [ + "self", + "other" + ], + "start_line": 388, + "end_line": 393, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__pow__", + "long_name": "__pow__( self , val )", + "filename": "polynomial.py", + "nloc": 7, + "complexity": 5, + "token_count": 57, + "parameters": [ + "self", + "val" + ], + "start_line": 395, + "end_line": 401, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "__sub__", + "long_name": "__sub__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 44, + "parameters": [ + "self", + "other" + ], + "start_line": 403, + "end_line": 408, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__rsub__", + "long_name": "__rsub__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 44, + "parameters": [ + "self", + "other" + ], + "start_line": 410, + "end_line": 415, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__div__", + "long_name": "__div__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 46, + "parameters": [ + "self", + "other" + ], + "start_line": 417, + "end_line": 422, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__rdiv__", + "long_name": "__rdiv__( self , other )", + "filename": "polynomial.py", + "nloc": 6, + "complexity": 2, + "token_count": 46, + "parameters": [ + "self", + "other" + ], + "start_line": 424, + "end_line": 429, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__setattr__", + "long_name": "__setattr__( self , key , val )", + "filename": "polynomial.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self", + "key", + "val" + ], + "start_line": 431, + "end_line": 432, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__getattr__", + "long_name": "__getattr__( self , key )", + "filename": "polynomial.py", + "nloc": 11, + "complexity": 5, + "token_count": 65, + "parameters": [ + "self", + "key" + ], + "start_line": 434, + "end_line": 444, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "__getitem__", + "long_name": "__getitem__( self , val )", + "filename": "polynomial.py", + "nloc": 7, + "complexity": 3, + "token_count": 37, + "parameters": [ + "self", + "val" + ], + "start_line": 446, + "end_line": 452, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "__setitem__", + "long_name": "__setitem__( self , key , val )", + "filename": "polynomial.py", + "nloc": 11, + "complexity": 3, + "token_count": 94, + "parameters": [ + "self", + "key", + "val" + ], + "start_line": 454, + "end_line": 464, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "integ", + "long_name": "integ( self , m = 1 , k = 0 )", + "filename": "polynomial.py", + "nloc": 2, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "m", + "k" + ], + "start_line": 466, + "end_line": 467, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "deriv", + "long_name": "deriv( self , m = 1 )", + "filename": "polynomial.py", + "nloc": 2, + "complexity": 1, + "token_count": 23, + "parameters": [ + "self", + "m" + ], + "start_line": 469, + "end_line": 470, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + } + ], + "changed_methods": [ + { + "name": "poly", + "long_name": "poly( seq_of_zeros )", + "filename": "polynomial.py", + "nloc": 23, + "complexity": 9, + "token_count": 195, + "parameters": [ + "seq_of_zeros" + ], + "start_line": 25, + "end_line": 63, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 39, + "top_nesting_level": 0 + } + ], + "nloc": 371, + "complexity": 119, + "token_count": 2692, + "diff_parsed": { + "added": [ + "from function_base import trim_zeros, sort_complex", + " eig = get_eigval_func()", + " seq_of_zeros=eig(seq_of_zeros)" + ], + "deleted": [ + "from function_base import trim_zeros", + " seq_of_zeros, vecs = MLab.eig(seq_of_zeros)" + ] + } + } + ] + }, + { + "hash": "904ca23811ef4666766ee79e58e49803326760de", + "msg": "Added fairly complete PIL to Numeric converters using tostring() and fromstring()", + "author": { + "name": "Travis Oliphant", + "email": "oliphant@enthought.com" + }, + "committer": { + "name": "Travis Oliphant", + "email": "oliphant@enthought.com" + }, + "author_date": "2002-04-19T06:54:00+00:00", + "author_timezone": 0, + "committer_date": "2002-04-19T06:54:00+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "45cb47b2e52da076bf098f1175531cd368ddeba8" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 1, + "insertions": 6, + "lines": 7, + "files": 3, + "dmm_unit_size": null, + "dmm_unit_complexity": null, + "dmm_unit_interfacing": null, + "modified_files": [ + { + "old_path": "scipy_base/index_tricks.py", + "new_path": "scipy_base/index_tricks.py", + "filename": "index_tricks.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -1,5 +1,6 @@\n import types\n import Numeric\n+from function_base import linspace\n \n __all__ = ['mgrid','r_','c_','index_exp']\n \n", + "added_lines": 1, + "deleted_lines": 0, + "source_code": "import types\nimport Numeric\nfrom function_base import linspace\n\n__all__ = ['mgrid','r_','c_','index_exp']\n\nfrom type_check import ScalarType\n\nclass nd_grid:\n \"\"\" Construct a \"meshgrid\" in N-dimensions.\n\n grid = nd_grid() creates an instance which will return a mesh-grid\n when indexed. The dimension and number of the output arrays are equal\n to the number of indexing dimensions. If the step length is not a complex\n number, then the stop is not inclusive.\n \n However, if the step length is a COMPLEX NUMBER (e.g. 5j), then the integer\n part of it's magnitude is interpreted as specifying the number of points to\n create between the start and stop values, where the stop value\n IS INCLUSIVE.\n \n Example:\n \n >>> mgrid = nd_grid()\n >>> mgrid[0:5,0:5]\n array([[[0, 0, 0, 0, 0],\n [1, 1, 1, 1, 1],\n [2, 2, 2, 2, 2],\n [3, 3, 3, 3, 3],\n [4, 4, 4, 4, 4]],\n [[0, 1, 2, 3, 4],\n [0, 1, 2, 3, 4],\n [0, 1, 2, 3, 4],\n [0, 1, 2, 3, 4],\n [0, 1, 2, 3, 4]]])\n >>> mgrid[-1:1:5j]\n array([-1. , -0.5, 0. , 0.5, 1. ])\n \"\"\"\n def __getitem__(self,key):\n try:\n\t size = []\n typecode = Numeric.Int\n\t for k in range(len(key)):\n\t step = key[k].step\n start = key[k].start\n if start is None: start = 0\n if step is None:\n step = 1\n if type(step) is type(1j):\n size.append(int(abs(step)))\n typecode = Numeric.Float\n else:\n size.append(int((key[k].stop - start)/(step*1.0)))\n if isinstance(step,types.FloatType) or \\\n isinstance(start, types.FloatType) or \\\n isinstance(key[k].stop, types.FloatType):\n typecode = Numeric.Float\n nn = Numeric.indices(size,typecode)\n\t for k in range(len(size)):\n step = key[k].step\n if step is None:\n step = 1\n if type(step) is type(1j):\n step = int(abs(step))\n step = (key[k].stop - key[k].start)/float(step-1)\n nn[k] = (nn[k]*step+key[k].start)\n\t return nn\n except (IndexError, TypeError):\n step = key.step\n stop = key.stop\n start = key.start\n if start is None: start = 0\n if type(step) is type(1j):\n step = abs(step)\n length = int(step)\n step = (key.stop-start)/float(step-1)\n stop = key.stop+step\n return Numeric.arange(0,length,1,Numeric.Float)*step + start\n else:\n return Numeric.arange(start, stop, step)\n\t \n def __getslice__(self,i,j):\n return Numeric.arange(i,j)\n\n def __len__(self):\n return 0\n\nmgrid = nd_grid()\n\nclass concatenator:\n \"\"\" Translates slice objects to concatenation along an axis.\n \"\"\"\n def __init__(self, axis=0):\n self.axis = axis\n def __getitem__(self,key):\n if type(key) is not types.TupleType:\n key = (key,)\n objs = []\n for k in range(len(key)):\n if type(key[k]) is types.SliceType:\n typecode = Numeric.Int\n\t step = key[k].step\n start = key[k].start\n stop = key[k].stop\n if start is None: start = 0\n if step is None:\n step = 1\n if type(step) is type(1j):\n size = int(abs(step))\n typecode = Numeric.Float\n endpoint = 1\n else:\n size = int((stop - start)/(step*1.0))\n endpoint = 0\n if isinstance(step,types.FloatType) or \\\n isinstance(start, types.FloatType) or \\\n isinstance(stop, types.FloatType):\n typecode = Numeric.Float\n newobj = linspace(start, stop, num=size, endpoint=endpoint)\n elif type(key[k]) in ScalarType:\n newobj = Numeric.asarray([key[k]])\n else:\n newobj = key[k]\n objs.append(newobj)\n return Numeric.concatenate(tuple(objs),axis=self.axis)\n \n def __getslice__(self,i,j):\n return Numeric.arange(i,j)\n\n def __len__(self):\n return 0\n\nr_=concatenator(0)\nc_=concatenator(-1)\n\n# A nicer way to build up index tuples for arrays.\n#\n# You can do all this with slice() plus a few special objects,\n# but there's a lot to remember. This version is simpler because\n# it uses the standard array indexing syntax.\n#\n# Written by Konrad Hinsen \n# last revision: 1999-7-23\n#\n# Cosmetic changes by T. Oliphant 2001\n#\n#\n# This module provides a convenient method for constructing\n# array indices algorithmically. It provides one importable object,\n# 'index_expression'.\n#\n# For any index combination, including slicing and axis insertion,\n# 'a[indices]' is the same as 'a[index_expression[indices]]' for any\n# array 'a'. However, 'index_expression[indices]' can be used anywhere\n# in Python code and returns a tuple of slice objects that can be\n# used in the construction of complex index expressions.\n\nclass _index_expression_class:\n import sys\n maxint = sys.maxint\n\n def __getitem__(self, item):\n if type(item) != type(()):\n return (item,)\n else:\n return item\n\n def __len__(self):\n return self.maxint\n\n def __getslice__(self, start, stop):\n if stop == self.maxint:\n stop = None\n return self[start:stop:None]\n\nindex_exp = _index_expression_class()\n\n# End contribution from Konrad.\n\n#-----------------------------------------------------------------------------\n\ndef test(level=10):\n from scipy_base.testing import module_test\n module_test(__name__,__file__,level=level)\n\ndef test_suite(level=1):\n from scipy_base.testing import module_test_suite\n return module_test_suite(__name__,__file__,level=level)\n", + "source_code_before": "import types\nimport Numeric\n\n__all__ = ['mgrid','r_','c_','index_exp']\n\nfrom type_check import ScalarType\n\nclass nd_grid:\n \"\"\" Construct a \"meshgrid\" in N-dimensions.\n\n grid = nd_grid() creates an instance which will return a mesh-grid\n when indexed. The dimension and number of the output arrays are equal\n to the number of indexing dimensions. If the step length is not a complex\n number, then the stop is not inclusive.\n \n However, if the step length is a COMPLEX NUMBER (e.g. 5j), then the integer\n part of it's magnitude is interpreted as specifying the number of points to\n create between the start and stop values, where the stop value\n IS INCLUSIVE.\n \n Example:\n \n >>> mgrid = nd_grid()\n >>> mgrid[0:5,0:5]\n array([[[0, 0, 0, 0, 0],\n [1, 1, 1, 1, 1],\n [2, 2, 2, 2, 2],\n [3, 3, 3, 3, 3],\n [4, 4, 4, 4, 4]],\n [[0, 1, 2, 3, 4],\n [0, 1, 2, 3, 4],\n [0, 1, 2, 3, 4],\n [0, 1, 2, 3, 4],\n [0, 1, 2, 3, 4]]])\n >>> mgrid[-1:1:5j]\n array([-1. , -0.5, 0. , 0.5, 1. ])\n \"\"\"\n def __getitem__(self,key):\n try:\n\t size = []\n typecode = Numeric.Int\n\t for k in range(len(key)):\n\t step = key[k].step\n start = key[k].start\n if start is None: start = 0\n if step is None:\n step = 1\n if type(step) is type(1j):\n size.append(int(abs(step)))\n typecode = Numeric.Float\n else:\n size.append(int((key[k].stop - start)/(step*1.0)))\n if isinstance(step,types.FloatType) or \\\n isinstance(start, types.FloatType) or \\\n isinstance(key[k].stop, types.FloatType):\n typecode = Numeric.Float\n nn = Numeric.indices(size,typecode)\n\t for k in range(len(size)):\n step = key[k].step\n if step is None:\n step = 1\n if type(step) is type(1j):\n step = int(abs(step))\n step = (key[k].stop - key[k].start)/float(step-1)\n nn[k] = (nn[k]*step+key[k].start)\n\t return nn\n except (IndexError, TypeError):\n step = key.step\n stop = key.stop\n start = key.start\n if start is None: start = 0\n if type(step) is type(1j):\n step = abs(step)\n length = int(step)\n step = (key.stop-start)/float(step-1)\n stop = key.stop+step\n return Numeric.arange(0,length,1,Numeric.Float)*step + start\n else:\n return Numeric.arange(start, stop, step)\n\t \n def __getslice__(self,i,j):\n return Numeric.arange(i,j)\n\n def __len__(self):\n return 0\n\nmgrid = nd_grid()\n\nclass concatenator:\n \"\"\" Translates slice objects to concatenation along an axis.\n \"\"\"\n def __init__(self, axis=0):\n self.axis = axis\n def __getitem__(self,key):\n if type(key) is not types.TupleType:\n key = (key,)\n objs = []\n for k in range(len(key)):\n if type(key[k]) is types.SliceType:\n typecode = Numeric.Int\n\t step = key[k].step\n start = key[k].start\n stop = key[k].stop\n if start is None: start = 0\n if step is None:\n step = 1\n if type(step) is type(1j):\n size = int(abs(step))\n typecode = Numeric.Float\n endpoint = 1\n else:\n size = int((stop - start)/(step*1.0))\n endpoint = 0\n if isinstance(step,types.FloatType) or \\\n isinstance(start, types.FloatType) or \\\n isinstance(stop, types.FloatType):\n typecode = Numeric.Float\n newobj = linspace(start, stop, num=size, endpoint=endpoint)\n elif type(key[k]) in ScalarType:\n newobj = Numeric.asarray([key[k]])\n else:\n newobj = key[k]\n objs.append(newobj)\n return Numeric.concatenate(tuple(objs),axis=self.axis)\n \n def __getslice__(self,i,j):\n return Numeric.arange(i,j)\n\n def __len__(self):\n return 0\n\nr_=concatenator(0)\nc_=concatenator(-1)\n\n# A nicer way to build up index tuples for arrays.\n#\n# You can do all this with slice() plus a few special objects,\n# but there's a lot to remember. This version is simpler because\n# it uses the standard array indexing syntax.\n#\n# Written by Konrad Hinsen \n# last revision: 1999-7-23\n#\n# Cosmetic changes by T. Oliphant 2001\n#\n#\n# This module provides a convenient method for constructing\n# array indices algorithmically. It provides one importable object,\n# 'index_expression'.\n#\n# For any index combination, including slicing and axis insertion,\n# 'a[indices]' is the same as 'a[index_expression[indices]]' for any\n# array 'a'. However, 'index_expression[indices]' can be used anywhere\n# in Python code and returns a tuple of slice objects that can be\n# used in the construction of complex index expressions.\n\nclass _index_expression_class:\n import sys\n maxint = sys.maxint\n\n def __getitem__(self, item):\n if type(item) != type(()):\n return (item,)\n else:\n return item\n\n def __len__(self):\n return self.maxint\n\n def __getslice__(self, start, stop):\n if stop == self.maxint:\n stop = None\n return self[start:stop:None]\n\nindex_exp = _index_expression_class()\n\n# End contribution from Konrad.\n\n#-----------------------------------------------------------------------------\n\ndef test(level=10):\n from scipy_base.testing import module_test\n module_test(__name__,__file__,level=level)\n\ndef test_suite(level=1):\n from scipy_base.testing import module_test_suite\n return module_test_suite(__name__,__file__,level=level)\n", + "methods": [ + { + "name": "__getitem__", + "long_name": "__getitem__( self , key )", + "filename": "index_tricks.py", + "nloc": 42, + "complexity": 14, + "token_count": 368, + "parameters": [ + "self", + "key" + ], + "start_line": 39, + "end_line": 80, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 42, + "top_nesting_level": 1 + }, + { + "name": "__getslice__", + "long_name": "__getslice__( self , i , j )", + "filename": "index_tricks.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self", + "i", + "j" + ], + "start_line": 82, + "end_line": 83, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__len__", + "long_name": "__len__( self )", + "filename": "index_tricks.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [ + "self" + ], + "start_line": 85, + "end_line": 86, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , axis = 0 )", + "filename": "index_tricks.py", + "nloc": 2, + "complexity": 1, + "token_count": 14, + "parameters": [ + "self", + "axis" + ], + "start_line": 93, + "end_line": 94, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__getitem__", + "long_name": "__getitem__( self , key )", + "filename": "index_tricks.py", + "nloc": 31, + "complexity": 11, + "token_count": 253, + "parameters": [ + "self", + "key" + ], + "start_line": 95, + "end_line": 125, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 31, + "top_nesting_level": 1 + }, + { + "name": "__getslice__", + "long_name": "__getslice__( self , i , j )", + "filename": "index_tricks.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self", + "i", + "j" + ], + "start_line": 127, + "end_line": 128, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__len__", + "long_name": "__len__( self )", + "filename": "index_tricks.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [ + "self" + ], + "start_line": 130, + "end_line": 131, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__getitem__", + "long_name": "__getitem__( self , item )", + "filename": "index_tricks.py", + "nloc": 5, + "complexity": 2, + "token_count": 28, + "parameters": [ + "self", + "item" + ], + "start_line": 162, + "end_line": 166, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__len__", + "long_name": "__len__( self )", + "filename": "index_tricks.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 168, + "end_line": 169, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__getslice__", + "long_name": "__getslice__( self , start , stop )", + "filename": "index_tricks.py", + "nloc": 4, + "complexity": 2, + "token_count": 28, + "parameters": [ + "self", + "start", + "stop" + ], + "start_line": 171, + "end_line": 174, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "test", + "long_name": "test( level = 10 )", + "filename": "index_tricks.py", + "nloc": 3, + "complexity": 1, + "token_count": 23, + "parameters": [ + "level" + ], + "start_line": 182, + "end_line": 184, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "test_suite", + "long_name": "test_suite( level = 1 )", + "filename": "index_tricks.py", + "nloc": 3, + "complexity": 1, + "token_count": 24, + "parameters": [ + "level" + ], + "start_line": 186, + "end_line": 188, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "__getitem__", + "long_name": "__getitem__( self , key )", + "filename": "index_tricks.py", + "nloc": 42, + "complexity": 14, + "token_count": 368, + "parameters": [ + "self", + "key" + ], + "start_line": 38, + "end_line": 79, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 42, + "top_nesting_level": 1 + }, + { + "name": "__getslice__", + "long_name": "__getslice__( self , i , j )", + "filename": "index_tricks.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self", + "i", + "j" + ], + "start_line": 81, + "end_line": 82, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__len__", + "long_name": "__len__( self )", + "filename": "index_tricks.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [ + "self" + ], + "start_line": 84, + "end_line": 85, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , axis = 0 )", + "filename": "index_tricks.py", + "nloc": 2, + "complexity": 1, + "token_count": 14, + "parameters": [ + "self", + "axis" + ], + "start_line": 92, + "end_line": 93, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__getitem__", + "long_name": "__getitem__( self , key )", + "filename": "index_tricks.py", + "nloc": 31, + "complexity": 11, + "token_count": 253, + "parameters": [ + "self", + "key" + ], + "start_line": 94, + "end_line": 124, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 31, + "top_nesting_level": 1 + }, + { + "name": "__getslice__", + "long_name": "__getslice__( self , i , j )", + "filename": "index_tricks.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self", + "i", + "j" + ], + "start_line": 126, + "end_line": 127, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__len__", + "long_name": "__len__( self )", + "filename": "index_tricks.py", + "nloc": 2, + "complexity": 1, + "token_count": 7, + "parameters": [ + "self" + ], + "start_line": 129, + "end_line": 130, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__getitem__", + "long_name": "__getitem__( self , item )", + "filename": "index_tricks.py", + "nloc": 5, + "complexity": 2, + "token_count": 28, + "parameters": [ + "self", + "item" + ], + "start_line": 161, + "end_line": 165, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__len__", + "long_name": "__len__( self )", + "filename": "index_tricks.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 167, + "end_line": 168, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__getslice__", + "long_name": "__getslice__( self , start , stop )", + "filename": "index_tricks.py", + "nloc": 4, + "complexity": 2, + "token_count": 28, + "parameters": [ + "self", + "start", + "stop" + ], + "start_line": 170, + "end_line": 173, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "test", + "long_name": "test( level = 10 )", + "filename": "index_tricks.py", + "nloc": 3, + "complexity": 1, + "token_count": 23, + "parameters": [ + "level" + ], + "start_line": 181, + "end_line": 183, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "test_suite", + "long_name": "test_suite( level = 1 )", + "filename": "index_tricks.py", + "nloc": 3, + "complexity": 1, + "token_count": 24, + "parameters": [ + "level" + ], + "start_line": 185, + "end_line": 187, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + } + ], + "changed_methods": [], + "nloc": 145, + "complexity": 37, + "token_count": 873, + "diff_parsed": { + "added": [ + "from function_base import linspace" + ], + "deleted": [] + } + }, + { + "old_path": "scipy_base/limits.py", + "new_path": "scipy_base/limits.py", + "filename": "limits.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -9,7 +9,9 @@\n import Numeric\n import scipy_base.fastumath\n reload(scipy_base.fastumath)\n-from type_check import toFloat32, toFloat64\n+from type_check import cast\n+toFloat32=cast['f']\n+toFloat64=cast['d']\n \n __all__ = ['epsilon','tiny','float_epsilon','float_tiny','float_min',\n 'float_max','float_precision','float_resolution',\n", + "added_lines": 3, + "deleted_lines": 1, + "source_code": "\"\"\" This really needs some work...\n\n Calculate machine limits for Float32 and Float64.\n Actually, max and min are hard coded - and wrong!\n They are close, however.\n\n\"\"\"\n\nimport Numeric\nimport scipy_base.fastumath\nreload(scipy_base.fastumath)\nfrom type_check import cast\ntoFloat32=cast['f']\ntoFloat64=cast['d']\n\n__all__ = ['epsilon','tiny','float_epsilon','float_tiny','float_min',\n 'float_max','float_precision','float_resolution',\n 'double_epsilon','double_tiny','double_min','double_max',\n 'double_precision','double_resolution']\n\n\ndef epsilon(typecode):\n if typecode == Numeric.Float32: cast = toFloat32\n elif typecode == Numeric.Float64: cast = toFloat64\n one = cast(1.0)\n x = cast(1.0)\n while one+x > one:\n x = x * cast(.5)\n x = x * cast(2.0)\n return x\n\ndef tiny(typecode):\n if typecode == Numeric.Float32: cast = toFloat32\n if typecode == Numeric.Float64: cast = toFloat64\n zero = cast(0.0)\n d1 = cast(1.0)\n d2 = cast(1.0)\n while d1 > zero:\n d2 = d1\n d1 = d1 * cast(.5)\n return d2\n\n \n\nfloat_epsilon = epsilon(Numeric.Float32)\nfloat_tiny = tiny(Numeric.Float32)\n#not correct\nfloat_min = -3.402823e38\nfloat_max = 3.402823e38\nfloat_precision = 6\nfloat_resolution = 10.0**(-float_precision)\n\n# hard coded - taken from Norbert's Fortran code.\n# INTEGER, PARAMETER :: kind_DBLE = KIND(0D0) ! 8 (HP-UX)\n# INTEGER, PARAMETER :: prec_DBLE = PRECISION(0D0) ! 15\n# INTEGER, PARAMETER :: range_DBLE = RANGE(0D0) ! 307\n# REAL(kind_DBLE), PARAMETER :: eps_DBLE = EPSILON(0D0) ! 2.22e-16\n# REAL(kind_DBLE), PARAMETER :: tiny_DBLE = TINY(0D0) ! 2.23e-308\n# REAL(kind_DBLE), PARAMETER :: huge_DBLE = HUGE(0D0) ! 1.80e+308\ndouble_epsilon = epsilon(Numeric.Float64)\ndouble_tiny = tiny(Numeric.Float64)\n\n# not quite right...\ndouble_min = -1.797683134862318e308\ndouble_max = 1.797683134862318e308\ndouble_precision = 15\ndouble_resolution = 10.0**(-double_precision)\n\ndef test(level=10):\n from scipy_base.testing import module_test\n module_test(__name__,__file__,level=level)\n\ndef test_suite(level=1):\n from scipy_base.testing import module_test_suite\n return module_test_suite(__name__,__file__,level=level)\n\nif __name__ == '__main__':\n print 'float epsilon:',float_epsilon\n print 'float tiny:',float_tiny\n print 'double epsilon:',double_epsilon\n print 'double tiny:',double_tiny\n", + "source_code_before": "\"\"\" This really needs some work...\n\n Calculate machine limits for Float32 and Float64.\n Actually, max and min are hard coded - and wrong!\n They are close, however.\n\n\"\"\"\n\nimport Numeric\nimport scipy_base.fastumath\nreload(scipy_base.fastumath)\nfrom type_check import toFloat32, toFloat64\n\n__all__ = ['epsilon','tiny','float_epsilon','float_tiny','float_min',\n 'float_max','float_precision','float_resolution',\n 'double_epsilon','double_tiny','double_min','double_max',\n 'double_precision','double_resolution']\n\n\ndef epsilon(typecode):\n if typecode == Numeric.Float32: cast = toFloat32\n elif typecode == Numeric.Float64: cast = toFloat64\n one = cast(1.0)\n x = cast(1.0)\n while one+x > one:\n x = x * cast(.5)\n x = x * cast(2.0)\n return x\n\ndef tiny(typecode):\n if typecode == Numeric.Float32: cast = toFloat32\n if typecode == Numeric.Float64: cast = toFloat64\n zero = cast(0.0)\n d1 = cast(1.0)\n d2 = cast(1.0)\n while d1 > zero:\n d2 = d1\n d1 = d1 * cast(.5)\n return d2\n\n \n\nfloat_epsilon = epsilon(Numeric.Float32)\nfloat_tiny = tiny(Numeric.Float32)\n#not correct\nfloat_min = -3.402823e38\nfloat_max = 3.402823e38\nfloat_precision = 6\nfloat_resolution = 10.0**(-float_precision)\n\n# hard coded - taken from Norbert's Fortran code.\n# INTEGER, PARAMETER :: kind_DBLE = KIND(0D0) ! 8 (HP-UX)\n# INTEGER, PARAMETER :: prec_DBLE = PRECISION(0D0) ! 15\n# INTEGER, PARAMETER :: range_DBLE = RANGE(0D0) ! 307\n# REAL(kind_DBLE), PARAMETER :: eps_DBLE = EPSILON(0D0) ! 2.22e-16\n# REAL(kind_DBLE), PARAMETER :: tiny_DBLE = TINY(0D0) ! 2.23e-308\n# REAL(kind_DBLE), PARAMETER :: huge_DBLE = HUGE(0D0) ! 1.80e+308\ndouble_epsilon = epsilon(Numeric.Float64)\ndouble_tiny = tiny(Numeric.Float64)\n\n# not quite right...\ndouble_min = -1.797683134862318e308\ndouble_max = 1.797683134862318e308\ndouble_precision = 15\ndouble_resolution = 10.0**(-double_precision)\n\ndef test(level=10):\n from scipy_base.testing import module_test\n module_test(__name__,__file__,level=level)\n\ndef test_suite(level=1):\n from scipy_base.testing import module_test_suite\n return module_test_suite(__name__,__file__,level=level)\n\nif __name__ == '__main__':\n print 'float epsilon:',float_epsilon\n print 'float tiny:',float_tiny\n print 'double epsilon:',double_epsilon\n print 'double tiny:',double_tiny\n", + "methods": [ + { + "name": "epsilon", + "long_name": "epsilon( typecode )", + "filename": "limits.py", + "nloc": 9, + "complexity": 4, + "token_count": 69, + "parameters": [ + "typecode" + ], + "start_line": 22, + "end_line": 30, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "tiny", + "long_name": "tiny( typecode )", + "filename": "limits.py", + "nloc": 10, + "complexity": 4, + "token_count": 68, + "parameters": [ + "typecode" + ], + "start_line": 32, + "end_line": 41, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 0 + }, + { + "name": "test", + "long_name": "test( level = 10 )", + "filename": "limits.py", + "nloc": 3, + "complexity": 1, + "token_count": 23, + "parameters": [ + "level" + ], + "start_line": 69, + "end_line": 71, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "test_suite", + "long_name": "test_suite( level = 1 )", + "filename": "limits.py", + "nloc": 3, + "complexity": 1, + "token_count": 24, + "parameters": [ + "level" + ], + "start_line": 73, + "end_line": 75, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "epsilon", + "long_name": "epsilon( typecode )", + "filename": "limits.py", + "nloc": 9, + "complexity": 4, + "token_count": 69, + "parameters": [ + "typecode" + ], + "start_line": 20, + "end_line": 28, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "tiny", + "long_name": "tiny( typecode )", + "filename": "limits.py", + "nloc": 10, + "complexity": 4, + "token_count": 68, + "parameters": [ + "typecode" + ], + "start_line": 30, + "end_line": 39, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 0 + }, + { + "name": "test", + "long_name": "test( level = 10 )", + "filename": "limits.py", + "nloc": 3, + "complexity": 1, + "token_count": 23, + "parameters": [ + "level" + ], + "start_line": 67, + "end_line": 69, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "test_suite", + "long_name": "test_suite( level = 1 )", + "filename": "limits.py", + "nloc": 3, + "complexity": 1, + "token_count": 24, + "parameters": [ + "level" + ], + "start_line": 71, + "end_line": 73, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + } + ], + "changed_methods": [], + "nloc": 59, + "complexity": 10, + "token_count": 349, + "diff_parsed": { + "added": [ + "from type_check import cast", + "toFloat32=cast['f']", + "toFloat64=cast['d']" + ], + "deleted": [ + "from type_check import toFloat32, toFloat64" + ] + } + }, + { + "old_path": "scipy_base/type_check.py", + "new_path": "scipy_base/type_check.py", + "filename": "type_check.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -19,6 +19,7 @@\n \n toChar = lambda x: Numeric.array(x, Char)\n toInt8 = lambda x: Numeric.array(x, Numeric.Int8)# or use variable names such as Byte\n+toUInt8 = lambda x: Numeric.array(x, Numeric.UnsignedInt8)\n toInt16 = lambda x: Numeric.array(x, Numeric.Int16)\n toInt32 = lambda x: Numeric.array(x, Numeric.Int32)\n toInt = lambda x: Numeric.array(x, Numeric.Int)\n@@ -32,6 +33,7 @@\n Numeric.Character = 'c'\n \n cast = {Numeric.Character: toChar,\n+ Numeric.UnsignedInt8: toUInt8,\n Numeric.Int8: toInt8,\n Numeric.Int16: toInt16,\n Numeric.Int32: toInt32,\n", + "added_lines": 2, + "deleted_lines": 0, + "source_code": "import types\nimport Numeric\nfrom Numeric import *\nfrom scipy_base.fastumath import *\n\nimport limits\n\n__all__ = ['ScalarType','iscomplexobj','isrealobj','imag','iscomplex',\n 'isscalar','isneginf','isposinf','isnan','isinf','isfinite',\n 'isreal','isscalar','nan_to_num','real','real_if_close',\n 'typename','cast']\n\nScalarType = [types.IntType, types.LongType, types.FloatType, types.ComplexType]\n\ntry:\n Char = Numeric.Character\nexcept AttributeError:\n Char = 'c'\n\ntoChar = lambda x: Numeric.array(x, Char)\ntoInt8 = lambda x: Numeric.array(x, Numeric.Int8)# or use variable names such as Byte\ntoUInt8 = lambda x: Numeric.array(x, Numeric.UnsignedInt8)\ntoInt16 = lambda x: Numeric.array(x, Numeric.Int16)\ntoInt32 = lambda x: Numeric.array(x, Numeric.Int32)\ntoInt = lambda x: Numeric.array(x, Numeric.Int)\ntoFloat32 = lambda x: Numeric.array(x, Numeric.Float32)\ntoFloat64 = lambda x: Numeric.array(x, Numeric.Float64)\ntoComplex32 = lambda x: Numeric.array(x, Numeric.Complex32)\ntoComplex64 = lambda x: Numeric.array(x, Numeric.Complex64)\n\n# This is for pre Numeric 21.x compatiblity. Adding it is harmless.\nif not hasattr(Numeric,'Character'):\n Numeric.Character = 'c'\n \ncast = {Numeric.Character: toChar,\n Numeric.UnsignedInt8: toUInt8,\n Numeric.Int8: toInt8,\n Numeric.Int16: toInt16,\n Numeric.Int32: toInt32,\n Numeric.Int: toInt,\n Numeric.Float32: toFloat32,\n Numeric.Float64: toFloat64,\n Numeric.Complex32: toComplex32,\n Numeric.Complex64: toComplex64}\n\ndef isscalar(num):\n if isinstance(num, ArrayType):\n return len(num.shape) == 0 and num.typecode() != 'O'\n return type(num) in ScalarType\n\ndef real(val):\n aval = asarray(val)\n if aval.typecode() in ['F', 'D']:\n return aval.real\n else:\n return aval\n\ndef imag(val):\n aval = asarray(val)\n if aval.typecode() in ['F', 'D']:\n return aval.imag\n else:\n return array(0,aval.typecode())*aval\n\ndef iscomplex(x):\n return imag(x) != Numeric.zeros(asarray(x).shape)\n\ndef isreal(x):\n return imag(x) == Numeric.zeros(asarray(x).shape)\n\ndef iscomplexobj(x):\n return asarray(x).typecode() in ['F', 'D']\n\ndef isrealobj(x):\n return not asarray(x).typecode() in ['F', 'D']\n\n#-----------------------------------------------------------------------------\n\n##def isnan(val):\n## # fast, but apparently not portable (according to notes by Tim Peters)\n## #return val != val\n## # very slow -- should really use cephes methods or *something* different\n## import ieee_754\n## vals = ravel(val)\n## if array_iscomplex(vals):\n## r = array(map(ieee_754.isnan,real(vals))) \n## i = array(map(ieee_754.isnan,imag(vals)))\n## results = Numeric.logical_or(r,i)\n## else: \n## results = array(map(ieee_754.isnan,vals))\n## if isscalar(val):\n## results = results[0]\n## return results\n\ndef isposinf(val):\n return isinf(val) & (val > 0)\n \ndef isneginf(val):\n return isinf(val) & (val < 0)\n \n##def isinf(val):\n## return Numeric.logical_or(isposinf(val),isneginf(val))\n\n##def isfinite(val):\n## vals = asarray(val)\n## if iscomplexobj(vals):\n## r = isfinite(real(vals))\n## i = isfinite(imag(vals))\n## results = Numeric.logical_and(r,i)\n## else: \n## fin = Numeric.logical_not(isinf(val))\n## an = Numeric.logical_not(isnan(val))\n## results = Numeric.logical_and(fin,an)\n## return results \n\ndef nan_to_num(x):\n # mapping:\n # NaN -> 0\n # Inf -> limits.double_max\n # -Inf -> limits.double_min\n # complex not handled currently\n import limits\n try:\n t = x.typecode()\n except AttributeError:\n t = type(x)\n if t in [types.ComplexType,'F','D']: \n y = nan_to_num(x.real) + 1j * nan_to_num(x.imag)\n else: \n x = Numeric.asarray(x)\n are_inf = isposinf(x)\n are_neg_inf = isneginf(x)\n are_nan = isnan(x)\n choose_array = are_neg_inf + are_nan * 2 + are_inf * 3\n y = Numeric.choose(choose_array,\n (x,limits.double_min, 0., limits.double_max))\n return y\n\n#-----------------------------------------------------------------------------\n\ndef real_if_close(a,tol=1e-13):\n a = Numeric.asarray(a)\n if a.typecode() in ['F','D'] and Numeric.allclose(a.imag, 0, atol=tol):\n a = a.real\n return a\n\n\n#-----------------------------------------------------------------------------\n\n_namefromtype = {'c' : 'character',\n '1' : 'signed char',\n 'b' : 'unsigned char',\n 's' : 'short',\n 'i' : 'integer',\n 'l' : 'long integer',\n 'f' : 'float',\n 'd' : 'double',\n 'F' : 'complex float',\n 'D' : 'complex double',\n 'O' : 'object'\n }\n\ndef typename(char):\n \"\"\"Return an english name for the given typecode character.\n \"\"\"\n return _namefromtype[char]\n\n#-----------------------------------------------------------------------------\n\n#determine the \"minimum common type code\" for a group of arrays.\narray_kind = {'i':0, 'l': 0, 'f': 0, 'd': 0, 'F': 1, 'D': 1}\narray_precision = {'i': 1, 'l': 1, 'f': 0, 'd': 1, 'F': 0, 'D': 1}\narray_type = [['f', 'd'], ['F', 'D']]\ndef common_type(*arrays):\n kind = 0\n precision = 0\n for a in arrays:\n t = a.typecode()\n kind = max(kind, array_kind[t])\n precision = max(precision, array_precision[t])\n return array_type[kind][precision]\n\n#-----------------------------------------------------------------------------\n# Test Routines\n#-----------------------------------------------------------------------------\n\ndef test(level=10):\n from scipy_base.testing import module_test\n module_test(__name__,__file__,level=level)\n\ndef test_suite(level=1):\n from scipy_base.testing import module_test_suite\n return module_test_suite(__name__,__file__,level=level)\n\nif __name__ == '__main__':\n print 'float epsilon:',float_epsilon\n print 'float tiny:',float_tiny\n print 'double epsilon:',double_epsilon\n print 'double tiny:',double_tiny\n", + "source_code_before": "import types\nimport Numeric\nfrom Numeric import *\nfrom scipy_base.fastumath import *\n\nimport limits\n\n__all__ = ['ScalarType','iscomplexobj','isrealobj','imag','iscomplex',\n 'isscalar','isneginf','isposinf','isnan','isinf','isfinite',\n 'isreal','isscalar','nan_to_num','real','real_if_close',\n 'typename','cast']\n\nScalarType = [types.IntType, types.LongType, types.FloatType, types.ComplexType]\n\ntry:\n Char = Numeric.Character\nexcept AttributeError:\n Char = 'c'\n\ntoChar = lambda x: Numeric.array(x, Char)\ntoInt8 = lambda x: Numeric.array(x, Numeric.Int8)# or use variable names such as Byte\ntoInt16 = lambda x: Numeric.array(x, Numeric.Int16)\ntoInt32 = lambda x: Numeric.array(x, Numeric.Int32)\ntoInt = lambda x: Numeric.array(x, Numeric.Int)\ntoFloat32 = lambda x: Numeric.array(x, Numeric.Float32)\ntoFloat64 = lambda x: Numeric.array(x, Numeric.Float64)\ntoComplex32 = lambda x: Numeric.array(x, Numeric.Complex32)\ntoComplex64 = lambda x: Numeric.array(x, Numeric.Complex64)\n\n# This is for pre Numeric 21.x compatiblity. Adding it is harmless.\nif not hasattr(Numeric,'Character'):\n Numeric.Character = 'c'\n \ncast = {Numeric.Character: toChar,\n Numeric.Int8: toInt8,\n Numeric.Int16: toInt16,\n Numeric.Int32: toInt32,\n Numeric.Int: toInt,\n Numeric.Float32: toFloat32,\n Numeric.Float64: toFloat64,\n Numeric.Complex32: toComplex32,\n Numeric.Complex64: toComplex64}\n\ndef isscalar(num):\n if isinstance(num, ArrayType):\n return len(num.shape) == 0 and num.typecode() != 'O'\n return type(num) in ScalarType\n\ndef real(val):\n aval = asarray(val)\n if aval.typecode() in ['F', 'D']:\n return aval.real\n else:\n return aval\n\ndef imag(val):\n aval = asarray(val)\n if aval.typecode() in ['F', 'D']:\n return aval.imag\n else:\n return array(0,aval.typecode())*aval\n\ndef iscomplex(x):\n return imag(x) != Numeric.zeros(asarray(x).shape)\n\ndef isreal(x):\n return imag(x) == Numeric.zeros(asarray(x).shape)\n\ndef iscomplexobj(x):\n return asarray(x).typecode() in ['F', 'D']\n\ndef isrealobj(x):\n return not asarray(x).typecode() in ['F', 'D']\n\n#-----------------------------------------------------------------------------\n\n##def isnan(val):\n## # fast, but apparently not portable (according to notes by Tim Peters)\n## #return val != val\n## # very slow -- should really use cephes methods or *something* different\n## import ieee_754\n## vals = ravel(val)\n## if array_iscomplex(vals):\n## r = array(map(ieee_754.isnan,real(vals))) \n## i = array(map(ieee_754.isnan,imag(vals)))\n## results = Numeric.logical_or(r,i)\n## else: \n## results = array(map(ieee_754.isnan,vals))\n## if isscalar(val):\n## results = results[0]\n## return results\n\ndef isposinf(val):\n return isinf(val) & (val > 0)\n \ndef isneginf(val):\n return isinf(val) & (val < 0)\n \n##def isinf(val):\n## return Numeric.logical_or(isposinf(val),isneginf(val))\n\n##def isfinite(val):\n## vals = asarray(val)\n## if iscomplexobj(vals):\n## r = isfinite(real(vals))\n## i = isfinite(imag(vals))\n## results = Numeric.logical_and(r,i)\n## else: \n## fin = Numeric.logical_not(isinf(val))\n## an = Numeric.logical_not(isnan(val))\n## results = Numeric.logical_and(fin,an)\n## return results \n\ndef nan_to_num(x):\n # mapping:\n # NaN -> 0\n # Inf -> limits.double_max\n # -Inf -> limits.double_min\n # complex not handled currently\n import limits\n try:\n t = x.typecode()\n except AttributeError:\n t = type(x)\n if t in [types.ComplexType,'F','D']: \n y = nan_to_num(x.real) + 1j * nan_to_num(x.imag)\n else: \n x = Numeric.asarray(x)\n are_inf = isposinf(x)\n are_neg_inf = isneginf(x)\n are_nan = isnan(x)\n choose_array = are_neg_inf + are_nan * 2 + are_inf * 3\n y = Numeric.choose(choose_array,\n (x,limits.double_min, 0., limits.double_max))\n return y\n\n#-----------------------------------------------------------------------------\n\ndef real_if_close(a,tol=1e-13):\n a = Numeric.asarray(a)\n if a.typecode() in ['F','D'] and Numeric.allclose(a.imag, 0, atol=tol):\n a = a.real\n return a\n\n\n#-----------------------------------------------------------------------------\n\n_namefromtype = {'c' : 'character',\n '1' : 'signed char',\n 'b' : 'unsigned char',\n 's' : 'short',\n 'i' : 'integer',\n 'l' : 'long integer',\n 'f' : 'float',\n 'd' : 'double',\n 'F' : 'complex float',\n 'D' : 'complex double',\n 'O' : 'object'\n }\n\ndef typename(char):\n \"\"\"Return an english name for the given typecode character.\n \"\"\"\n return _namefromtype[char]\n\n#-----------------------------------------------------------------------------\n\n#determine the \"minimum common type code\" for a group of arrays.\narray_kind = {'i':0, 'l': 0, 'f': 0, 'd': 0, 'F': 1, 'D': 1}\narray_precision = {'i': 1, 'l': 1, 'f': 0, 'd': 1, 'F': 0, 'D': 1}\narray_type = [['f', 'd'], ['F', 'D']]\ndef common_type(*arrays):\n kind = 0\n precision = 0\n for a in arrays:\n t = a.typecode()\n kind = max(kind, array_kind[t])\n precision = max(precision, array_precision[t])\n return array_type[kind][precision]\n\n#-----------------------------------------------------------------------------\n# Test Routines\n#-----------------------------------------------------------------------------\n\ndef test(level=10):\n from scipy_base.testing import module_test\n module_test(__name__,__file__,level=level)\n\ndef test_suite(level=1):\n from scipy_base.testing import module_test_suite\n return module_test_suite(__name__,__file__,level=level)\n\nif __name__ == '__main__':\n print 'float epsilon:',float_epsilon\n print 'float tiny:',float_tiny\n print 'double epsilon:',double_epsilon\n print 'double tiny:',double_tiny\n", + "methods": [ + { + "name": "isscalar", + "long_name": "isscalar( num )", + "filename": "type_check.py", + "nloc": 4, + "complexity": 3, + "token_count": 37, + "parameters": [ + "num" + ], + "start_line": 46, + "end_line": 49, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 0 + }, + { + "name": "real", + "long_name": "real( val )", + "filename": "type_check.py", + "nloc": 6, + "complexity": 2, + "token_count": 32, + "parameters": [ + "val" + ], + "start_line": 51, + "end_line": 56, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "imag", + "long_name": "imag( val )", + "filename": "type_check.py", + "nloc": 6, + "complexity": 2, + "token_count": 43, + "parameters": [ + "val" + ], + "start_line": 58, + "end_line": 63, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "iscomplex", + "long_name": "iscomplex( x )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 22, + "parameters": [ + "x" + ], + "start_line": 65, + "end_line": 66, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "isreal", + "long_name": "isreal( x )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 22, + "parameters": [ + "x" + ], + "start_line": 68, + "end_line": 69, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "iscomplexobj", + "long_name": "iscomplexobj( x )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "x" + ], + "start_line": 71, + "end_line": 72, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "isrealobj", + "long_name": "isrealobj( x )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 21, + "parameters": [ + "x" + ], + "start_line": 74, + "end_line": 75, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "isposinf", + "long_name": "isposinf( val )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "val" + ], + "start_line": 95, + "end_line": 96, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "isneginf", + "long_name": "isneginf( val )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "val" + ], + "start_line": 98, + "end_line": 99, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "nan_to_num", + "long_name": "nan_to_num( x )", + "filename": "type_check.py", + "nloc": 17, + "complexity": 3, + "token_count": 119, + "parameters": [ + "x" + ], + "start_line": 116, + "end_line": 137, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "real_if_close", + "long_name": "real_if_close( a , tol = 1e - 13 )", + "filename": "type_check.py", + "nloc": 5, + "complexity": 3, + "token_count": 54, + "parameters": [ + "a", + "tol" + ], + "start_line": 141, + "end_line": 145, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "typename", + "long_name": "typename( char )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "char" + ], + "start_line": 163, + "end_line": 166, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 0 + }, + { + "name": "common_type", + "long_name": "common_type( * arrays )", + "filename": "type_check.py", + "nloc": 8, + "complexity": 2, + "token_count": 54, + "parameters": [ + "arrays" + ], + "start_line": 174, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + }, + { + "name": "test", + "long_name": "test( level = 10 )", + "filename": "type_check.py", + "nloc": 3, + "complexity": 1, + "token_count": 23, + "parameters": [ + "level" + ], + "start_line": 187, + "end_line": 189, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "test_suite", + "long_name": "test_suite( level = 1 )", + "filename": "type_check.py", + "nloc": 3, + "complexity": 1, + "token_count": 24, + "parameters": [ + "level" + ], + "start_line": 191, + "end_line": 193, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "isscalar", + "long_name": "isscalar( num )", + "filename": "type_check.py", + "nloc": 4, + "complexity": 3, + "token_count": 37, + "parameters": [ + "num" + ], + "start_line": 44, + "end_line": 47, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 0 + }, + { + "name": "real", + "long_name": "real( val )", + "filename": "type_check.py", + "nloc": 6, + "complexity": 2, + "token_count": 32, + "parameters": [ + "val" + ], + "start_line": 49, + "end_line": 54, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "imag", + "long_name": "imag( val )", + "filename": "type_check.py", + "nloc": 6, + "complexity": 2, + "token_count": 43, + "parameters": [ + "val" + ], + "start_line": 56, + "end_line": 61, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "iscomplex", + "long_name": "iscomplex( x )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 22, + "parameters": [ + "x" + ], + "start_line": 63, + "end_line": 64, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "isreal", + "long_name": "isreal( x )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 22, + "parameters": [ + "x" + ], + "start_line": 66, + "end_line": 67, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "iscomplexobj", + "long_name": "iscomplexobj( x )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "x" + ], + "start_line": 69, + "end_line": 70, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "isrealobj", + "long_name": "isrealobj( x )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 21, + "parameters": [ + "x" + ], + "start_line": 72, + "end_line": 73, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "isposinf", + "long_name": "isposinf( val )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "val" + ], + "start_line": 93, + "end_line": 94, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "isneginf", + "long_name": "isneginf( val )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "val" + ], + "start_line": 96, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "nan_to_num", + "long_name": "nan_to_num( x )", + "filename": "type_check.py", + "nloc": 17, + "complexity": 3, + "token_count": 119, + "parameters": [ + "x" + ], + "start_line": 114, + "end_line": 135, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "real_if_close", + "long_name": "real_if_close( a , tol = 1e - 13 )", + "filename": "type_check.py", + "nloc": 5, + "complexity": 3, + "token_count": 54, + "parameters": [ + "a", + "tol" + ], + "start_line": 139, + "end_line": 143, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "typename", + "long_name": "typename( char )", + "filename": "type_check.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "char" + ], + "start_line": 161, + "end_line": 164, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 0 + }, + { + "name": "common_type", + "long_name": "common_type( * arrays )", + "filename": "type_check.py", + "nloc": 8, + "complexity": 2, + "token_count": 54, + "parameters": [ + "arrays" + ], + "start_line": 172, + "end_line": 179, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + }, + { + "name": "test", + "long_name": "test( level = 10 )", + "filename": "type_check.py", + "nloc": 3, + "complexity": 1, + "token_count": 23, + "parameters": [ + "level" + ], + "start_line": 185, + "end_line": 187, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "test_suite", + "long_name": "test_suite( level = 1 )", + "filename": "type_check.py", + "nloc": 3, + "complexity": 1, + "token_count": 24, + "parameters": [ + "level" + ], + "start_line": 189, + "end_line": 191, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + } + ], + "changed_methods": [], + "nloc": 122, + "complexity": 24, + "token_count": 978, + "diff_parsed": { + "added": [ + "toUInt8 = lambda x: Numeric.array(x, Numeric.UnsignedInt8)", + " Numeric.UnsignedInt8: toUInt8," + ], + "deleted": [] + } + } + ] + }, + { + "hash": "2dc10d93be422d68c2d9270d160c1459ba3861b1", + "msg": "converted wx_info to use wx232 -- it doesn't appear to need any libraries from the wxWindows installation. I think it does still need the wx/wx.h file.\n\nfixed converters to insert the wxpython converter at the front of the list to make sure it is checked before the instance converter is given a shot at the variable.", + "author": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "committer": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "author_date": "2002-04-29T16:43:28+00:00", + "author_timezone": 0, + "committer_date": "2002-04-29T16:43:28+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "904ca23811ef4666766ee79e58e49803326760de" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 4, + "insertions": 5, + "lines": 9, + "files": 2, + "dmm_unit_size": null, + "dmm_unit_complexity": null, + "dmm_unit_interfacing": null, + "modified_files": [ + { + "old_path": "weave/converters.py", + "new_path": "weave/converters.py", + "filename": "converters.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -33,7 +33,7 @@\n try: \n # this is currently safe because it doesn't import wxPython.\n import wx_spec\n- default.append(wx_spec.wx_converter())\n+ default.insert(0,wx_spec.wx_converter())\n except: \n pass \n \n", + "added_lines": 1, + "deleted_lines": 1, + "source_code": "\"\"\" converters.py\n\"\"\"\n\n\nimport base_spec\nimport scalar_spec\nimport sequence_spec\nimport common_spec\n\n\n#--------------------------------------------------------\n# The \"standard\" conversion classes\n#--------------------------------------------------------\n\ndefault = [scalar_spec.int_converter(),\n scalar_spec.float_converter(),\n scalar_spec.complex_converter(),\n sequence_spec.string_converter(),\n sequence_spec.list_converter(),\n sequence_spec.dict_converter(),\n sequence_spec.tuple_converter(),\n common_spec.file_converter(),\n common_spec.callable_converter(),\n common_spec.instance_converter(),] \n #common_spec.module_converter()]\n\ntry: \n import standard_array_spec\n default.append(standard_array_spec.array_converter())\nexcept: \n pass \n\ntry: \n # this is currently safe because it doesn't import wxPython.\n import wx_spec\n default.insert(0,wx_spec.wx_converter())\nexcept: \n pass \n\n#--------------------------------------------------------\n# Blitz conversion classes\n#\n# same as default, but will convert Numeric arrays to blitz\n# C++ classes \n#--------------------------------------------------------\nimport blitz_spec\nblitz = [blitz_spec.array_converter()] + default\n\n", + "source_code_before": "\"\"\" converters.py\n\"\"\"\n\n\nimport base_spec\nimport scalar_spec\nimport sequence_spec\nimport common_spec\n\n\n#--------------------------------------------------------\n# The \"standard\" conversion classes\n#--------------------------------------------------------\n\ndefault = [scalar_spec.int_converter(),\n scalar_spec.float_converter(),\n scalar_spec.complex_converter(),\n sequence_spec.string_converter(),\n sequence_spec.list_converter(),\n sequence_spec.dict_converter(),\n sequence_spec.tuple_converter(),\n common_spec.file_converter(),\n common_spec.callable_converter(),\n common_spec.instance_converter(),] \n #common_spec.module_converter()]\n\ntry: \n import standard_array_spec\n default.append(standard_array_spec.array_converter())\nexcept: \n pass \n\ntry: \n # this is currently safe because it doesn't import wxPython.\n import wx_spec\n default.append(wx_spec.wx_converter())\nexcept: \n pass \n\n#--------------------------------------------------------\n# Blitz conversion classes\n#\n# same as default, but will convert Numeric arrays to blitz\n# C++ classes \n#--------------------------------------------------------\nimport blitz_spec\nblitz = [blitz_spec.array_converter()] + default\n\n", + "methods": [], + "methods_before": [], + "changed_methods": [], + "nloc": 28, + "complexity": 0, + "token_count": 122, + "diff_parsed": { + "added": [ + " default.insert(0,wx_spec.wx_converter())" + ], + "deleted": [ + " default.append(wx_spec.wx_converter())" + ] + } + }, + { + "old_path": "weave/wx_info.py", + "new_path": "weave/wx_info.py", + "filename": "wx_info.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -3,11 +3,12 @@\n # THIS IS PLATFORM DEPENDENT FOR NOW. \n # YOU HAVE TO SPECIFY YOUR WXWINDOWS DIRECTORY\n \n-wx_dir = 'C:\\\\wx230\\\\include'\n+wx_dir = 'C:\\\\wx232\\\\include'\n \n class wx_info(swig_info.swig_info):\n _headers = ['\"wx/wx.h\"']\n _include_dirs = [wx_dir]\n _define_macros=[('wxUSE_GUI', '1')]\n- _libraries = ['wx23_1']\n- _library_dirs = ['c:/wx230/lib']\n\\ No newline at end of file\n+ #_libraries = ['wx23_1']\n+ #_libraries = ['wxmswd']\n+ #_library_dirs = ['c:/wx232/lib']\n\\ No newline at end of file\n", + "added_lines": 4, + "deleted_lines": 3, + "source_code": "import swig_info\n\n# THIS IS PLATFORM DEPENDENT FOR NOW. \n# YOU HAVE TO SPECIFY YOUR WXWINDOWS DIRECTORY\n\nwx_dir = 'C:\\\\wx232\\\\include'\n\nclass wx_info(swig_info.swig_info):\n _headers = ['\"wx/wx.h\"']\n _include_dirs = [wx_dir]\n _define_macros=[('wxUSE_GUI', '1')]\n #_libraries = ['wx23_1']\n #_libraries = ['wxmswd']\n #_library_dirs = ['c:/wx232/lib']", + "source_code_before": "import swig_info\n\n# THIS IS PLATFORM DEPENDENT FOR NOW. \n# YOU HAVE TO SPECIFY YOUR WXWINDOWS DIRECTORY\n\nwx_dir = 'C:\\\\wx230\\\\include'\n\nclass wx_info(swig_info.swig_info):\n _headers = ['\"wx/wx.h\"']\n _include_dirs = [wx_dir]\n _define_macros=[('wxUSE_GUI', '1')]\n _libraries = ['wx23_1']\n _library_dirs = ['c:/wx230/lib']", + "methods": [], + "methods_before": [], + "changed_methods": [], + "nloc": 6, + "complexity": 0, + "token_count": 32, + "diff_parsed": { + "added": [ + "wx_dir = 'C:\\\\wx232\\\\include'", + " #_libraries = ['wx23_1']", + " #_libraries = ['wxmswd']", + " #_library_dirs = ['c:/wx232/lib']" + ], + "deleted": [ + "wx_dir = 'C:\\\\wx230\\\\include'", + " _libraries = ['wx23_1']", + " _library_dirs = ['c:/wx230/lib']" + ] + } + } + ] + }, + { + "hash": "ea80961cbae297b29a20bd67824e6c64d3815272", + "msg": "More modifications to allow instance attributes.", + "author": { + "name": "patmiller", + "email": "patmiller@localhost" + }, + "committer": { + "name": "patmiller", + "email": "patmiller@localhost" + }, + "author_date": "2002-04-30T04:15:18+00:00", + "author_timezone": 0, + "committer_date": "2002-04-30T04:15:18+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "2dc10d93be422d68c2d9270d160c1459ba3861b1" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 15, + "insertions": 141, + "lines": 156, + "files": 2, + "dmm_unit_size": 0.6666666666666666, + "dmm_unit_complexity": 0.2028985507246377, + "dmm_unit_interfacing": 0.5942028985507246, + "modified_files": [ + { + "old_path": "weave/accelerate_tools.py", + "new_path": "weave/accelerate_tools.py", + "filename": "accelerate_tools.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -9,10 +9,11 @@\n \"\"\"\n #**************************************************************************#\n \n-from types import FunctionType,IntType,FloatType,StringType,TypeType,XRangeType\n+from types import InstanceType,FunctionType,IntType,FloatType,StringType,TypeType,XRangeType\n import inspect\n import md5\n import weave\n+import imp\n from bytecodecompiler import CXXCoder,Type_Descriptor,Function_Descriptor\n \n def CStr(s):\n@@ -22,13 +23,56 @@ def CStr(s):\n r = repr('\"'+s) # Better for embedded quotes\n return '\"'+r[2:-1]+'\"'\n \n+\n+##################################################################\n+# CLASS INSTANCE #\n+##################################################################\n+class Instance(Type_Descriptor):\n+ cxxtype = 'PyObject*'\n+ \n+ def __init__(self,prototype):\n+\tself.prototype\t= prototype\n+\treturn\n+\n+ def check(self,s):\n+ return \"PyInstance_Check(%s)\"%s\n+\n+ def inbound(self,s):\n+ return s\n+\n+ def outbound(self,s):\n+ return s,0\n+\n+ def get_attribute(self,name):\n+ proto = getattr(self.prototype,name)\n+ T = lookup_type(proto)\n+ code = 'tempPY = PyObject_GetAttrString(%%(rhs)s,\"%s\");\\n'%name\n+ convert = T.inbound('tempPY')\n+ code += '%%(lhsType)s %%(lhs)s = %s;\\n'%convert\n+ return T,code\n+\n+ def set_attribute(self,name):\n+ proto = getattr(self.prototype,name)\n+ T = lookup_type(proto)\n+ convert,owned = T.outbound('%(rhs)s')\n+ code = 'tempPY = %s;'%convert\n+ if not owned:\n+ code += ' Py_INCREF(tempPY);'\n+ code += ' PyObject_SetAttrString(%%(lhs)s,\"%s\",tempPY);'%name\n+ code += ' Py_DECREF(tempPY);\\n'\n+ return T,code\n+\n+##################################################################\n+# CLASS BASIC #\n+##################################################################\n class Basic(Type_Descriptor):\n+ owned = 1\n def check(self,s):\n return \"%s(%s)\"%(self.checker,s)\n def inbound(self,s):\n return \"%s(%s)\"%(self.inbounder,s)\n def outbound(self,s):\n- return \"%s(%s)\"%(self.outbounder,s)\n+ return \"%s(%s)\"%(self.outbounder,s),self.owned\n \n class Basic_Number(Basic):\n def literalizer(self,s):\n@@ -71,7 +115,10 @@ class Vector(Type_Descriptor):\n cxxtype = 'PyArrayObject*'\n refcount = 1\n dims = 1\n- module_init_code = 'import_array();'\n+ module_init_code = 'import_array();\\n'\n+ inbounder = \"(PyArrayObject*)\"\n+ outbounder = \"(PyObject*)\"\n+ owned = 0 # Convertion is by casting!\n \n prerequisites = Type_Descriptor.prerequisites+\\\n ['#include \"Numeric/arrayobject.h\"']\n@@ -79,10 +126,12 @@ class Vector(Type_Descriptor):\n def check(self,s):\n return \"PyArray_Check(%s) && ((PyArrayObject*)%s)->nd == %d && ((PyArrayObject*)%s)->descr->type_num == %s\"%(\n s,s,self.dims,s,self.typecode)\n+\n def inbound(self,s):\n- return \"(PyArrayObject*)(%s)\"%s\n+ return \"%s(%s)\"%(self.inbounder,s)\n def outbound(self,s):\n- return \"(PyObject*)(%s)\"%s\n+ return \"%s(%s)\"%(self.outbounder,s),self.owned\n+\n def getitem(self,A,v,t):\n assert self.dims == len(v),'Expect dimension %d'%self.dims\n code = '*((%s*)(%s->data'%(self.cxxbase,A)\n@@ -127,6 +176,10 @@ class Doublematrix(matrix):\n cxxbase = 'double'\n pybase = Double\n \n+\n+##################################################################\n+# CLASS XRANGE #\n+##################################################################\n class XRange(Type_Descriptor):\n cxxtype = 'XRange'\n prerequisites = ['''\n@@ -136,6 +189,10 @@ class XRange {\n : low(aLow),high(aHigh),step(aStep)\n {\n }\n+ XRange(long aHigh)\n+ : low(0),high(aHigh),step(1)\n+ {\n+ }\n long low;\n long high;\n long step;\n@@ -152,6 +209,7 @@ class XRange {\n Doublematrix = Doublematrix()\n XRange = XRange()\n \n+\n typedefs = {\n IntType: Integer,\n FloatType: Double,\n@@ -167,12 +225,27 @@ class XRange {\n \n import math\n functiondefs = {\n+ (len,(String,)):\n+ Function_Descriptor(code='strlen(%s)',return_type=Integer),\n+ \n+ (len,(LongVector,)):\n+ Function_Descriptor(code='PyArray_Size((PyObject*)%s)',return_type=Integer),\n+\n+ (float,(Integer,)):\n+ Function_Descriptor(code='(double)(%s)',return_type=Double),\n+ \n (range,(Integer,Integer)):\n Function_Descriptor(code='XRange(%s)',return_type=XRange),\n \n+ (range,(Integer)):\n+ Function_Descriptor(code='XRange(%s)',return_type=XRange),\n+\n (math.sin,(Double,)):\n Function_Descriptor(code='sin(%s)',return_type=Double),\n \n+ (math.cos,(Double,)):\n+ Function_Descriptor(code='cos(%s)',return_type=Double),\n+\n (math.sqrt,(Double,)):\n Function_Descriptor(code='sqrt(%s)',return_type=Double),\n }\n@@ -187,7 +260,13 @@ def lookup_type(x):\n try:\n return typedefs[T]\n except:\n- return typedefs[(T,len(x.shape),x.typecode())]\n+ import Numeric\n+ if isinstance(T,Numeric.ArrayType):\n+ return typedefs[(T,len(x.shape),x.typecode())]\n+ elif T == InstanceType:\n+ return Instance(x)\n+ else:\n+ raise NotImplementedError,T\n \n ##################################################################\n # class ACCELERATE #\n@@ -236,11 +315,15 @@ def singleton(self,signature):\n \n # See if we have an accelerated version of module\n try:\n+ print 'lookup',self.module.__name__+'_weave'\n accelerated_module = __import__(self.module.__name__+'_weave')\n+ print 'have accelerated',self.module.__name__+'_weave'\n fast = getattr(accelerated_module,identifier)\n return fast\n- except:\n+ except ImportError:\n accelerated_module = None\n+ except AttributeError:\n+ pass\n \n P = self.accelerate(signature,identifier)\n \n@@ -250,7 +333,7 @@ def singleton(self,signature):\n weave.build_tools.build_extension(self.module.__name__+'_weave.cpp',verbose=2)\n \n if accelerated_module:\n- accelerated_module = reload(accelerated_module)\n+ raise NotImplementedError,'Reload'\n else:\n accelerated_module = __import__(self.module.__name__+'_weave')\n \n", + "added_lines": 91, + "deleted_lines": 8, + "source_code": "#**************************************************************************#\n#* FILE ************** accelerate_tools.py ************************#\n#**************************************************************************#\n#* Author: Patrick Miller February 9 2002 *#\n#**************************************************************************#\n\"\"\"\naccelerate_tools contains the interface for on-the-fly building of\nC++ equivalents to Python functions.\n\"\"\"\n#**************************************************************************#\n\nfrom types import InstanceType,FunctionType,IntType,FloatType,StringType,TypeType,XRangeType\nimport inspect\nimport md5\nimport weave\nimport imp\nfrom bytecodecompiler import CXXCoder,Type_Descriptor,Function_Descriptor\n\ndef CStr(s):\n \"Hacky way to get legal C string from Python string\"\n if s is None: return '\"\"'\n assert type(s) == StringType,\"Only None and string allowed\"\n r = repr('\"'+s) # Better for embedded quotes\n return '\"'+r[2:-1]+'\"'\n\n\n##################################################################\n# CLASS INSTANCE #\n##################################################################\nclass Instance(Type_Descriptor):\n cxxtype = 'PyObject*'\n \n def __init__(self,prototype):\n\tself.prototype\t= prototype\n\treturn\n\n def check(self,s):\n return \"PyInstance_Check(%s)\"%s\n\n def inbound(self,s):\n return s\n\n def outbound(self,s):\n return s,0\n\n def get_attribute(self,name):\n proto = getattr(self.prototype,name)\n T = lookup_type(proto)\n code = 'tempPY = PyObject_GetAttrString(%%(rhs)s,\"%s\");\\n'%name\n convert = T.inbound('tempPY')\n code += '%%(lhsType)s %%(lhs)s = %s;\\n'%convert\n return T,code\n\n def set_attribute(self,name):\n proto = getattr(self.prototype,name)\n T = lookup_type(proto)\n convert,owned = T.outbound('%(rhs)s')\n code = 'tempPY = %s;'%convert\n if not owned:\n code += ' Py_INCREF(tempPY);'\n code += ' PyObject_SetAttrString(%%(lhs)s,\"%s\",tempPY);'%name\n code += ' Py_DECREF(tempPY);\\n'\n return T,code\n\n##################################################################\n# CLASS BASIC #\n##################################################################\nclass Basic(Type_Descriptor):\n owned = 1\n def check(self,s):\n return \"%s(%s)\"%(self.checker,s)\n def inbound(self,s):\n return \"%s(%s)\"%(self.inbounder,s)\n def outbound(self,s):\n return \"%s(%s)\"%(self.outbounder,s),self.owned\n\nclass Basic_Number(Basic):\n def literalizer(self,s):\n return str(s)\n def binop(self,symbol,a,b):\n assert symbol in ['+','-','*','/'],symbol\n return '%s %s %s'%(a,symbol,b),self\n\nclass Integer(Basic_Number):\n cxxtype = \"long\"\n checker = \"PyInt_Check\"\n inbounder = \"PyInt_AsLong\"\n outbounder = \"PyInt_FromLong\"\n\nclass Double(Basic_Number):\n cxxtype = \"double\"\n checker = \"PyFloat_Check\"\n inbounder = \"PyFloat_AsDouble\"\n outbounder = \"PyFloat_FromDouble\"\n\nclass String(Basic):\n cxxtype = \"char*\"\n checker = \"PyString_Check\"\n inbounder = \"PyString_AsString\"\n outbounder = \"PyString_FromString\"\n\n def literalizer(self,s):\n return CStr(s)\n\n# -----------------------------------------------\n# Singletonize the type names\n# -----------------------------------------------\nInteger = Integer()\nDouble = Double()\nString = String()\n\nimport Numeric\n\nclass Vector(Type_Descriptor):\n cxxtype = 'PyArrayObject*'\n refcount = 1\n dims = 1\n module_init_code = 'import_array();\\n'\n inbounder = \"(PyArrayObject*)\"\n outbounder = \"(PyObject*)\"\n owned = 0 # Convertion is by casting!\n\n prerequisites = Type_Descriptor.prerequisites+\\\n ['#include \"Numeric/arrayobject.h\"']\n dims = 1\n def check(self,s):\n return \"PyArray_Check(%s) && ((PyArrayObject*)%s)->nd == %d && ((PyArrayObject*)%s)->descr->type_num == %s\"%(\n s,s,self.dims,s,self.typecode)\n\n def inbound(self,s):\n return \"%s(%s)\"%(self.inbounder,s)\n def outbound(self,s):\n return \"%s(%s)\"%(self.outbounder,s),self.owned\n\n def getitem(self,A,v,t):\n assert self.dims == len(v),'Expect dimension %d'%self.dims\n code = '*((%s*)(%s->data'%(self.cxxbase,A)\n for i in range(self.dims):\n # assert that ''t[i]'' is an integer\n code += '+%s*%s->strides[%d]'%(v[i],A,i)\n code += '))'\n return code,self.pybase\n def setitem(self,A,v,t):\n return self.getitem(A,v,t)\n\nclass matrix(Vector):\n dims = 2\n\nclass IntegerVector(Vector):\n typecode = 'PyArray_INT'\n cxxbase = 'int'\n pybase = Integer\n\nclass Integermatrix(matrix):\n typecode = 'PyArray_INT'\n cxxbase = 'int'\n pybase = Integer\n\nclass LongVector(Vector):\n typecode = 'PyArray_LONG'\n cxxbase = 'long'\n pybase = Integer\n\nclass Longmatrix(matrix):\n typecode = 'PyArray_LONG'\n cxxbase = 'long'\n pybase = Integer\n\nclass DoubleVector(Vector):\n typecode = 'PyArray_DOUBLE'\n cxxbase = 'double'\n pybase = Double\n\nclass Doublematrix(matrix):\n typecode = 'PyArray_DOUBLE'\n cxxbase = 'double'\n pybase = Double\n\n\n##################################################################\n# CLASS XRANGE #\n##################################################################\nclass XRange(Type_Descriptor):\n cxxtype = 'XRange'\n prerequisites = ['''\n class XRange {\n public:\n XRange(long aLow, long aHigh, long aStep=1)\n : low(aLow),high(aHigh),step(aStep)\n {\n }\n XRange(long aHigh)\n : low(0),high(aHigh),step(1)\n {\n }\n long low;\n long high;\n long step;\n };''']\n\n# -----------------------------------------------\n# Singletonize the type names\n# -----------------------------------------------\nIntegerVector = IntegerVector()\nIntegermatrix = Integermatrix()\nLongVector = LongVector()\nLongmatrix = Longmatrix()\nDoubleVector = DoubleVector()\nDoublematrix = Doublematrix()\nXRange = XRange()\n\n\ntypedefs = {\n IntType: Integer,\n FloatType: Double,\n StringType: String,\n (Numeric.ArrayType,1,'i'): IntegerVector,\n (Numeric.ArrayType,2,'i'): Integermatrix,\n (Numeric.ArrayType,1,'l'): LongVector,\n (Numeric.ArrayType,2,'l'): Longmatrix,\n (Numeric.ArrayType,1,'d'): DoubleVector,\n (Numeric.ArrayType,2,'d'): Doublematrix,\n XRangeType : XRange,\n }\n\nimport math\nfunctiondefs = {\n (len,(String,)):\n Function_Descriptor(code='strlen(%s)',return_type=Integer),\n \n (len,(LongVector,)):\n Function_Descriptor(code='PyArray_Size((PyObject*)%s)',return_type=Integer),\n\n (float,(Integer,)):\n Function_Descriptor(code='(double)(%s)',return_type=Double),\n \n (range,(Integer,Integer)):\n Function_Descriptor(code='XRange(%s)',return_type=XRange),\n\n (range,(Integer)):\n Function_Descriptor(code='XRange(%s)',return_type=XRange),\n\n (math.sin,(Double,)):\n Function_Descriptor(code='sin(%s)',return_type=Double),\n\n (math.cos,(Double,)):\n Function_Descriptor(code='cos(%s)',return_type=Double),\n\n (math.sqrt,(Double,)):\n Function_Descriptor(code='sqrt(%s)',return_type=Double),\n }\n \n\n\n##################################################################\n# FUNCTION LOOKUP_TYPE #\n##################################################################\ndef lookup_type(x):\n T = type(x)\n try:\n return typedefs[T]\n except:\n import Numeric\n if isinstance(T,Numeric.ArrayType):\n return typedefs[(T,len(x.shape),x.typecode())]\n elif T == InstanceType:\n return Instance(x)\n else:\n raise NotImplementedError,T\n\n##################################################################\n# class ACCELERATE #\n##################################################################\nclass accelerate:\n \n def __init__(self, function, *args, **kw):\n assert type(function) == FunctionType\n self.function = function\n self.module = inspect.getmodule(function)\n if self.module is None:\n import __main__\n self.module = __main__\n self.__call_map = {}\n\n def __cache(self,*args):\n raise TypeError\n\n def __call__(self,*args):\n try:\n return self.__cache(*args)\n except TypeError:\n # Figure out type info -- Do as tuple so its hashable\n signature = tuple( map(lookup_type,args) )\n \n # If we know the function, call it\n try:\n fast = self.__call_map[signature]\n except:\n fast = self.singleton(signature)\n self.__cache = fast\n self.__call_map[signature] = fast\n return fast(*args)\n\n def signature(self,*args):\n # Figure out type info -- Do as tuple so its hashable\n signature = tuple( map(lookup_type,args) )\n return self.singleton(signature)\n\n\n def singleton(self,signature):\n identifier = self.identifier(signature)\n \n # Generate a new function, then call it\n f = self.function\n\n # See if we have an accelerated version of module\n try:\n print 'lookup',self.module.__name__+'_weave'\n accelerated_module = __import__(self.module.__name__+'_weave')\n print 'have accelerated',self.module.__name__+'_weave'\n fast = getattr(accelerated_module,identifier)\n return fast\n except ImportError:\n accelerated_module = None\n except AttributeError:\n pass\n\n P = self.accelerate(signature,identifier)\n\n E = weave.ext_tools.ext_module(self.module.__name__+'_weave')\n E.add_function(P)\n E.generate_file()\n weave.build_tools.build_extension(self.module.__name__+'_weave.cpp',verbose=2)\n\n if accelerated_module:\n raise NotImplementedError,'Reload'\n else:\n accelerated_module = __import__(self.module.__name__+'_weave')\n\n fast = getattr(accelerated_module,identifier)\n return fast\n\n def identifier(self,signature):\n # Build an MD5 checksum\n f = self.function\n co = f.func_code\n identifier = str(signature)+\\\n str(co.co_argcount)+\\\n str(co.co_consts)+\\\n str(co.co_varnames)+\\\n co.co_code\n return 'F'+md5.md5(identifier).hexdigest()\n \n def accelerate(self,signature,identifier):\n P = Python2CXX(self.function,signature,name=identifier)\n return P\n\n def code(self,*args):\n if len(args) != self.function.func_code.co_argcount:\n raise TypeError,'%s() takes exactly %d arguments (%d given)'%(\n self.function.__name__,\n self.function.func_code.co_argcount,\n len(args))\n signature = tuple( map(lookup_type,args) )\n ident = self.function.__name__\n return self.accelerate(signature,ident).function_code()\n \n\n##################################################################\n# CLASS PYTHON2CXX #\n##################################################################\nclass Python2CXX(CXXCoder):\n def typedef_by_value(self,v):\n T = lookup_type(v)\n if T not in self.used:\n self.used.append(T)\n return T\n\n def function_by_signature(self,signature):\n descriptor = functiondefs[signature]\n if descriptor.return_type not in self.used:\n self.used.append(descriptor.return_type)\n return descriptor\n\n def __init__(self,f,signature,name=None):\n # Make sure function is a function\n import types\n assert type(f) == FunctionType\n # and check the input type signature\n assert reduce(lambda x,y: x and y,\n map(lambda x: isinstance(x,Type_Descriptor),\n signature),\n 1),'%s not all type objects'%signature\n self.arg_specs = []\n self.customize = weave.base_info.custom_info()\n\n CXXCoder.__init__(self,f,signature,name)\n\n return\n\n def function_code(self):\n code = self.wrapped_code()\n for T in self.used:\n if T != None and T.module_init_code:\n self.customize.add_module_init_code(T.module_init_code)\n return code\n\n def python_function_definition_code(self):\n return '{ \"%s\", wrapper_%s, METH_VARARGS, %s },\\n'%(\n self.name,\n self.name,\n CStr(self.function.__doc__))\n", + "source_code_before": "#**************************************************************************#\n#* FILE ************** accelerate_tools.py ************************#\n#**************************************************************************#\n#* Author: Patrick Miller February 9 2002 *#\n#**************************************************************************#\n\"\"\"\naccelerate_tools contains the interface for on-the-fly building of\nC++ equivalents to Python functions.\n\"\"\"\n#**************************************************************************#\n\nfrom types import FunctionType,IntType,FloatType,StringType,TypeType,XRangeType\nimport inspect\nimport md5\nimport weave\nfrom bytecodecompiler import CXXCoder,Type_Descriptor,Function_Descriptor\n\ndef CStr(s):\n \"Hacky way to get legal C string from Python string\"\n if s is None: return '\"\"'\n assert type(s) == StringType,\"Only None and string allowed\"\n r = repr('\"'+s) # Better for embedded quotes\n return '\"'+r[2:-1]+'\"'\n\nclass Basic(Type_Descriptor):\n def check(self,s):\n return \"%s(%s)\"%(self.checker,s)\n def inbound(self,s):\n return \"%s(%s)\"%(self.inbounder,s)\n def outbound(self,s):\n return \"%s(%s)\"%(self.outbounder,s)\n\nclass Basic_Number(Basic):\n def literalizer(self,s):\n return str(s)\n def binop(self,symbol,a,b):\n assert symbol in ['+','-','*','/'],symbol\n return '%s %s %s'%(a,symbol,b),self\n\nclass Integer(Basic_Number):\n cxxtype = \"long\"\n checker = \"PyInt_Check\"\n inbounder = \"PyInt_AsLong\"\n outbounder = \"PyInt_FromLong\"\n\nclass Double(Basic_Number):\n cxxtype = \"double\"\n checker = \"PyFloat_Check\"\n inbounder = \"PyFloat_AsDouble\"\n outbounder = \"PyFloat_FromDouble\"\n\nclass String(Basic):\n cxxtype = \"char*\"\n checker = \"PyString_Check\"\n inbounder = \"PyString_AsString\"\n outbounder = \"PyString_FromString\"\n\n def literalizer(self,s):\n return CStr(s)\n\n# -----------------------------------------------\n# Singletonize the type names\n# -----------------------------------------------\nInteger = Integer()\nDouble = Double()\nString = String()\n\nimport Numeric\n\nclass Vector(Type_Descriptor):\n cxxtype = 'PyArrayObject*'\n refcount = 1\n dims = 1\n module_init_code = 'import_array();'\n\n prerequisites = Type_Descriptor.prerequisites+\\\n ['#include \"Numeric/arrayobject.h\"']\n dims = 1\n def check(self,s):\n return \"PyArray_Check(%s) && ((PyArrayObject*)%s)->nd == %d && ((PyArrayObject*)%s)->descr->type_num == %s\"%(\n s,s,self.dims,s,self.typecode)\n def inbound(self,s):\n return \"(PyArrayObject*)(%s)\"%s\n def outbound(self,s):\n return \"(PyObject*)(%s)\"%s\n def getitem(self,A,v,t):\n assert self.dims == len(v),'Expect dimension %d'%self.dims\n code = '*((%s*)(%s->data'%(self.cxxbase,A)\n for i in range(self.dims):\n # assert that ''t[i]'' is an integer\n code += '+%s*%s->strides[%d]'%(v[i],A,i)\n code += '))'\n return code,self.pybase\n def setitem(self,A,v,t):\n return self.getitem(A,v,t)\n\nclass matrix(Vector):\n dims = 2\n\nclass IntegerVector(Vector):\n typecode = 'PyArray_INT'\n cxxbase = 'int'\n pybase = Integer\n\nclass Integermatrix(matrix):\n typecode = 'PyArray_INT'\n cxxbase = 'int'\n pybase = Integer\n\nclass LongVector(Vector):\n typecode = 'PyArray_LONG'\n cxxbase = 'long'\n pybase = Integer\n\nclass Longmatrix(matrix):\n typecode = 'PyArray_LONG'\n cxxbase = 'long'\n pybase = Integer\n\nclass DoubleVector(Vector):\n typecode = 'PyArray_DOUBLE'\n cxxbase = 'double'\n pybase = Double\n\nclass Doublematrix(matrix):\n typecode = 'PyArray_DOUBLE'\n cxxbase = 'double'\n pybase = Double\n\nclass XRange(Type_Descriptor):\n cxxtype = 'XRange'\n prerequisites = ['''\n class XRange {\n public:\n XRange(long aLow, long aHigh, long aStep=1)\n : low(aLow),high(aHigh),step(aStep)\n {\n }\n long low;\n long high;\n long step;\n };''']\n\n# -----------------------------------------------\n# Singletonize the type names\n# -----------------------------------------------\nIntegerVector = IntegerVector()\nIntegermatrix = Integermatrix()\nLongVector = LongVector()\nLongmatrix = Longmatrix()\nDoubleVector = DoubleVector()\nDoublematrix = Doublematrix()\nXRange = XRange()\n\ntypedefs = {\n IntType: Integer,\n FloatType: Double,\n StringType: String,\n (Numeric.ArrayType,1,'i'): IntegerVector,\n (Numeric.ArrayType,2,'i'): Integermatrix,\n (Numeric.ArrayType,1,'l'): LongVector,\n (Numeric.ArrayType,2,'l'): Longmatrix,\n (Numeric.ArrayType,1,'d'): DoubleVector,\n (Numeric.ArrayType,2,'d'): Doublematrix,\n XRangeType : XRange,\n }\n\nimport math\nfunctiondefs = {\n (range,(Integer,Integer)):\n Function_Descriptor(code='XRange(%s)',return_type=XRange),\n\n (math.sin,(Double,)):\n Function_Descriptor(code='sin(%s)',return_type=Double),\n\n (math.sqrt,(Double,)):\n Function_Descriptor(code='sqrt(%s)',return_type=Double),\n }\n \n\n\n##################################################################\n# FUNCTION LOOKUP_TYPE #\n##################################################################\ndef lookup_type(x):\n T = type(x)\n try:\n return typedefs[T]\n except:\n return typedefs[(T,len(x.shape),x.typecode())]\n\n##################################################################\n# class ACCELERATE #\n##################################################################\nclass accelerate:\n \n def __init__(self, function, *args, **kw):\n assert type(function) == FunctionType\n self.function = function\n self.module = inspect.getmodule(function)\n if self.module is None:\n import __main__\n self.module = __main__\n self.__call_map = {}\n\n def __cache(self,*args):\n raise TypeError\n\n def __call__(self,*args):\n try:\n return self.__cache(*args)\n except TypeError:\n # Figure out type info -- Do as tuple so its hashable\n signature = tuple( map(lookup_type,args) )\n \n # If we know the function, call it\n try:\n fast = self.__call_map[signature]\n except:\n fast = self.singleton(signature)\n self.__cache = fast\n self.__call_map[signature] = fast\n return fast(*args)\n\n def signature(self,*args):\n # Figure out type info -- Do as tuple so its hashable\n signature = tuple( map(lookup_type,args) )\n return self.singleton(signature)\n\n\n def singleton(self,signature):\n identifier = self.identifier(signature)\n \n # Generate a new function, then call it\n f = self.function\n\n # See if we have an accelerated version of module\n try:\n accelerated_module = __import__(self.module.__name__+'_weave')\n fast = getattr(accelerated_module,identifier)\n return fast\n except:\n accelerated_module = None\n\n P = self.accelerate(signature,identifier)\n\n E = weave.ext_tools.ext_module(self.module.__name__+'_weave')\n E.add_function(P)\n E.generate_file()\n weave.build_tools.build_extension(self.module.__name__+'_weave.cpp',verbose=2)\n\n if accelerated_module:\n accelerated_module = reload(accelerated_module)\n else:\n accelerated_module = __import__(self.module.__name__+'_weave')\n\n fast = getattr(accelerated_module,identifier)\n return fast\n\n def identifier(self,signature):\n # Build an MD5 checksum\n f = self.function\n co = f.func_code\n identifier = str(signature)+\\\n str(co.co_argcount)+\\\n str(co.co_consts)+\\\n str(co.co_varnames)+\\\n co.co_code\n return 'F'+md5.md5(identifier).hexdigest()\n \n def accelerate(self,signature,identifier):\n P = Python2CXX(self.function,signature,name=identifier)\n return P\n\n def code(self,*args):\n if len(args) != self.function.func_code.co_argcount:\n raise TypeError,'%s() takes exactly %d arguments (%d given)'%(\n self.function.__name__,\n self.function.func_code.co_argcount,\n len(args))\n signature = tuple( map(lookup_type,args) )\n ident = self.function.__name__\n return self.accelerate(signature,ident).function_code()\n \n\n##################################################################\n# CLASS PYTHON2CXX #\n##################################################################\nclass Python2CXX(CXXCoder):\n def typedef_by_value(self,v):\n T = lookup_type(v)\n if T not in self.used:\n self.used.append(T)\n return T\n\n def function_by_signature(self,signature):\n descriptor = functiondefs[signature]\n if descriptor.return_type not in self.used:\n self.used.append(descriptor.return_type)\n return descriptor\n\n def __init__(self,f,signature,name=None):\n # Make sure function is a function\n import types\n assert type(f) == FunctionType\n # and check the input type signature\n assert reduce(lambda x,y: x and y,\n map(lambda x: isinstance(x,Type_Descriptor),\n signature),\n 1),'%s not all type objects'%signature\n self.arg_specs = []\n self.customize = weave.base_info.custom_info()\n\n CXXCoder.__init__(self,f,signature,name)\n\n return\n\n def function_code(self):\n code = self.wrapped_code()\n for T in self.used:\n if T != None and T.module_init_code:\n self.customize.add_module_init_code(T.module_init_code)\n return code\n\n def python_function_definition_code(self):\n return '{ \"%s\", wrapper_%s, METH_VARARGS, %s },\\n'%(\n self.name,\n self.name,\n CStr(self.function.__doc__))\n", + "methods": [ + { + "name": "CStr", + "long_name": "CStr( s )", + "filename": "accelerate_tools.py", + "nloc": 6, + "complexity": 2, + "token_count": 42, + "parameters": [ + "s" + ], + "start_line": 19, + "end_line": 24, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , prototype )", + "filename": "accelerate_tools.py", + "nloc": 3, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self", + "prototype" + ], + "start_line": 33, + "end_line": 35, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "check", + "long_name": "check( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self", + "s" + ], + "start_line": 37, + "end_line": 38, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "inbound", + "long_name": "inbound( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "s" + ], + "start_line": 40, + "end_line": 41, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "outbound", + "long_name": "outbound( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self", + "s" + ], + "start_line": 43, + "end_line": 44, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_attribute", + "long_name": "get_attribute( self , name )", + "filename": "accelerate_tools.py", + "nloc": 7, + "complexity": 1, + "token_count": 45, + "parameters": [ + "self", + "name" + ], + "start_line": 46, + "end_line": 52, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "set_attribute", + "long_name": "set_attribute( self , name )", + "filename": "accelerate_tools.py", + "nloc": 10, + "complexity": 2, + "token_count": 57, + "parameters": [ + "self", + "name" + ], + "start_line": 54, + "end_line": 63, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "check", + "long_name": "check( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "s" + ], + "start_line": 70, + "end_line": 71, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "inbound", + "long_name": "inbound( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "s" + ], + "start_line": 72, + "end_line": 73, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "outbound", + "long_name": "outbound( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 21, + "parameters": [ + "self", + "s" + ], + "start_line": 74, + "end_line": 75, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "literalizer", + "long_name": "literalizer( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "s" + ], + "start_line": 78, + "end_line": 79, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "binop", + "long_name": "binop( self , symbol , a , b )", + "filename": "accelerate_tools.py", + "nloc": 3, + "complexity": 1, + "token_count": 37, + "parameters": [ + "self", + "symbol", + "a", + "b" + ], + "start_line": 80, + "end_line": 82, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "literalizer", + "long_name": "literalizer( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "s" + ], + "start_line": 102, + "end_line": 103, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "check", + "long_name": "check( self , s )", + "filename": "accelerate_tools.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "s" + ], + "start_line": 126, + "end_line": 128, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "inbound", + "long_name": "inbound( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "s" + ], + "start_line": 130, + "end_line": 131, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "outbound", + "long_name": "outbound( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 21, + "parameters": [ + "self", + "s" + ], + "start_line": 132, + "end_line": 133, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "getitem", + "long_name": "getitem( self , A , v , t )", + "filename": "accelerate_tools.py", + "nloc": 7, + "complexity": 2, + "token_count": 70, + "parameters": [ + "self", + "A", + "v", + "t" + ], + "start_line": 135, + "end_line": 142, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "setitem", + "long_name": "setitem( self , A , v , t )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self", + "A", + "v", + "t" + ], + "start_line": 143, + "end_line": 144, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "lookup_type", + "long_name": "lookup_type( x )", + "filename": "accelerate_tools.py", + "nloc": 12, + "complexity": 4, + "token_count": 68, + "parameters": [ + "x" + ], + "start_line": 258, + "end_line": 269, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , function , * args , ** kw )", + "filename": "accelerate_tools.py", + "nloc": 8, + "complexity": 2, + "token_count": 55, + "parameters": [ + "self", + "function", + "args", + "kw" + ], + "start_line": 276, + "end_line": 283, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "__cache", + "long_name": "__cache( self , * args )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "args" + ], + "start_line": 285, + "end_line": 286, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__call__", + "long_name": "__call__( self , * args )", + "filename": "accelerate_tools.py", + "nloc": 12, + "complexity": 3, + "token_count": 71, + "parameters": [ + "self", + "args" + ], + "start_line": 288, + "end_line": 302, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "signature", + "long_name": "signature( self , * args )", + "filename": "accelerate_tools.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self", + "args" + ], + "start_line": 304, + "end_line": 307, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "singleton", + "long_name": "singleton( self , signature )", + "filename": "accelerate_tools.py", + "nloc": 24, + "complexity": 4, + "token_count": 160, + "parameters": [ + "self", + "signature" + ], + "start_line": 310, + "end_line": 341, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "identifier", + "long_name": "identifier( self , signature )", + "filename": "accelerate_tools.py", + "nloc": 9, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "signature" + ], + "start_line": 343, + "end_line": 352, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "accelerate", + "long_name": "accelerate( self , signature , identifier )", + "filename": "accelerate_tools.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "signature", + "identifier" + ], + "start_line": 354, + "end_line": 356, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "code", + "long_name": "code( self , * args )", + "filename": "accelerate_tools.py", + "nloc": 9, + "complexity": 2, + "token_count": 78, + "parameters": [ + "self", + "args" + ], + "start_line": 358, + "end_line": 366, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "typedef_by_value", + "long_name": "typedef_by_value( self , v )", + "filename": "accelerate_tools.py", + "nloc": 5, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self", + "v" + ], + "start_line": 373, + "end_line": 377, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "function_by_signature", + "long_name": "function_by_signature( self , signature )", + "filename": "accelerate_tools.py", + "nloc": 5, + "complexity": 2, + "token_count": 35, + "parameters": [ + "self", + "signature" + ], + "start_line": 379, + "end_line": 383, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , f , signature , name = None )", + "filename": "accelerate_tools.py", + "nloc": 11, + "complexity": 2, + "token_count": 85, + "parameters": [ + "self", + "f", + "signature", + "name" + ], + "start_line": 385, + "end_line": 399, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "function_code", + "long_name": "function_code( self )", + "filename": "accelerate_tools.py", + "nloc": 6, + "complexity": 4, + "token_count": 40, + "parameters": [ + "self" + ], + "start_line": 401, + "end_line": 406, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "python_function_definition_code", + "long_name": "python_function_definition_code( self )", + "filename": "accelerate_tools.py", + "nloc": 5, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 408, + "end_line": 412, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + } + ], + "methods_before": [ + { + "name": "CStr", + "long_name": "CStr( s )", + "filename": "accelerate_tools.py", + "nloc": 6, + "complexity": 2, + "token_count": 42, + "parameters": [ + "s" + ], + "start_line": 18, + "end_line": 23, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "check", + "long_name": "check( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "s" + ], + "start_line": 26, + "end_line": 27, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "inbound", + "long_name": "inbound( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "s" + ], + "start_line": 28, + "end_line": 29, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "outbound", + "long_name": "outbound( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "s" + ], + "start_line": 30, + "end_line": 31, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "literalizer", + "long_name": "literalizer( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "s" + ], + "start_line": 34, + "end_line": 35, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "binop", + "long_name": "binop( self , symbol , a , b )", + "filename": "accelerate_tools.py", + "nloc": 3, + "complexity": 1, + "token_count": 37, + "parameters": [ + "self", + "symbol", + "a", + "b" + ], + "start_line": 36, + "end_line": 38, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "literalizer", + "long_name": "literalizer( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "s" + ], + "start_line": 58, + "end_line": 59, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "check", + "long_name": "check( self , s )", + "filename": "accelerate_tools.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "s" + ], + "start_line": 79, + "end_line": 81, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "inbound", + "long_name": "inbound( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self", + "s" + ], + "start_line": 82, + "end_line": 83, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "outbound", + "long_name": "outbound( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self", + "s" + ], + "start_line": 84, + "end_line": 85, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "getitem", + "long_name": "getitem( self , A , v , t )", + "filename": "accelerate_tools.py", + "nloc": 7, + "complexity": 2, + "token_count": 70, + "parameters": [ + "self", + "A", + "v", + "t" + ], + "start_line": 86, + "end_line": 93, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "setitem", + "long_name": "setitem( self , A , v , t )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self", + "A", + "v", + "t" + ], + "start_line": 94, + "end_line": 95, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "lookup_type", + "long_name": "lookup_type( x )", + "filename": "accelerate_tools.py", + "nloc": 6, + "complexity": 2, + "token_count": 40, + "parameters": [ + "x" + ], + "start_line": 185, + "end_line": 190, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , function , * args , ** kw )", + "filename": "accelerate_tools.py", + "nloc": 8, + "complexity": 2, + "token_count": 55, + "parameters": [ + "self", + "function", + "args", + "kw" + ], + "start_line": 197, + "end_line": 204, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "__cache", + "long_name": "__cache( self , * args )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "args" + ], + "start_line": 206, + "end_line": 207, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__call__", + "long_name": "__call__( self , * args )", + "filename": "accelerate_tools.py", + "nloc": 12, + "complexity": 3, + "token_count": 71, + "parameters": [ + "self", + "args" + ], + "start_line": 209, + "end_line": 223, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "signature", + "long_name": "signature( self , * args )", + "filename": "accelerate_tools.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self", + "args" + ], + "start_line": 225, + "end_line": 228, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "singleton", + "long_name": "singleton( self , signature )", + "filename": "accelerate_tools.py", + "nloc": 20, + "complexity": 3, + "token_count": 137, + "parameters": [ + "self", + "signature" + ], + "start_line": 231, + "end_line": 258, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 28, + "top_nesting_level": 1 + }, + { + "name": "identifier", + "long_name": "identifier( self , signature )", + "filename": "accelerate_tools.py", + "nloc": 9, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "signature" + ], + "start_line": 260, + "end_line": 269, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "accelerate", + "long_name": "accelerate( self , signature , identifier )", + "filename": "accelerate_tools.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "signature", + "identifier" + ], + "start_line": 271, + "end_line": 273, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "code", + "long_name": "code( self , * args )", + "filename": "accelerate_tools.py", + "nloc": 9, + "complexity": 2, + "token_count": 78, + "parameters": [ + "self", + "args" + ], + "start_line": 275, + "end_line": 283, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "typedef_by_value", + "long_name": "typedef_by_value( self , v )", + "filename": "accelerate_tools.py", + "nloc": 5, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self", + "v" + ], + "start_line": 290, + "end_line": 294, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "function_by_signature", + "long_name": "function_by_signature( self , signature )", + "filename": "accelerate_tools.py", + "nloc": 5, + "complexity": 2, + "token_count": 35, + "parameters": [ + "self", + "signature" + ], + "start_line": 296, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , f , signature , name = None )", + "filename": "accelerate_tools.py", + "nloc": 11, + "complexity": 2, + "token_count": 85, + "parameters": [ + "self", + "f", + "signature", + "name" + ], + "start_line": 302, + "end_line": 316, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "function_code", + "long_name": "function_code( self )", + "filename": "accelerate_tools.py", + "nloc": 6, + "complexity": 4, + "token_count": 40, + "parameters": [ + "self" + ], + "start_line": 318, + "end_line": 323, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "python_function_definition_code", + "long_name": "python_function_definition_code( self )", + "filename": "accelerate_tools.py", + "nloc": 5, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 325, + "end_line": 329, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + } + ], + "changed_methods": [ + { + "name": "singleton", + "long_name": "singleton( self , signature )", + "filename": "accelerate_tools.py", + "nloc": 24, + "complexity": 4, + "token_count": 160, + "parameters": [ + "self", + "signature" + ], + "start_line": 310, + "end_line": 341, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "get_attribute", + "long_name": "get_attribute( self , name )", + "filename": "accelerate_tools.py", + "nloc": 7, + "complexity": 1, + "token_count": 45, + "parameters": [ + "self", + "name" + ], + "start_line": 46, + "end_line": 52, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , prototype )", + "filename": "accelerate_tools.py", + "nloc": 3, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self", + "prototype" + ], + "start_line": 33, + "end_line": 35, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "lookup_type", + "long_name": "lookup_type( x )", + "filename": "accelerate_tools.py", + "nloc": 12, + "complexity": 4, + "token_count": 68, + "parameters": [ + "x" + ], + "start_line": 258, + "end_line": 269, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "check", + "long_name": "check( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self", + "s" + ], + "start_line": 37, + "end_line": 38, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "set_attribute", + "long_name": "set_attribute( self , name )", + "filename": "accelerate_tools.py", + "nloc": 10, + "complexity": 2, + "token_count": 57, + "parameters": [ + "self", + "name" + ], + "start_line": 54, + "end_line": 63, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "inbound", + "long_name": "inbound( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "s" + ], + "start_line": 40, + "end_line": 41, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "outbound", + "long_name": "outbound( self , s )", + "filename": "accelerate_tools.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self", + "s" + ], + "start_line": 43, + "end_line": 44, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + } + ], + "nloc": 303, + "complexity": 51, + "token_count": 1855, + "diff_parsed": { + "added": [ + "from types import InstanceType,FunctionType,IntType,FloatType,StringType,TypeType,XRangeType", + "import imp", + "", + "##################################################################", + "# CLASS INSTANCE #", + "##################################################################", + "class Instance(Type_Descriptor):", + " cxxtype = 'PyObject*'", + "", + " def __init__(self,prototype):", + "\tself.prototype\t= prototype", + "\treturn", + "", + " def check(self,s):", + " return \"PyInstance_Check(%s)\"%s", + "", + " def inbound(self,s):", + " return s", + "", + " def outbound(self,s):", + " return s,0", + "", + " def get_attribute(self,name):", + " proto = getattr(self.prototype,name)", + " T = lookup_type(proto)", + " code = 'tempPY = PyObject_GetAttrString(%%(rhs)s,\"%s\");\\n'%name", + " convert = T.inbound('tempPY')", + " code += '%%(lhsType)s %%(lhs)s = %s;\\n'%convert", + " return T,code", + "", + " def set_attribute(self,name):", + " proto = getattr(self.prototype,name)", + " T = lookup_type(proto)", + " convert,owned = T.outbound('%(rhs)s')", + " code = 'tempPY = %s;'%convert", + " if not owned:", + " code += ' Py_INCREF(tempPY);'", + " code += ' PyObject_SetAttrString(%%(lhs)s,\"%s\",tempPY);'%name", + " code += ' Py_DECREF(tempPY);\\n'", + " return T,code", + "", + "##################################################################", + "# CLASS BASIC #", + "##################################################################", + " owned = 1", + " return \"%s(%s)\"%(self.outbounder,s),self.owned", + " module_init_code = 'import_array();\\n'", + " inbounder = \"(PyArrayObject*)\"", + " outbounder = \"(PyObject*)\"", + " owned = 0 # Convertion is by casting!", + "", + " return \"%s(%s)\"%(self.inbounder,s)", + " return \"%s(%s)\"%(self.outbounder,s),self.owned", + "", + "", + "##################################################################", + "# CLASS XRANGE #", + "##################################################################", + " XRange(long aHigh)", + " : low(0),high(aHigh),step(1)", + " {", + " }", + "", + " (len,(String,)):", + " Function_Descriptor(code='strlen(%s)',return_type=Integer),", + "", + " (len,(LongVector,)):", + " Function_Descriptor(code='PyArray_Size((PyObject*)%s)',return_type=Integer),", + "", + " (float,(Integer,)):", + " Function_Descriptor(code='(double)(%s)',return_type=Double),", + "", + " (range,(Integer)):", + " Function_Descriptor(code='XRange(%s)',return_type=XRange),", + "", + " (math.cos,(Double,)):", + " Function_Descriptor(code='cos(%s)',return_type=Double),", + "", + " import Numeric", + " if isinstance(T,Numeric.ArrayType):", + " return typedefs[(T,len(x.shape),x.typecode())]", + " elif T == InstanceType:", + " return Instance(x)", + " else:", + " raise NotImplementedError,T", + " print 'lookup',self.module.__name__+'_weave'", + " print 'have accelerated',self.module.__name__+'_weave'", + " except ImportError:", + " except AttributeError:", + " pass", + " raise NotImplementedError,'Reload'" + ], + "deleted": [ + "from types import FunctionType,IntType,FloatType,StringType,TypeType,XRangeType", + " return \"%s(%s)\"%(self.outbounder,s)", + " module_init_code = 'import_array();'", + " return \"(PyArrayObject*)(%s)\"%s", + " return \"(PyObject*)(%s)\"%s", + " return typedefs[(T,len(x.shape),x.typecode())]", + " except:", + " accelerated_module = reload(accelerated_module)" + ] + } + }, + { + "old_path": "weave/bytecodecompiler.py", + "new_path": "weave/bytecodecompiler.py", + "filename": "bytecodecompiler.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -781,6 +781,8 @@ def generate(self):\n t = self.types[i]\n code += '%s %s'%(t.cxxtype,n)\n code += ') {\\n'\n+ code += ' PyObject* tempPY= 0;\\n'\n+\n \n # Add in non-argument temporaries\n # Assuming first argcount locals are positional args\n@@ -808,7 +810,6 @@ def wrapped_code(self):\n # Wrapper\n # -----------------------------------------------\n code += 'static PyObject* wrapper_%s(PyObject*,PyObject* args) {\\n'%self.name\n-\n code += ' // Length check\\n'\n code += ' if ( PyTuple_Size(args) != %d ) {\\n'%len(self.signature)\n code += ' PyErr_SetString(PyExc_TypeError,\"Expected %d arguments\");\\n'%len(self.signature)\n@@ -863,7 +864,9 @@ def wrapped_code(self):\n code += ' Py_INCREF(Py_None);\\n'\n code += ' return Py_None;\\n'\n else:\n- result = self.rtype.outbound('_result')\n+ result,owned = self.rtype.outbound('_result')\n+ if not owned:\n+ code += ' Py_INCREF(_result);\\n'\n code += ' return %s;\\n'%result\n code += '}\\n'\n return code\n@@ -1071,10 +1074,12 @@ def PRINT_ITEM(self,pc):\n v,t = self.pop()\n \n py = self.unique()\n- self.emit('PyObject* %s = %s;'%(py, t.outbound(v)))\n+ code,owned = t.outbound(v)\n+ self.emit('PyObject* %s = %s;'%(py, code))\n self.emit('PyFile_WriteObject(%s,%s,Py_PRINT_RAW);'%(\n py,w))\n- self.emit('Py_XDECREF(%s);'%py)\n+ if owned:\n+ self.emit('Py_XDECREF(%s);'%py)\n return\n \n \n@@ -1154,6 +1159,43 @@ def LOAD_FAST(self,pc,var_num):\n self.push(v,t)\n return\n \n+\n+ ##################################################################\n+ # MEMBER LOAD_ATTR #\n+ ##################################################################\n+ def LOAD_ATTR(self,pc,namei):\n+ v,t = self.pop()\n+ attr_name = self.codeobject.co_names[namei]\n+ print 'LOAD_ATTR',namei,v,t,attr_name\n+ aType,aCode = t.get_attribute(attr_name)\n+ print 'ATTR',aType\n+ print aCode\n+ lhs = self.unique()\n+ rhs = v\n+ lhsType = aType.cxxtype\n+ self.emit(aCode%locals())\n+ self.push(lhs,aType)\n+ return\n+\n+\n+ ##################################################################\n+ # MEMBER STORE_ATTR #\n+ ##################################################################\n+ def STORE_ATTR(self,pc,namei):\n+ v,t = self.pop()\n+ attr_name = self.codeobject.co_names[namei]\n+ print 'STORE_ATTR',namei,v,t,attr_name\n+ v2,t2 = self.pop()\n+ print 'SA value',v2,t2\n+ aType,aCode = t.set_attribute(attr_name)\n+ print 'ATTR',aType\n+ print aCode\n+ assert t2 is aType\n+ rhs = v2\n+ lhs = v\n+ self.emit(aCode%locals())\n+ return\n+\n ##################################################################\n # MEMBER LOAD_GLOBAL #\n ##################################################################\n@@ -1257,9 +1299,10 @@ def STORE_GLOBAL(self,pc,var_num):\n v,t = self.pop()\n descriptor = typedefs[t]\n py = self.unique()\n- self.emit('PyObject* %s = %s;'%(\n- py,\n- descriptor.outbound%v))\n+ code,owned = descriptor.outbound(v)\n+ self.emit('PyObject* %s = %s;'%(py,code))\n+ if not owned:\n+ self.emit('Py_INCREF(%s);'%py)\n mod = self.unique()\n self.emit('PyObject* %s = PyImport_ImportModule(\"%s\");'%(\n mod,module_name))\n", + "added_lines": 50, + "deleted_lines": 7, + "source_code": "#**************************************************************************#\n#* FILE ************** bytecodecompiler.py ************************#\n#************************************************************************ **#\n#* Author: Patrick Miller February 9 2002 *#\n#* Copyright (C) 2002 Patrick J. Miller *#\n#**************************************************************************#\n#* *#\n#**************************************************************************#\nfrom types import *\nimport string\nimport inspect\n\n##################################################################\n# CLASS __DESCRIPTOR #\n##################################################################\nclass __Descriptor:\n prerequisites = []\n refcount = 0\n def __repr__(self):\n return self.__module__+'.'+self.__class__.__name__\n\n##################################################################\n# CLASS TYPE_DESCRIPTOR #\n##################################################################\nclass Type_Descriptor(__Descriptor):\n module_init_code = ''\n\n##################################################################\n# CLASS FUNCTION_DESCRIPTOR #\n##################################################################\nclass Function_Descriptor(__Descriptor):\n def __init__(self,code,return_type,support=''):\n\tself.code\t= code\n\tself.return_type\t= return_type\n self.support = support\n\treturn\n\n \n \n\nhaveArgument = 90 # Opcodes greater-equal to this have argument\nbyName = {\n 'STOP_CODE': 0,\n 'POP_TOP': 1,\n 'ROT_TWO': 2,\n 'ROT_THREE': 3,\n 'DUP_TOP': 4,\n 'ROT_FOUR': 5,\n 'UNARY_POSITIVE': 10,\n 'UNARY_NEGATIVE': 11,\n 'UNARY_NOT': 12,\n 'UNARY_CONVERT': 13,\n 'UNARY_INVERT': 15,\n 'BINARY_POWER': 19,\n 'BINARY_MULTIPLY': 20,\n 'BINARY_DIVIDE': 21,\n 'BINARY_MODULO': 22,\n 'BINARY_ADD': 23,\n 'BINARY_SUBTRACT': 24,\n 'BINARY_SUBSCR': 25,\n 'BINARY_FLOOR_DIVIDE': 26,\n 'BINARY_TRUE_DIVIDE': 27,\n 'INPLACE_FLOOR_DIVIDE': 28,\n 'INPLACE_TRUE_DIVIDE': 29,\n 'SLICE': 30,\n 'STORE_SLICE': 40,\n 'DELETE_SLICE': 50,\n 'INPLACE_ADD': 55,\n 'INPLACE_SUBTRACT': 56,\n 'INPLACE_MULTIPLY': 57,\n 'INPLACE_DIVIDE': 58,\n 'INPLACE_MODULO': 59,\n 'STORE_SUBSCR': 60,\n 'DELETE_SUBSCR': 61,\n 'BINARY_LSHIFT': 62,\n 'BINARY_RSHIFT': 63,\n 'BINARY_AND': 64,\n 'BINARY_XOR': 65,\n 'BINARY_OR': 66,\n 'INPLACE_POWER': 67,\n 'GET_ITER': 68,\n 'PRINT_EXPR': 70,\n 'PRINT_ITEM': 71,\n 'PRINT_NEWLINE': 72,\n 'PRINT_ITEM_TO': 73,\n 'PRINT_NEWLINE_TO': 74,\n 'INPLACE_LSHIFT': 75,\n 'INPLACE_RSHIFT': 76,\n 'INPLACE_AND': 77,\n 'INPLACE_XOR': 78,\n 'INPLACE_OR': 79,\n 'BREAK_LOOP': 80,\n 'LOAD_LOCALS': 82,\n 'RETURN_VALUE': 83,\n 'IMPORT_STAR': 84,\n 'EXEC_STMT': 85,\n 'YIELD_VALUE': 86,\n 'POP_BLOCK': 87,\n 'END_FINALLY': 88,\n 'BUILD_CLASS': 89,\n 'STORE_NAME': 90,\n 'DELETE_NAME': 91,\n 'UNPACK_SEQUENCE': 92,\n 'FOR_ITER': 93,\n 'STORE_ATTR': 95,\n 'DELETE_ATTR': 96,\n 'STORE_GLOBAL': 97,\n 'DELETE_GLOBAL': 98,\n 'DUP_TOPX': 99,\n 'LOAD_CONST': 100,\n 'LOAD_NAME': 101,\n 'BUILD_TUPLE': 102,\n 'BUILD_LIST': 103,\n 'BUILD_MAP': 104,\n 'LOAD_ATTR': 105,\n 'COMPARE_OP': 106,\n 'IMPORT_NAME': 107,\n 'IMPORT_FROM': 108,\n 'JUMP_FORWARD': 110,\n 'JUMP_IF_FALSE': 111,\n 'JUMP_IF_TRUE': 112,\n 'JUMP_ABSOLUTE': 113,\n 'FOR_LOOP': 114,\n 'LOAD_GLOBAL': 116,\n 'CONTINUE_LOOP': 119,\n 'SETUP_LOOP': 120,\n 'SETUP_EXCEPT': 121,\n 'SETUP_FINALLY': 122,\n 'LOAD_FAST': 124,\n 'STORE_FAST': 125,\n 'DELETE_FAST': 126,\n 'SET_LINENO': 127,\n 'RAISE_VARARGS': 130,\n 'CALL_FUNCTION': 131,\n 'MAKE_FUNCTION': 132,\n 'BUILD_SLICE': 133,\n 'MAKE_CLOSURE': 134,\n 'LOAD_CLOSURE': 135,\n 'LOAD_DEREF': 136,\n 'STORE_DEREF': 137,\n 'CALL_FUNCTION_VAR': 140,\n 'CALL_FUNCTION_KW': 141,\n 'CALL_FUNCTION_VAR_KW': 142,\n }\n\n# -----------------------------------------------\n# Build one in the reverse sense\n# -----------------------------------------------\nbyOpcode = {}\nfor name,op in map(None, byName.keys(), byName.values()):\n byOpcode[op] = name\n del name\n del op\n \n\n##################################################################\n# FUNCTION OPCODIZE #\n##################################################################\ndef opcodize(s):\n \"Slightly more readable form\"\n length = len(s)\n i = 0\n answer = []\n while i < length:\n bytecode = ord(s[i])\n name = byOpcode[bytecode]\n if bytecode >= haveArgument:\n argument = 256*ord(s[i+2])+ord(s[i+1])\n i += 3\n else:\n argument = None\n i += 1\n answer.append((bytecode,argument,name))\n return answer\n\n\n\n##################################################################\n# FUNCTION LIST #\n##################################################################\ndef listing(f):\n \"Pretty print the internals of your function\"\n assert type(f) == FunctionType,\"Arg %r must be a function\"%f\n filename = f.func_code.co_filename\n try:\n lines = open(filename).readlines()\n except:\n lines = None\n pc = 0\n s = ''\n lastLine = None\n for op,arg,name in opcodize(f.func_code.co_code):\n if lines and name == 'SET_LINENO':\n source = lines[arg-1][:-1]\n while lastLine and lastLine < arg-1:\n nonEmittingSource = lines[lastLine][:-1]\n lastLine += 1\n s += '%3s %20s %5s : %s\\n'%(\n '','','',nonEmittingSource)\n lastLine = arg\n else:\n source = ''\n if arg is None: arg = ''\n s += '%3d] %20s %5s : %s\\n'%(pc,name,arg,source)\n if op >= haveArgument:\n pc += 3\n else:\n pc += 1\n return s\n\n##################################################################\n# CLASS BYTECODEMEANING #\n##################################################################\nclass ByteCodeMeaning:\n def fetch(self, pc,code):\n opcode = ord(code[pc])\n if opcode >= haveArgument:\n argument = 256*ord(code[pc+2])+ord(code[pc+1])\n next = pc+3\n else:\n argument = None\n next = pc+1\n return next,opcode,argument\n \n def execute(self,pc,opcode,argument):\n name = byOpcode[opcode]\n method = getattr(self,name)\n if argument is None:\n return apply(method,(pc,))\n else:\n return apply(method,(pc,argument,))\n\n def evaluate(self, pc,code):\n next, opcode,argument = self.fetch(pc,code)\n goto = self.execute(next,opcode,argument)\n if goto == -1:\n return None # Must be done\n elif goto is None:\n return next # Normal\n else:\n raise 'xx'\n\n symbols = { 0: 'less', 1: 'lesseq', 2: 'equal', 3: 'notequal',\n 4: 'greater', 5: 'greatereq', 6: 'in', 7: 'not in',\n 8: 'is', 9: 'is not', 10: 'exe match',\n 11 : 'bad',\n }\n def cmp_op(self,opname):\n return self.symbols[opname]\n \n def STOP_CODE(self,pc):\n \"Indicates end-of-code to the compiler, not used by the interpreter.\"\n raise NotImplementedError\n def POP_TOP(self,pc):\n \"Removes the top-of-stack (TOS) item.\"\n raise NotImplementedError\n\n def ROT_TWO(self,pc):\n \"Swaps the two top-most stack items.\"\n raise NotImplementedError\n\n def ROT_THREE(self,pc):\n \"Lifts second and third stack item one position up, moves top down to position three.\"\n raise NotImplementedError\n\n def ROT_FOUR(self,pc):\n \"Lifts second, third and forth stack item one position up, moves top down to position four.\"\n raise NotImplementedError\n\n def DUP_TOP(self,pc):\n \"Duplicates the reference on top of the stack.\"\n raise NotImplementedError\n\n # Unary Operations take the top of the stack, apply the operation, and push the result back on the stack.\n\n def UNARY_POSITIVE(self,pc):\n \"Implements TOS = +TOS.\"\n raise NotImplementedError\n\n def UNARY_NEGATIVE(self,pc):\n \"Implements TOS = -TOS.\"\n raise NotImplementedError\n\n def UNARY_NOT(self,pc):\n \"Implements TOS = not TOS.\"\n raise NotImplementedError\n\n def UNARY_CONVERT(self,pc):\n \"Implements TOS = `TOS`.\"\n raise NotImplementedError\n\n def UNARY_INVERT(self,pc):\n \"Implements TOS = ~TOS.\"\n raise NotImplementedError\n\n #Binary operations remove the top of the stack (TOS) and the second top-most stack item (TOS1) from the stack. They perform the operation, and put the result back on the stack.\n\n def BINARY_POWER(self,pc):\n \"Implements TOS = TOS1 ** TOS.\"\n raise NotImplementedError\n\n def BINARY_MULTIPLY(self,pc):\n \"Implements TOS = TOS1 * TOS.\"\n raise NotImplementedError\n\n def BINARY_DIVIDE(self,pc):\n \"Implements TOS = TOS1 / TOS.\"\n raise NotImplementedError\n\n def BINARY_MODULO(self,pc):\n \"Implements TOS = TOS1 % TOS.\"\n raise NotImplementedError\n\n def BINARY_ADD(self,pc):\n \"Implements TOS = TOS1 + TOS.\"\n raise NotImplementedError\n\n def BINARY_SUBTRACT(self,pc):\n \"Implements TOS = TOS1 - TOS.\"\n raise NotImplementedError\n\n def BINARY_SUBSCR(self,pc):\n \"Implements TOS = TOS1[TOS].\"\n raise NotImplementedError\n\n def BINARY_LSHIFT(self,pc):\n \"Implements TOS = TOS1 << TOS.\"\n raise NotImplementedError\n\n def BINARY_RSHIFT(self,pc):\n \"Implements TOS = TOS1 >> TOS.\"\n raise NotImplementedError\n\n def BINARY_AND(self,pc):\n \"Implements TOS = TOS1 & TOS.\"\n raise NotImplementedError\n\n def BINARY_XOR(self,pc):\n \"Implements TOS = TOS1 ^ TOS.\"\n raise NotImplementedError\n\n def BINARY_OR(self,pc):\n \"Implements TOS = TOS1 | TOS.\"\n raise NotImplementedError\n\n #In-place operations are like binary operations, in that they remove TOS and TOS1, and push the result back on the stack, but the operation is done in-place when TOS1 supports it, and the resulting TOS may be (but does not have to be) the original TOS1.\n\n def INPLACE_POWER(self,pc):\n \"Implements in-place TOS = TOS1 ** TOS.\"\n raise NotImplementedError\n\n def INPLACE_MULTIPLY(self,pc):\n \"Implements in-place TOS = TOS1 * TOS.\"\n raise NotImplementedError\n\n def INPLACE_DIVIDE(self,pc):\n \"Implements in-place TOS = TOS1 / TOS.\"\n raise NotImplementedError\n\n def INPLACE_MODULO(self,pc):\n \"Implements in-place TOS = TOS1 % TOS.\"\n raise NotImplementedError\n\n def INPLACE_ADD(self,pc):\n \"Implements in-place TOS = TOS1 + TOS.\"\n raise NotImplementedError\n\n def INPLACE_SUBTRACT(self,pc):\n \"Implements in-place TOS = TOS1 - TOS.\"\n raise NotImplementedError\n\n def INPLACE_LSHIFT(self,pc):\n \"Implements in-place TOS = TOS1 << TOS.\"\n raise NotImplementedError\n\n def INPLACE_RSHIFT(self,pc):\n \"Implements in-place TOS = TOS1 >> TOS.\"\n raise NotImplementedError\n\n def INPLACE_AND(self,pc):\n \"Implements in-place TOS = TOS1 & TOS.\"\n raise NotImplementedError\n\n def INPLACE_XOR(self,pc):\n \"Implements in-place TOS = TOS1 ^ TOS.\"\n raise NotImplementedError\n\n def INPLACE_OR(self,pc):\n \"Implements in-place TOS = TOS1 | TOS.\"\n raise NotImplementedError\n\n #The slice opcodes take up to three parameters.\n\n def SLICE_0(self,pc):\n \"Implements TOS = TOS[:].\"\n raise NotImplementedError\n\n def SLICE_1(self,pc):\n \"Implements TOS = TOS1[TOS:].\"\n raise NotImplementedError\n\n def SLICE_2(self,pc):\n \"Implements TOS = TOS1[:TOS1].\"\n raise NotImplementedError\n\n def SLICE_3(self,pc):\n \"Implements TOS = TOS2[TOS1:TOS].\"\n raise NotImplementedError\n\n #Slice assignment needs even an additional parameter. As any statement, they put nothing on the stack.\n\n def STORE_SLICE_0(self,pc):\n \"Implements TOS[:] = TOS1.\"\n raise NotImplementedError\n\n def STORE_SLICE_1(self,pc):\n \"Implements TOS1[TOS:] = TOS2.\"\n raise NotImplementedError\n\n def STORE_SLICE_2(self,pc):\n \"Implements TOS1[:TOS] = TOS2.\"\n raise NotImplementedError\n\n def STORE_SLICE_3(self,pc):\n \"Implements TOS2[TOS1:TOS] = TOS3.\"\n raise NotImplementedError\n\n def DELETE_SLICE_0(self,pc):\n \"Implements del TOS[:].\"\n raise NotImplementedError\n\n def DELETE_SLICE_1(self,pc):\n \"Implements del TOS1[TOS:].\"\n raise NotImplementedError\n\n def DELETE_SLICE_2(self,pc):\n \"Implements del TOS1[:TOS].\"\n raise NotImplementedError\n\n def DELETE_SLICE_3(self,pc):\n \"Implements del TOS2[TOS1:TOS].\"\n raise NotImplementedError\n\n def STORE_SUBSCR(self,pc):\n \"Implements TOS1[TOS] = TOS2.\"\n raise NotImplementedError\n\n def DELETE_SUBSCR(self,pc):\n \"Implements del TOS1[TOS].\"\n raise NotImplementedError\n\n def PRINT_EXPR(self,pc):\n \"Implements the expression statement for the interactive mode. TOS is removed from the stack and printed. In non-interactive mode, an expression statement is terminated with POP_STACK.\"\n raise NotImplementedError\n\n def PRINT_ITEM(self,pc):\n \"Prints TOS to the file-like object bound to sys.stdout. There is one such instruction for each item in the print statement.\"\n raise NotImplementedError\n\n def PRINT_ITEM_TO(self,pc):\n \"Like PRINT_ITEM, but prints the item second from TOS to the file-like object at TOS. This is used by the extended print statement.\"\n raise NotImplementedError\n\n def PRINT_NEWLINE(self,pc):\n \"Prints a new line on sys.stdout. This is generated as the last operation of a print statement, unless the statement ends with a comma.\"\n raise NotImplementedError\n\n def PRINT_NEWLINE_TO(self,pc):\n \"Like PRINT_NEWLINE, but prints the new line on the file-like object on the TOS. This is used by the extended print statement.\"\n raise NotImplementedError\n\n def BREAK_LOOP(self,pc):\n \"Terminates a loop due to a break statement.\"\n raise NotImplementedError\n\n def LOAD_LOCALS(self,pc):\n \"Pushes a reference to the locals of the current scope on the stack. This is used in the code for a class definition: After the class body is evaluated, the locals are passed to the class definition.\"\n raise NotImplementedError\n\n def RETURN_VALUE(self,pc):\n \"Returns with TOS to the caller of the function.\"\n raise NotImplementedError\n\n def IMPORT_STAR(self,pc):\n \"Loads all symbols not starting with _ directly from the module TOS to the local namespace. The module is popped after loading all names. This opcode implements from module import *.\"\n raise NotImplementedError\n\n def EXEC_STMT(self,pc):\n \"Implements exec TOS2,TOS1,TOS. The compiler fills missing optional parameters with None.\"\n raise NotImplementedError\n\n def POP_BLOCK(self,pc):\n \"Removes one block from the block stack. Per frame, there is a stack of blocks, denoting nested loops, try statements, and such.\"\n raise NotImplementedError\n\n def END_FINALLY(self,pc):\n \"Terminates a finally clause. The interpreter recalls whether the exception has to be re-raised, or whether the function returns, and continues with the outer-next block.\"\n raise NotImplementedError\n\n def BUILD_CLASS(self,pc):\n \"Creates a new class object. TOS is the methods dictionary, TOS1 the tuple of the names of the base classes, and TOS2 the class name.\"\n raise NotImplementedError\n\n #All of the following opcodes expect arguments. An argument is two bytes, with the more significant byte last.\n\n def STORE_NAME(self,pc,namei):\n \"Implements name = TOS. namei is the index of name in the attribute co_names of the code object. The compiler tries to use STORE_LOCAL or STORE_GLOBAL if possible.\"\n raise NotImplementedError\n\n def DELETE_NAME(self,pc,namei):\n \"Implements del name, where namei is the index into co_names attribute of the code object.\"\n raise NotImplementedError\n\n def UNPACK_SEQUENCE(self,pc,count):\n \"Unpacks TOS into count individual values, which are put onto the stack right-to-left.\"\n raise NotImplementedError\n\n def DUP_TOPX(self,pc,count):\n \"Duplicate count items, keeping them in the same order. Due to implementation limits, count should be between 1 and 5 inclusive.\"\n raise NotImplementedError\n\n def STORE_ATTR(self,pc,namei):\n \"Implements TOS.name = TOS1, where namei is the index of name in co_names.\"\n raise NotImplementedError\n\n def DELETE_ATTR(self,pc,namei):\n \"Implements del TOS.name, using namei as index into co_names.\"\n raise NotImplementedError\n\n def STORE_GLOBAL(self,pc,namei):\n \"Works as STORE_NAME, but stores the name as a global.\"\n raise NotImplementedError\n\n def DELETE_GLOBAL(self,pc,namei):\n \"Works as DELETE_NAME, but deletes a global name.\"\n raise NotImplementedError\n\n def LOAD_CONST(self,pc,consti):\n \"Pushes co_consts[consti] onto the stack.\"\n raise NotImplementedError\n\n def LOAD_NAME(self,pc,namei):\n \"Pushes the value associated with co_names[namei] onto the stack.\"\n raise NotImplementedError\n\n def BUILD_TUPLE(self,pc,count):\n \"Creates a tuple consuming count items from the stack, and pushes the resulting tuple onto the stack.\"\n raise NotImplementedError\n\n def BUILD_LIST(self,pc,count):\n \"Works as BUILD_TUPLE, but creates a list.\"\n raise NotImplementedError\n\n def BUILD_MAP(self,pc,zero):\n \"Pushes a new empty dictionary object onto the stack. The argument is ignored and set to zero by the compiler.\"\n raise NotImplementedError\n\n def LOAD_ATTR(self,pc,namei):\n \"Replaces TOS with getattr(TOS, co_names[namei].\"\n raise NotImplementedError\n\n def COMPARE_OP(self,pc,opname):\n \"Performs a Boolean operation. The operation name can be found in cmp_op[opname].\"\n raise NotImplementedError\n\n def IMPORT_NAME(self,pc,namei):\n \"Imports the module co_names[namei]. The module object is pushed onto the stack. The current namespace is not affected: for a proper import statement, a subsequent STORE_FAST instruction modifies the namespace.\"\n raise NotImplementedError\n\n def IMPORT_FROM(self,pc,namei):\n \"Loads the attribute co_names[namei] from the module found in TOS. The resulting object is pushed onto the stack, to be subsequently stored by a STORE_FAST instruction.\"\n raise NotImplementedError\n\n def JUMP_FORWARD(self,pc,delta):\n \"Increments byte code counter by delta.\"\n raise NotImplementedError\n\n def JUMP_IF_TRUE(self,pc,delta):\n \"If TOS is true, increment the byte code counter by delta. TOS is left on the stack.\"\n raise NotImplementedError\n\n def JUMP_IF_FALSE(self,pc,delta):\n \"If TOS is false, increment the byte code counter by delta. TOS is not changed.\"\n raise NotImplementedError\n\n def JUMP_ABSOLUTE(self,pc,target):\n \"Set byte code counter to target.\"\n raise NotImplementedError\n\n def FOR_LOOP(self,pc,delta):\n \"Iterate over a sequence. TOS is the current index, TOS1 the sequence. First, the next element is computed. If the sequence is exhausted, increment byte code counter by delta. Otherwise, push the sequence, the incremented counter, and the current item onto the stack.\"\n raise NotImplementedError\n\n def LOAD_GLOBAL(self,pc,namei):\n \"Loads the global named co_names[namei] onto the stack.\"\n raise NotImplementedError\n\n def SETUP_LOOP(self,pc,delta):\n \"Pushes a block for a loop onto the block stack. The block spans from the current instruction with a size of delta bytes.\"\n raise NotImplementedError\n\n def SETUP_EXCEPT(self,pc,delta):\n \"Pushes a try block from a try-except clause onto the block stack. delta points to the first except block.\"\n raise NotImplementedError\n\n def SETUP_FINALLY(self,pc,delta):\n \"Pushes a try block from a try-except clause onto the block stack. delta points to the finally block.\"\n raise NotImplementedError\n\n def LOAD_FAST(self,pc,var_num):\n \"Pushes a reference to the local co_varnames[var_num] onto the stack.\"\n raise NotImplementedError\n\n def STORE_FAST(self,pc,var_num):\n \"Stores TOS into the local co_varnames[var_num].\"\n raise NotImplementedError\n\n def DELETE_FAST(self,pc,var_num):\n \"Deletes local co_varnames[var_num].\"\n raise NotImplementedError\n\n def LOAD_CLOSURE(self,pc,i):\n \"Pushes a reference to the cell contained in slot i of the cell and free variable storage. The name of the variable is co_cellvars[i] if i is less than the length of co_cellvars. Otherwise it is co_freevars[i - len(co_cellvars)].\"\n raise NotImplementedError\n\n def LOAD_DEREF(self,pc,i):\n \"Loads the cell contained in slot i of the cell and free variable storage. Pushes a reference to the object the cell contains on the stack.\"\n raise NotImplementedError\n\n def STORE_DEREF(self,pc,i):\n \"Stores TOS into the cell contained in slot i of the cell and free variable storage.\"\n raise NotImplementedError\n\n def SET_LINENO(self,pc,lineno):\n \"Sets the current line number to lineno.\"\n raise NotImplementedError\n\n def RAISE_VARARGS(self,pc,argc):\n \"Raises an exception. argc indicates the number of parameters to the raise statement, ranging from 0 to 3. The handler will find the traceback as TOS2, the parameter as TOS1, and the exception as TOS.\"\n raise NotImplementedError\n\n def CALL_FUNCTION(self,pc,argc):\n \"Calls a function. The low byte of argc indicates the number of positional parameters, the high byte the number of keyword parameters. On the stack, the opcode finds the keyword parameters first. For each keyword argument, the value is on top of the key. Below the keyword parameters, the positional parameters are on the stack, with the right-most parameter on top. Below the parameters, the function object to call is on the stack.\"\n raise NotImplementedError\n\n def MAKE_FUNCTION(self,pc,argc):\n \"Pushes a new function object on the stack. TOS is the code associated with the function. The function object is defined to have argc default parameters, which are found below TOS.\"\n raise NotImplementedError\n\n def MAKE_CLOSURE(self,pc,argc):\n \"Creates a new function object, sets its func_closure slot, and pushes it on the stack. TOS is the code associated with the function. If the code object has N free variables, the next N items on the stack are the cells for these variables. The function also has argc default parameters, where are found before the cells.\"\n raise NotImplementedError\n\n def BUILD_SLICE(self,pc,argc):\n \"Pushes a slice object on the stack. argc must be 2 or 3. If it is 2, slice(TOS1, TOS) is pushed; if it is 3, slice(TOS2, TOS1, TOS) is pushed. See the slice() built-in function for more information.\"\n raise NotImplementedError\n\n def EXTENDED_ARG(self,pc,ext):\n \"Prefixes any opcode which has an argument too big to fit into the default two bytes. ext holds two additional bytes which, taken together with the subsequent opcode's argument, comprise a four-byte argument, ext being the two most-significant bytes.\"\n raise NotImplementedError\n\n def CALL_FUNCTION_VAR(self,pc,argc):\n \"Calls a function. argc is interpreted as in CALL_FUNCTION. The top element on the stack contains the variable argument list, followed by keyword and positional arguments.\"\n raise NotImplementedError\n\n def CALL_FUNCTION_KW(self,pc,argc):\n \"Calls a function. argc is interpreted as in CALL_FUNCTION. The top element on the stack contains the keyword arguments dictionary, followed by explicit keyword and positional arguments.\"\n raise NotImplementedError\n\n def CALL_FUNCTION_VAR_KW(self,pc,argc):\n \"Calls a function. argc is interpreted as in CALL_FUNCTION. The top element on the stack contains the keyword arguments dictionary, followed by the variable-arguments tuple, followed by explicit keyword and positional arguments.\"\n raise NotImplementedError\n\n \n\n##################################################################\n# CLASS CXXCODER #\n##################################################################\nclass CXXCoder(ByteCodeMeaning):\n\n ##################################################################\n # MEMBER TYPEDEF_BY_VALUE #\n ##################################################################\n def typedef_by_value(self,v):\n raise NotImplementedError # VIRTUAL\n \n ##################################################################\n # MEMBER __INIT__ #\n ##################################################################\n def __init__(self,function,signature,name=None):\n assert type(function) == FunctionType,\"Arg must be a user function\"\n assert not function.func_defaults ,\"Function cannot have default args (yet)\"\n if name is None: name = function.func_name\n self.name = name\n self.function = function\n self.signature = signature\n self.codeobject = function.func_code\n self.__uid = 0 # Builds temps\n self.__indent = 1\n return\n\n ##################################################################\n # MEMBER EVALUATE #\n ##################################################################\n def evaluate(self, pc,code):\n # See if we posted any forwards for this offset\n if self.forwards.has_key(pc):\n for f in self.forwards[pc]:\n f()\n self.forwards[pc] = []\n return ByteCodeMeaning.evaluate(self,pc,code)\n \n ##################################################################\n # MEMBER GENERATE #\n ##################################################################\n def generate(self):\n self.forwards = {} # Actions on forward interprets\n self.__body = '' # Body will be built\n self.helpers = [] # headers and stuff\n\n # -----------------------------------------------\n # OK, crack open the function object and build\n # initial stack (not a real frame!)\n # -----------------------------------------------\n arglen = self.codeobject.co_argcount\n nlocals = self.codeobject.co_nlocals\n\n self.consts = self.codeobject.co_consts\n self.stack = list(self.codeobject.co_varnames)\n self.types = list(self.signature)+[None]*(nlocals-arglen)\n self.used = []\n for T in self.types:\n if T not in self.used: self.used.append(T)\n\n # -----------------------------------------------\n # One pass through the byte codes to generate\n # the body\n # -----------------------------------------------\n code = self.codeobject.co_code\n bytes = len(code)\n pc = 0\n while pc != None and pc < bytes:\n pc = self.evaluate(pc,code)\n\n # -----------------------------------------------\n # Return?\n # -----------------------------------------------\n if self.rtype == NoneType:\n rtype = 'void'\n else:\n rtype = self.rtype.cxxtype\n \n # -----------------------------------------------\n # Insert code body if available\n # -----------------------------------------------\n source = inspect.getsource(self.function)\n if not source: source = ''\n comments = inspect.getcomments(self.function)\n if comments: source = comments+source\n code = string.join(map(lambda x: '/////// '+x,string.split(source,'\\n')),\n '\\n')+'\\n'\n\n # -----------------------------------------------\n # Add in the headers\n # -----------------------------------------------\n code += '#include \"Python.h\"\\n'\n for T in self.used:\n if T is None: continue\n for pre in T.prerequisites:\n code += pre\n code += '\\n'\n\n # -----------------------------------------------\n # Real body\n # -----------------------------------------------\n code += '\\n'\n code += '\\nstatic %s %s('%(rtype,self.name)\n for i in range(len(self.signature)):\n if i != 0: code += ', '\n n = self.stack[i]\n t = self.types[i]\n code += '%s %s'%(t.cxxtype,n)\n code += ') {\\n'\n code += ' PyObject* tempPY= 0;\\n'\n\n\n # Add in non-argument temporaries\n # Assuming first argcount locals are positional args\n for i in range(self.codeobject.co_argcount,\n self.codeobject.co_nlocals):\n t = self.types[i]\n code += '%s %s;\\n'%(\n t.cxxtype,\n self.codeobject.co_varnames[i],\n )\n\n # Add in the body\n code += self.__body\n code += '}\\n\\n'\n return code\n\n\n ##################################################################\n # MEMBER WRAPPED_CODE #\n ##################################################################\n def wrapped_code(self):\n code = self.generate()\n \n # -----------------------------------------------\n # Wrapper\n # -----------------------------------------------\n code += 'static PyObject* wrapper_%s(PyObject*,PyObject* args) {\\n'%self.name\n code += ' // Length check\\n'\n code += ' if ( PyTuple_Size(args) != %d ) {\\n'%len(self.signature)\n code += ' PyErr_SetString(PyExc_TypeError,\"Expected %d arguments\");\\n'%len(self.signature)\n code += ' return 0;\\n'\n code += ' }\\n'\n\n code += '\\n // Load Py versions of args\\n'\n for i in range(len(self.signature)):\n T = self.signature[i]\n code += ' PyObject* py_%s = PyTuple_GET_ITEM(args,%d);\\n'%(\n self.codeobject.co_varnames[i],i\n )\n\n code += ' if ( !(%s) ) {\\n'% \\\n T.check('py_'+self.codeobject.co_varnames[i])\n #code += ' PyObject_Print(py_A,stdout,0); puts(\"\");\\n'\n #code += ' printf(\"nd=%d typecode=%d\\\\n\",((PyArrayObject*)py_A)->nd,((PyArrayObject*)py_A)->descr->type_num);\\n'\n code += ' PyErr_SetString(PyExc_TypeError,\"Bad type for arg %d (expected %s)\");\\n'%(\n i+1,\n T.__class__.__name__)\n code += ' return 0;\\n'\n code += ' }\\n'\n \n code += '\\n // Do conversions\\n'\n argnames = []\n for i in range(len(self.signature)):\n T = self.signature[i]\n\n code += ' %s %s=%s;\\n'%(\n T.cxxtype,\n self.codeobject.co_varnames[i],\n T.inbound('py_'+self.codeobject.co_varnames[i]),\n )\n code += ' if ( PyErr_Occurred() ) return 0;\\n'\n argnames.append(self.codeobject.co_varnames[i])\n\n code += '\\n // Compute result\\n'\n if self.rtype != NoneType:\n code += ' %s _result = '%(\n self.rtype.cxxtype,\n )\n else:\n code += ' '\n code += '%s(%s);\\n'%(\n self.name,\n string.join(argnames,','),\n )\n\n\n code += '\\n // Pack return\\n'\n if ( self.rtype == NoneType ):\n code += ' Py_INCREF(Py_None);\\n'\n code += ' return Py_None;\\n'\n else:\n result,owned = self.rtype.outbound('_result')\n if not owned:\n code += ' Py_INCREF(_result);\\n'\n code += ' return %s;\\n'%result\n code += '}\\n'\n return code\n\n def indent(self):\n self.__indent += 1\n return\n\n def dedent(self):\n self.__indent -= 1\n return\n\n ##################################################################\n # MEMBER EMIT #\n ##################################################################\n def emit(self,s):\n self.__body += ' '*(3*self.__indent)\n self.__body += s\n self.__body += '\\n'\n return\n\n ##################################################################\n # MEMBER PUSH #\n ##################################################################\n def push(self,v,t):\n self.stack.append(v)\n self.types.append(t)\n return\n\n ##################################################################\n # MEMBER POP #\n ##################################################################\n def pop(self):\n v = self.stack[-1]\n assert type(v) != TupleType\n del self.stack[-1]\n t = self.types[-1]\n assert type(t) != TupleType\n del self.types[-1]\n return v,t\n\n ##################################################################\n # MEMBER PUSHTUPLE #\n ##################################################################\n def pushTuple(self,V,T):\n assert type(V) == TupleType\n self.stack.append(V)\n assert type(V) == TupleType\n self.types.append(T)\n return\n\n\n ##################################################################\n # MEMBER POPTUPLE #\n ##################################################################\n def popTuple(self):\n v = self.stack[-1]\n assert type(v) == TupleType\n del self.stack[-1]\n t = self.types[-1]\n assert type(t) == TupleType\n del self.types[-1]\n return v,t\n ##################################################################\n # MEMBER MULTIARG #\n ##################################################################\n def multiarg(self):\n return type(self.stack[-1]) == TupleType\n \n ##################################################################\n # MEMBER UNIQUE #\n ##################################################################\n def unique(self):\n self.__uid += 1\n return 't%d'%self.__uid\n\n ##################################################################\n # MEMBER POST #\n ##################################################################\n def post(self,pc,action):\n if not self.forwards.has_key(pc):\n self.forwards[pc] = []\n self.forwards[pc].append(action)\n return\n\n ##################################################################\n # MEMBER EMIT_VALUE #\n ##################################################################\n def emit_value(self, v):\n descriptor = self.typedef_by_value(v)\n \n # Convert representation to CXX rhs\n rhs = descriptor.literalizer(v)\n lhs = self.unique()\n self.emit('%s %s = %s;'%(\n descriptor.cxxtype,\n lhs,\n rhs))\n self.push(lhs,descriptor)\n return \n\n ##################################################################\n # MEMBER GLOBAL_INFO #\n ##################################################################\n def global_info(self,var_num):\n # This is the name value is known by\n var_name = self.codeobject.co_names[var_num]\n\n # First, figure out who owns this global\n import sys\n myHash = id(self.function.func_globals)\n for module_name in sys.modules.keys():\n module = sys.modules[module_name]\n if module and id(module.__dict__) == myHash:\n break\n else:\n raise ValueError,'Cannot locate module owning %s'%varname\n return module_name,var_name\n\n\n ##################################################################\n # MEMBER CODEUP #\n ##################################################################\n def codeup(self, rhs, rhs_type):\n lhs = self.unique()\n self.emit('%s %s = %s;\\n'%(\n rhs_type.cxxtype,\n lhs,\n rhs))\n print self.__body\n self.push(lhs,rhs_type)\n return \n \n\n ##################################################################\n # MEMBER BINOP #\n ##################################################################\n def binop(self,pc,symbol):\n v2,t2 = self.pop()\n v1,t1 = self.pop()\n\n if t1 == t2:\n rhs,rhs_type = t1.binop(symbol,v1,v2)\n else:\n rhs,rhs_type = t1.binopMixed(symbol,v1,v2,t2)\n\n self.codeup(rhs,rhs_type)\n return\n\n ##################################################################\n # MEMBER BINARY_XXX #\n ##################################################################\n def BINARY_ADD(self,pc):\n return self.binop(pc,'+')\n def BINARY_SUBTRACT(self,pc):\n return self.binop(pc,'-')\n def BINARY_MULTIPLY(self,pc):\n print 'MULTIPLY',self.stack[-2],self.types[-2],'*',self.stack[-1],self.types[-1]\n return self.binop(pc,'*')\n def BINARY_DIVIDE(self,pc):\n return self.binop(pc,'/')\n def BINARY_MODULO(self,pc):\n return self.binop(pc,'%')\n def BINARY_SUBSCR(self,pc):\n if self.multiarg():\n v2,t2 = self.popTuple()\n else:\n v2,t2 = self.pop()\n v2 = (v2,)\n t2 = (t2,)\n v1,t1 = self.pop()\n rhs,rhs_type = t1.getitem(v1,v2,t2)\n self.codeup(rhs,rhs_type)\n return\n\n def STORE_SUBSCR(self,pc):\n if self.multiarg():\n v2,t2 = self.popTuple()\n else:\n v2,t2 = self.pop()\n v2 = (v2,)\n t2 = (t2,)\n v1,t1 = self.pop()\n v0,t0 = self.pop()\n \n rhs,rhs_type = t1.setitem(v1,v2,t2)\n assert rhs_type == t0,\"Store the right thing\"\n self.emit('%s = %s;'%(rhs,v0))\n return\n\n def COMPARE_OP(self,pc,opname):\n symbol = self.cmp_op(opname) # convert numeric to name\n return self.binop(pc,symbol)\n\n\n ##################################################################\n # MEMBER PRINT_ITEM #\n ##################################################################\n def PRINT_ITEM(self,pc):\n # Printing correctly is tricky... best to let Python\n # do the real work here\n w = self.unique()\n self.emit('PyObject* %s = PySys_GetObject(\"stdout\");'%w)\n self.emit('if (PyFile_SoftSpace(%s,1)) PyFile_WriteString(\" \",%s);'%(w,w))\n v,t = self.pop()\n\n py = self.unique()\n code,owned = t.outbound(v)\n self.emit('PyObject* %s = %s;'%(py, code))\n self.emit('PyFile_WriteObject(%s,%s,Py_PRINT_RAW);'%(\n py,w))\n if owned:\n self.emit('Py_XDECREF(%s);'%py)\n return\n\n\n ##################################################################\n # MEMBER PRINT_NEWLINE #\n ##################################################################\n def PRINT_NEWLINE(self,pc):\n # Printing correctly is tricky... best to let Python\n # do the real work here\n w = self.unique()\n self.emit('PyObject* %s = PySys_GetObject(\"stdout\");'%w)\n self.emit('PyFile_WriteString(\"\\\\n\",%s);'%w);\n self.emit('PyFile_SoftSpace(%s,0);'%w);\n return\n \n ##################################################################\n # MEMBER SET_LINENO #\n ##################################################################\n def SET_LINENO(self,pc,lineno):\n self.emit('// %s:%d'%(self.codeobject.co_filename,lineno))\n return\n\n ##################################################################\n # MEMBER POP_TOP #\n ##################################################################\n def POP_TOP(self,pc):\n v,t = self.pop()\n return\n\n ##################################################################\n # MEMBER LOAD_CONST #\n ##################################################################\n def LOAD_CONST(self,pc,consti):\n # Fetch the constant\n k = self.consts[consti]\n t = type(k)\n print 'LOAD_CONST',repr(k),t\n\n # Fetch a None is just skipped\n if t == NoneType:\n self.push('',t) \n return\n\n self.emit_value(k)\n return\n\n\n ##################################################################\n # MEMBER BUILD_TUPLE #\n ##################################################################\n def BUILD_TUPLE(self,pc,count):\n \"Creates a tuple consuming count items from the stack, and pushes the resulting tuple onto the stack.\"\n V = []\n T = []\n for i in range(count):\n v,t = self.pop()\n V.append(v)\n T.append(t)\n V.reverse()\n T.reverse()\n self.pushTuple(tuple(V),tuple(T))\n return\n\n ##################################################################\n # MEMBER LOAD_FAST #\n ##################################################################\n def LOAD_FAST(self,pc,var_num):\n v = self.stack[var_num]\n t = self.types[var_num]\n print 'LOADFAST',var_num,v,t\n for VV,TT in map(None, self.stack, self.types):\n print VV,':',TT\n if t is None:\n raise TypeError,'%s used before set?'%v\n print self.__body\n print 'PC',pc\n self.push(v,t)\n return\n\n\n ##################################################################\n # MEMBER LOAD_ATTR #\n ##################################################################\n def LOAD_ATTR(self,pc,namei):\n v,t = self.pop()\n attr_name = self.codeobject.co_names[namei]\n print 'LOAD_ATTR',namei,v,t,attr_name\n aType,aCode = t.get_attribute(attr_name)\n print 'ATTR',aType\n print aCode\n lhs = self.unique()\n rhs = v\n lhsType = aType.cxxtype\n self.emit(aCode%locals())\n self.push(lhs,aType)\n return\n\n\n ##################################################################\n # MEMBER STORE_ATTR #\n ##################################################################\n def STORE_ATTR(self,pc,namei):\n v,t = self.pop()\n attr_name = self.codeobject.co_names[namei]\n print 'STORE_ATTR',namei,v,t,attr_name\n v2,t2 = self.pop()\n print 'SA value',v2,t2\n aType,aCode = t.set_attribute(attr_name)\n print 'ATTR',aType\n print aCode\n assert t2 is aType\n rhs = v2\n lhs = v\n self.emit(aCode%locals())\n return\n\n ##################################################################\n # MEMBER LOAD_GLOBAL #\n ##################################################################\n def LOAD_GLOBAL(self,pc,var_num):\n # Figure out the name and load it\n try:\n F = self.function.func_globals[self.codeobject.co_names[var_num]]\n except:\n F = __builtins__[self.codeobject.co_names[var_num]]\n\n # For functions, we see if we know about this function\n if callable(F):\n self.push(F,type(F))\n return\n\n # We need the name of the module that matches\n # the global state for the function and\n # the name of the variable\n module_name,var_name = self.global_info(var_num)\n\n # We hope it's type is correct\n t = type(F)\n descriptor = typedefs[t]\n native = self.unique()\n py = self.unique()\n mod = self.unique()\n\n self.emit('')\n self.emit('PyObject* %s = PyImport_ImportModule(\"%s\");'%(\n mod,module_name))\n self.emit('PyObject* %s = PyObject_GetAttrString(%s,\"%s\");'%(\n py,mod,var_name))\n self.emit('%s %s = %s;'%(\n descriptor.cxxtype,\n native,\n descriptor.inbound%py))\n\n self.push(native,t)\n return\n\n def SETUP_LOOP(self,pc,delta):\n \"Pushes a block for a loop onto the block stack. The block spans from the current instruction with a size of delta bytes.\"\n return\n\n def FOR_LOOP(self,pc,delta):\n \"Iterate over a sequence. TOS is the current index, TOS1 the sequence. First, the next element is computed. If the sequence is exhausted, increment byte code counter by delta. Otherwise, push the sequence, the incremented counter, and the current item onto the stack.\"\n # Pull off control variable and range info\n v2,t2 = self.pop()\n v1,t1 = self.pop()\n self.emit('for(%s=%s.low; %s<%s.high; %s += %s.step) {'%(\n v2,v1,v2,v1,v2,v1))\n\n # Put range back on for assignment\n self.push(v2,t2)\n return\n\n def JUMP_ABSOLUTE(self,pc,target):\n \"Set byte code counter to target.\"\n self.emit('}')\n return\n\n def POP_BLOCK(self,pc):\n \"Removes one block from the block stack. Per frame, there is a stack of blocks, denoting nested loops, try statements, and such.\"\n return\n\n\n ##################################################################\n # MEMBER STORE_FAST #\n ##################################################################\n def STORE_FAST(self,pc,var_num):\n\n v,t = self.pop()\n print 'STORE FAST',var_num,v,t\n\n save = self.stack[var_num]\n saveT = self.types[var_num]\n\n # See if type is same....\n # Note that None means no assignment made yet\n if saveT is None or t == saveT:\n if t.refcount:\n self.emit('Py_XINCREF(%s);'%v)\n self.emit('Py_XDECREF(%s);'%save)\n self.emit('%s = %s;\\n'%(save,v))\n self.types[var_num] = t\n return\n\n raise TypeError,(t,saveT)\n\n ##################################################################\n # MEMBER STORE_GLOBAL #\n ##################################################################\n def STORE_GLOBAL(self,pc,var_num):\n\n # We need the name of the module that matches\n # the global state for the function and\n # the name of the variable\n module_name,var_name = self.global_info(var_num)\n\n # Convert the value to Python object\n v,t = self.pop()\n descriptor = typedefs[t]\n py = self.unique()\n code,owned = descriptor.outbound(v)\n self.emit('PyObject* %s = %s;'%(py,code))\n if not owned:\n self.emit('Py_INCREF(%s);'%py)\n mod = self.unique()\n self.emit('PyObject* %s = PyImport_ImportModule(\"%s\");'%(\n mod,module_name))\n self.emit('PyObject_SetAttrString(%s,\"%s\",%s);'%(\n mod,var_name,py))\n self.emit('Py_DECREF(%s);'%py)\n return\n\n ##################################################################\n # MEMBER CALL_FUNCTION #\n ##################################################################\n def CALL_FUNCTION(self,pc,argc):\n # Pull args off stack\n args = []\n types = []\n for i in range(argc):\n v,t = self.pop()\n args = [v]+args\n types = [t]+types\n \n # Pull function object off stack and get descriptor\n f,t = self.pop()\n signature = (f,tuple(types))\n descriptor = self.function_by_signature(signature)\n #self.prerequisites += descriptor['prerequisite']+'\\n'\n \n # Build a rhs\n rhs = descriptor.code%string.join(args,',')\n\n # Build a statement\n temp = self.unique()\n self.emit('%s %s = %s;\\n'%(\n descriptor.return_type.cxxtype,\n temp,\n rhs))\n\n self.push(temp,descriptor.return_type)\n return\n\n\n ##################################################################\n # MEMBER JUMP_IF_FALSE #\n ##################################################################\n def JUMP_IF_FALSE(self,pc,delta):\n v,t = self.pop()\n self.push(v,t)\n # We need to do some work when we get to the\n # else part (put the value that's gonna get\n # popped back on the stack, emit } else {,\n # ...)\n action = lambda v=v,t=t,self=self: (\n self.emit('} else {'),\n self.push(v,t),\n )\n self.post(pc+delta,action)\n if t != IntType: raise TypeError, 'Invalid comparison type %s'%t\n self.emit('if (%s) {\\n'%v)\n return\n \n\n ##################################################################\n # MEMBER JUMP_FORWARD #\n ##################################################################\n def JUMP_FORWARD(self,pc,delta):\n # We need to close the if after the delta\n action = lambda self=self: (\n self.emit('}'),\n )\n self.post(pc+delta,action)\n return\n \n ##################################################################\n # MEMBER RETURN_VALUE #\n ##################################################################\n def RETURN_VALUE(self,pc):\n v,t = self.pop()\n if hasattr(self,'rtype'):\n print v,t\n if t == NoneType: return # just the extra return\n raise ValueError,'multiple returns'\n self.rtype = t\n if t == NoneType:\n self.emit('return;')\n else:\n self.emit('return %s;'%v)\n print 'return with',v\n return\n\n", + "source_code_before": "#**************************************************************************#\n#* FILE ************** bytecodecompiler.py ************************#\n#************************************************************************ **#\n#* Author: Patrick Miller February 9 2002 *#\n#* Copyright (C) 2002 Patrick J. Miller *#\n#**************************************************************************#\n#* *#\n#**************************************************************************#\nfrom types import *\nimport string\nimport inspect\n\n##################################################################\n# CLASS __DESCRIPTOR #\n##################################################################\nclass __Descriptor:\n prerequisites = []\n refcount = 0\n def __repr__(self):\n return self.__module__+'.'+self.__class__.__name__\n\n##################################################################\n# CLASS TYPE_DESCRIPTOR #\n##################################################################\nclass Type_Descriptor(__Descriptor):\n module_init_code = ''\n\n##################################################################\n# CLASS FUNCTION_DESCRIPTOR #\n##################################################################\nclass Function_Descriptor(__Descriptor):\n def __init__(self,code,return_type,support=''):\n\tself.code\t= code\n\tself.return_type\t= return_type\n self.support = support\n\treturn\n\n \n \n\nhaveArgument = 90 # Opcodes greater-equal to this have argument\nbyName = {\n 'STOP_CODE': 0,\n 'POP_TOP': 1,\n 'ROT_TWO': 2,\n 'ROT_THREE': 3,\n 'DUP_TOP': 4,\n 'ROT_FOUR': 5,\n 'UNARY_POSITIVE': 10,\n 'UNARY_NEGATIVE': 11,\n 'UNARY_NOT': 12,\n 'UNARY_CONVERT': 13,\n 'UNARY_INVERT': 15,\n 'BINARY_POWER': 19,\n 'BINARY_MULTIPLY': 20,\n 'BINARY_DIVIDE': 21,\n 'BINARY_MODULO': 22,\n 'BINARY_ADD': 23,\n 'BINARY_SUBTRACT': 24,\n 'BINARY_SUBSCR': 25,\n 'BINARY_FLOOR_DIVIDE': 26,\n 'BINARY_TRUE_DIVIDE': 27,\n 'INPLACE_FLOOR_DIVIDE': 28,\n 'INPLACE_TRUE_DIVIDE': 29,\n 'SLICE': 30,\n 'STORE_SLICE': 40,\n 'DELETE_SLICE': 50,\n 'INPLACE_ADD': 55,\n 'INPLACE_SUBTRACT': 56,\n 'INPLACE_MULTIPLY': 57,\n 'INPLACE_DIVIDE': 58,\n 'INPLACE_MODULO': 59,\n 'STORE_SUBSCR': 60,\n 'DELETE_SUBSCR': 61,\n 'BINARY_LSHIFT': 62,\n 'BINARY_RSHIFT': 63,\n 'BINARY_AND': 64,\n 'BINARY_XOR': 65,\n 'BINARY_OR': 66,\n 'INPLACE_POWER': 67,\n 'GET_ITER': 68,\n 'PRINT_EXPR': 70,\n 'PRINT_ITEM': 71,\n 'PRINT_NEWLINE': 72,\n 'PRINT_ITEM_TO': 73,\n 'PRINT_NEWLINE_TO': 74,\n 'INPLACE_LSHIFT': 75,\n 'INPLACE_RSHIFT': 76,\n 'INPLACE_AND': 77,\n 'INPLACE_XOR': 78,\n 'INPLACE_OR': 79,\n 'BREAK_LOOP': 80,\n 'LOAD_LOCALS': 82,\n 'RETURN_VALUE': 83,\n 'IMPORT_STAR': 84,\n 'EXEC_STMT': 85,\n 'YIELD_VALUE': 86,\n 'POP_BLOCK': 87,\n 'END_FINALLY': 88,\n 'BUILD_CLASS': 89,\n 'STORE_NAME': 90,\n 'DELETE_NAME': 91,\n 'UNPACK_SEQUENCE': 92,\n 'FOR_ITER': 93,\n 'STORE_ATTR': 95,\n 'DELETE_ATTR': 96,\n 'STORE_GLOBAL': 97,\n 'DELETE_GLOBAL': 98,\n 'DUP_TOPX': 99,\n 'LOAD_CONST': 100,\n 'LOAD_NAME': 101,\n 'BUILD_TUPLE': 102,\n 'BUILD_LIST': 103,\n 'BUILD_MAP': 104,\n 'LOAD_ATTR': 105,\n 'COMPARE_OP': 106,\n 'IMPORT_NAME': 107,\n 'IMPORT_FROM': 108,\n 'JUMP_FORWARD': 110,\n 'JUMP_IF_FALSE': 111,\n 'JUMP_IF_TRUE': 112,\n 'JUMP_ABSOLUTE': 113,\n 'FOR_LOOP': 114,\n 'LOAD_GLOBAL': 116,\n 'CONTINUE_LOOP': 119,\n 'SETUP_LOOP': 120,\n 'SETUP_EXCEPT': 121,\n 'SETUP_FINALLY': 122,\n 'LOAD_FAST': 124,\n 'STORE_FAST': 125,\n 'DELETE_FAST': 126,\n 'SET_LINENO': 127,\n 'RAISE_VARARGS': 130,\n 'CALL_FUNCTION': 131,\n 'MAKE_FUNCTION': 132,\n 'BUILD_SLICE': 133,\n 'MAKE_CLOSURE': 134,\n 'LOAD_CLOSURE': 135,\n 'LOAD_DEREF': 136,\n 'STORE_DEREF': 137,\n 'CALL_FUNCTION_VAR': 140,\n 'CALL_FUNCTION_KW': 141,\n 'CALL_FUNCTION_VAR_KW': 142,\n }\n\n# -----------------------------------------------\n# Build one in the reverse sense\n# -----------------------------------------------\nbyOpcode = {}\nfor name,op in map(None, byName.keys(), byName.values()):\n byOpcode[op] = name\n del name\n del op\n \n\n##################################################################\n# FUNCTION OPCODIZE #\n##################################################################\ndef opcodize(s):\n \"Slightly more readable form\"\n length = len(s)\n i = 0\n answer = []\n while i < length:\n bytecode = ord(s[i])\n name = byOpcode[bytecode]\n if bytecode >= haveArgument:\n argument = 256*ord(s[i+2])+ord(s[i+1])\n i += 3\n else:\n argument = None\n i += 1\n answer.append((bytecode,argument,name))\n return answer\n\n\n\n##################################################################\n# FUNCTION LIST #\n##################################################################\ndef listing(f):\n \"Pretty print the internals of your function\"\n assert type(f) == FunctionType,\"Arg %r must be a function\"%f\n filename = f.func_code.co_filename\n try:\n lines = open(filename).readlines()\n except:\n lines = None\n pc = 0\n s = ''\n lastLine = None\n for op,arg,name in opcodize(f.func_code.co_code):\n if lines and name == 'SET_LINENO':\n source = lines[arg-1][:-1]\n while lastLine and lastLine < arg-1:\n nonEmittingSource = lines[lastLine][:-1]\n lastLine += 1\n s += '%3s %20s %5s : %s\\n'%(\n '','','',nonEmittingSource)\n lastLine = arg\n else:\n source = ''\n if arg is None: arg = ''\n s += '%3d] %20s %5s : %s\\n'%(pc,name,arg,source)\n if op >= haveArgument:\n pc += 3\n else:\n pc += 1\n return s\n\n##################################################################\n# CLASS BYTECODEMEANING #\n##################################################################\nclass ByteCodeMeaning:\n def fetch(self, pc,code):\n opcode = ord(code[pc])\n if opcode >= haveArgument:\n argument = 256*ord(code[pc+2])+ord(code[pc+1])\n next = pc+3\n else:\n argument = None\n next = pc+1\n return next,opcode,argument\n \n def execute(self,pc,opcode,argument):\n name = byOpcode[opcode]\n method = getattr(self,name)\n if argument is None:\n return apply(method,(pc,))\n else:\n return apply(method,(pc,argument,))\n\n def evaluate(self, pc,code):\n next, opcode,argument = self.fetch(pc,code)\n goto = self.execute(next,opcode,argument)\n if goto == -1:\n return None # Must be done\n elif goto is None:\n return next # Normal\n else:\n raise 'xx'\n\n symbols = { 0: 'less', 1: 'lesseq', 2: 'equal', 3: 'notequal',\n 4: 'greater', 5: 'greatereq', 6: 'in', 7: 'not in',\n 8: 'is', 9: 'is not', 10: 'exe match',\n 11 : 'bad',\n }\n def cmp_op(self,opname):\n return self.symbols[opname]\n \n def STOP_CODE(self,pc):\n \"Indicates end-of-code to the compiler, not used by the interpreter.\"\n raise NotImplementedError\n def POP_TOP(self,pc):\n \"Removes the top-of-stack (TOS) item.\"\n raise NotImplementedError\n\n def ROT_TWO(self,pc):\n \"Swaps the two top-most stack items.\"\n raise NotImplementedError\n\n def ROT_THREE(self,pc):\n \"Lifts second and third stack item one position up, moves top down to position three.\"\n raise NotImplementedError\n\n def ROT_FOUR(self,pc):\n \"Lifts second, third and forth stack item one position up, moves top down to position four.\"\n raise NotImplementedError\n\n def DUP_TOP(self,pc):\n \"Duplicates the reference on top of the stack.\"\n raise NotImplementedError\n\n # Unary Operations take the top of the stack, apply the operation, and push the result back on the stack.\n\n def UNARY_POSITIVE(self,pc):\n \"Implements TOS = +TOS.\"\n raise NotImplementedError\n\n def UNARY_NEGATIVE(self,pc):\n \"Implements TOS = -TOS.\"\n raise NotImplementedError\n\n def UNARY_NOT(self,pc):\n \"Implements TOS = not TOS.\"\n raise NotImplementedError\n\n def UNARY_CONVERT(self,pc):\n \"Implements TOS = `TOS`.\"\n raise NotImplementedError\n\n def UNARY_INVERT(self,pc):\n \"Implements TOS = ~TOS.\"\n raise NotImplementedError\n\n #Binary operations remove the top of the stack (TOS) and the second top-most stack item (TOS1) from the stack. They perform the operation, and put the result back on the stack.\n\n def BINARY_POWER(self,pc):\n \"Implements TOS = TOS1 ** TOS.\"\n raise NotImplementedError\n\n def BINARY_MULTIPLY(self,pc):\n \"Implements TOS = TOS1 * TOS.\"\n raise NotImplementedError\n\n def BINARY_DIVIDE(self,pc):\n \"Implements TOS = TOS1 / TOS.\"\n raise NotImplementedError\n\n def BINARY_MODULO(self,pc):\n \"Implements TOS = TOS1 % TOS.\"\n raise NotImplementedError\n\n def BINARY_ADD(self,pc):\n \"Implements TOS = TOS1 + TOS.\"\n raise NotImplementedError\n\n def BINARY_SUBTRACT(self,pc):\n \"Implements TOS = TOS1 - TOS.\"\n raise NotImplementedError\n\n def BINARY_SUBSCR(self,pc):\n \"Implements TOS = TOS1[TOS].\"\n raise NotImplementedError\n\n def BINARY_LSHIFT(self,pc):\n \"Implements TOS = TOS1 << TOS.\"\n raise NotImplementedError\n\n def BINARY_RSHIFT(self,pc):\n \"Implements TOS = TOS1 >> TOS.\"\n raise NotImplementedError\n\n def BINARY_AND(self,pc):\n \"Implements TOS = TOS1 & TOS.\"\n raise NotImplementedError\n\n def BINARY_XOR(self,pc):\n \"Implements TOS = TOS1 ^ TOS.\"\n raise NotImplementedError\n\n def BINARY_OR(self,pc):\n \"Implements TOS = TOS1 | TOS.\"\n raise NotImplementedError\n\n #In-place operations are like binary operations, in that they remove TOS and TOS1, and push the result back on the stack, but the operation is done in-place when TOS1 supports it, and the resulting TOS may be (but does not have to be) the original TOS1.\n\n def INPLACE_POWER(self,pc):\n \"Implements in-place TOS = TOS1 ** TOS.\"\n raise NotImplementedError\n\n def INPLACE_MULTIPLY(self,pc):\n \"Implements in-place TOS = TOS1 * TOS.\"\n raise NotImplementedError\n\n def INPLACE_DIVIDE(self,pc):\n \"Implements in-place TOS = TOS1 / TOS.\"\n raise NotImplementedError\n\n def INPLACE_MODULO(self,pc):\n \"Implements in-place TOS = TOS1 % TOS.\"\n raise NotImplementedError\n\n def INPLACE_ADD(self,pc):\n \"Implements in-place TOS = TOS1 + TOS.\"\n raise NotImplementedError\n\n def INPLACE_SUBTRACT(self,pc):\n \"Implements in-place TOS = TOS1 - TOS.\"\n raise NotImplementedError\n\n def INPLACE_LSHIFT(self,pc):\n \"Implements in-place TOS = TOS1 << TOS.\"\n raise NotImplementedError\n\n def INPLACE_RSHIFT(self,pc):\n \"Implements in-place TOS = TOS1 >> TOS.\"\n raise NotImplementedError\n\n def INPLACE_AND(self,pc):\n \"Implements in-place TOS = TOS1 & TOS.\"\n raise NotImplementedError\n\n def INPLACE_XOR(self,pc):\n \"Implements in-place TOS = TOS1 ^ TOS.\"\n raise NotImplementedError\n\n def INPLACE_OR(self,pc):\n \"Implements in-place TOS = TOS1 | TOS.\"\n raise NotImplementedError\n\n #The slice opcodes take up to three parameters.\n\n def SLICE_0(self,pc):\n \"Implements TOS = TOS[:].\"\n raise NotImplementedError\n\n def SLICE_1(self,pc):\n \"Implements TOS = TOS1[TOS:].\"\n raise NotImplementedError\n\n def SLICE_2(self,pc):\n \"Implements TOS = TOS1[:TOS1].\"\n raise NotImplementedError\n\n def SLICE_3(self,pc):\n \"Implements TOS = TOS2[TOS1:TOS].\"\n raise NotImplementedError\n\n #Slice assignment needs even an additional parameter. As any statement, they put nothing on the stack.\n\n def STORE_SLICE_0(self,pc):\n \"Implements TOS[:] = TOS1.\"\n raise NotImplementedError\n\n def STORE_SLICE_1(self,pc):\n \"Implements TOS1[TOS:] = TOS2.\"\n raise NotImplementedError\n\n def STORE_SLICE_2(self,pc):\n \"Implements TOS1[:TOS] = TOS2.\"\n raise NotImplementedError\n\n def STORE_SLICE_3(self,pc):\n \"Implements TOS2[TOS1:TOS] = TOS3.\"\n raise NotImplementedError\n\n def DELETE_SLICE_0(self,pc):\n \"Implements del TOS[:].\"\n raise NotImplementedError\n\n def DELETE_SLICE_1(self,pc):\n \"Implements del TOS1[TOS:].\"\n raise NotImplementedError\n\n def DELETE_SLICE_2(self,pc):\n \"Implements del TOS1[:TOS].\"\n raise NotImplementedError\n\n def DELETE_SLICE_3(self,pc):\n \"Implements del TOS2[TOS1:TOS].\"\n raise NotImplementedError\n\n def STORE_SUBSCR(self,pc):\n \"Implements TOS1[TOS] = TOS2.\"\n raise NotImplementedError\n\n def DELETE_SUBSCR(self,pc):\n \"Implements del TOS1[TOS].\"\n raise NotImplementedError\n\n def PRINT_EXPR(self,pc):\n \"Implements the expression statement for the interactive mode. TOS is removed from the stack and printed. In non-interactive mode, an expression statement is terminated with POP_STACK.\"\n raise NotImplementedError\n\n def PRINT_ITEM(self,pc):\n \"Prints TOS to the file-like object bound to sys.stdout. There is one such instruction for each item in the print statement.\"\n raise NotImplementedError\n\n def PRINT_ITEM_TO(self,pc):\n \"Like PRINT_ITEM, but prints the item second from TOS to the file-like object at TOS. This is used by the extended print statement.\"\n raise NotImplementedError\n\n def PRINT_NEWLINE(self,pc):\n \"Prints a new line on sys.stdout. This is generated as the last operation of a print statement, unless the statement ends with a comma.\"\n raise NotImplementedError\n\n def PRINT_NEWLINE_TO(self,pc):\n \"Like PRINT_NEWLINE, but prints the new line on the file-like object on the TOS. This is used by the extended print statement.\"\n raise NotImplementedError\n\n def BREAK_LOOP(self,pc):\n \"Terminates a loop due to a break statement.\"\n raise NotImplementedError\n\n def LOAD_LOCALS(self,pc):\n \"Pushes a reference to the locals of the current scope on the stack. This is used in the code for a class definition: After the class body is evaluated, the locals are passed to the class definition.\"\n raise NotImplementedError\n\n def RETURN_VALUE(self,pc):\n \"Returns with TOS to the caller of the function.\"\n raise NotImplementedError\n\n def IMPORT_STAR(self,pc):\n \"Loads all symbols not starting with _ directly from the module TOS to the local namespace. The module is popped after loading all names. This opcode implements from module import *.\"\n raise NotImplementedError\n\n def EXEC_STMT(self,pc):\n \"Implements exec TOS2,TOS1,TOS. The compiler fills missing optional parameters with None.\"\n raise NotImplementedError\n\n def POP_BLOCK(self,pc):\n \"Removes one block from the block stack. Per frame, there is a stack of blocks, denoting nested loops, try statements, and such.\"\n raise NotImplementedError\n\n def END_FINALLY(self,pc):\n \"Terminates a finally clause. The interpreter recalls whether the exception has to be re-raised, or whether the function returns, and continues with the outer-next block.\"\n raise NotImplementedError\n\n def BUILD_CLASS(self,pc):\n \"Creates a new class object. TOS is the methods dictionary, TOS1 the tuple of the names of the base classes, and TOS2 the class name.\"\n raise NotImplementedError\n\n #All of the following opcodes expect arguments. An argument is two bytes, with the more significant byte last.\n\n def STORE_NAME(self,pc,namei):\n \"Implements name = TOS. namei is the index of name in the attribute co_names of the code object. The compiler tries to use STORE_LOCAL or STORE_GLOBAL if possible.\"\n raise NotImplementedError\n\n def DELETE_NAME(self,pc,namei):\n \"Implements del name, where namei is the index into co_names attribute of the code object.\"\n raise NotImplementedError\n\n def UNPACK_SEQUENCE(self,pc,count):\n \"Unpacks TOS into count individual values, which are put onto the stack right-to-left.\"\n raise NotImplementedError\n\n def DUP_TOPX(self,pc,count):\n \"Duplicate count items, keeping them in the same order. Due to implementation limits, count should be between 1 and 5 inclusive.\"\n raise NotImplementedError\n\n def STORE_ATTR(self,pc,namei):\n \"Implements TOS.name = TOS1, where namei is the index of name in co_names.\"\n raise NotImplementedError\n\n def DELETE_ATTR(self,pc,namei):\n \"Implements del TOS.name, using namei as index into co_names.\"\n raise NotImplementedError\n\n def STORE_GLOBAL(self,pc,namei):\n \"Works as STORE_NAME, but stores the name as a global.\"\n raise NotImplementedError\n\n def DELETE_GLOBAL(self,pc,namei):\n \"Works as DELETE_NAME, but deletes a global name.\"\n raise NotImplementedError\n\n def LOAD_CONST(self,pc,consti):\n \"Pushes co_consts[consti] onto the stack.\"\n raise NotImplementedError\n\n def LOAD_NAME(self,pc,namei):\n \"Pushes the value associated with co_names[namei] onto the stack.\"\n raise NotImplementedError\n\n def BUILD_TUPLE(self,pc,count):\n \"Creates a tuple consuming count items from the stack, and pushes the resulting tuple onto the stack.\"\n raise NotImplementedError\n\n def BUILD_LIST(self,pc,count):\n \"Works as BUILD_TUPLE, but creates a list.\"\n raise NotImplementedError\n\n def BUILD_MAP(self,pc,zero):\n \"Pushes a new empty dictionary object onto the stack. The argument is ignored and set to zero by the compiler.\"\n raise NotImplementedError\n\n def LOAD_ATTR(self,pc,namei):\n \"Replaces TOS with getattr(TOS, co_names[namei].\"\n raise NotImplementedError\n\n def COMPARE_OP(self,pc,opname):\n \"Performs a Boolean operation. The operation name can be found in cmp_op[opname].\"\n raise NotImplementedError\n\n def IMPORT_NAME(self,pc,namei):\n \"Imports the module co_names[namei]. The module object is pushed onto the stack. The current namespace is not affected: for a proper import statement, a subsequent STORE_FAST instruction modifies the namespace.\"\n raise NotImplementedError\n\n def IMPORT_FROM(self,pc,namei):\n \"Loads the attribute co_names[namei] from the module found in TOS. The resulting object is pushed onto the stack, to be subsequently stored by a STORE_FAST instruction.\"\n raise NotImplementedError\n\n def JUMP_FORWARD(self,pc,delta):\n \"Increments byte code counter by delta.\"\n raise NotImplementedError\n\n def JUMP_IF_TRUE(self,pc,delta):\n \"If TOS is true, increment the byte code counter by delta. TOS is left on the stack.\"\n raise NotImplementedError\n\n def JUMP_IF_FALSE(self,pc,delta):\n \"If TOS is false, increment the byte code counter by delta. TOS is not changed.\"\n raise NotImplementedError\n\n def JUMP_ABSOLUTE(self,pc,target):\n \"Set byte code counter to target.\"\n raise NotImplementedError\n\n def FOR_LOOP(self,pc,delta):\n \"Iterate over a sequence. TOS is the current index, TOS1 the sequence. First, the next element is computed. If the sequence is exhausted, increment byte code counter by delta. Otherwise, push the sequence, the incremented counter, and the current item onto the stack.\"\n raise NotImplementedError\n\n def LOAD_GLOBAL(self,pc,namei):\n \"Loads the global named co_names[namei] onto the stack.\"\n raise NotImplementedError\n\n def SETUP_LOOP(self,pc,delta):\n \"Pushes a block for a loop onto the block stack. The block spans from the current instruction with a size of delta bytes.\"\n raise NotImplementedError\n\n def SETUP_EXCEPT(self,pc,delta):\n \"Pushes a try block from a try-except clause onto the block stack. delta points to the first except block.\"\n raise NotImplementedError\n\n def SETUP_FINALLY(self,pc,delta):\n \"Pushes a try block from a try-except clause onto the block stack. delta points to the finally block.\"\n raise NotImplementedError\n\n def LOAD_FAST(self,pc,var_num):\n \"Pushes a reference to the local co_varnames[var_num] onto the stack.\"\n raise NotImplementedError\n\n def STORE_FAST(self,pc,var_num):\n \"Stores TOS into the local co_varnames[var_num].\"\n raise NotImplementedError\n\n def DELETE_FAST(self,pc,var_num):\n \"Deletes local co_varnames[var_num].\"\n raise NotImplementedError\n\n def LOAD_CLOSURE(self,pc,i):\n \"Pushes a reference to the cell contained in slot i of the cell and free variable storage. The name of the variable is co_cellvars[i] if i is less than the length of co_cellvars. Otherwise it is co_freevars[i - len(co_cellvars)].\"\n raise NotImplementedError\n\n def LOAD_DEREF(self,pc,i):\n \"Loads the cell contained in slot i of the cell and free variable storage. Pushes a reference to the object the cell contains on the stack.\"\n raise NotImplementedError\n\n def STORE_DEREF(self,pc,i):\n \"Stores TOS into the cell contained in slot i of the cell and free variable storage.\"\n raise NotImplementedError\n\n def SET_LINENO(self,pc,lineno):\n \"Sets the current line number to lineno.\"\n raise NotImplementedError\n\n def RAISE_VARARGS(self,pc,argc):\n \"Raises an exception. argc indicates the number of parameters to the raise statement, ranging from 0 to 3. The handler will find the traceback as TOS2, the parameter as TOS1, and the exception as TOS.\"\n raise NotImplementedError\n\n def CALL_FUNCTION(self,pc,argc):\n \"Calls a function. The low byte of argc indicates the number of positional parameters, the high byte the number of keyword parameters. On the stack, the opcode finds the keyword parameters first. For each keyword argument, the value is on top of the key. Below the keyword parameters, the positional parameters are on the stack, with the right-most parameter on top. Below the parameters, the function object to call is on the stack.\"\n raise NotImplementedError\n\n def MAKE_FUNCTION(self,pc,argc):\n \"Pushes a new function object on the stack. TOS is the code associated with the function. The function object is defined to have argc default parameters, which are found below TOS.\"\n raise NotImplementedError\n\n def MAKE_CLOSURE(self,pc,argc):\n \"Creates a new function object, sets its func_closure slot, and pushes it on the stack. TOS is the code associated with the function. If the code object has N free variables, the next N items on the stack are the cells for these variables. The function also has argc default parameters, where are found before the cells.\"\n raise NotImplementedError\n\n def BUILD_SLICE(self,pc,argc):\n \"Pushes a slice object on the stack. argc must be 2 or 3. If it is 2, slice(TOS1, TOS) is pushed; if it is 3, slice(TOS2, TOS1, TOS) is pushed. See the slice() built-in function for more information.\"\n raise NotImplementedError\n\n def EXTENDED_ARG(self,pc,ext):\n \"Prefixes any opcode which has an argument too big to fit into the default two bytes. ext holds two additional bytes which, taken together with the subsequent opcode's argument, comprise a four-byte argument, ext being the two most-significant bytes.\"\n raise NotImplementedError\n\n def CALL_FUNCTION_VAR(self,pc,argc):\n \"Calls a function. argc is interpreted as in CALL_FUNCTION. The top element on the stack contains the variable argument list, followed by keyword and positional arguments.\"\n raise NotImplementedError\n\n def CALL_FUNCTION_KW(self,pc,argc):\n \"Calls a function. argc is interpreted as in CALL_FUNCTION. The top element on the stack contains the keyword arguments dictionary, followed by explicit keyword and positional arguments.\"\n raise NotImplementedError\n\n def CALL_FUNCTION_VAR_KW(self,pc,argc):\n \"Calls a function. argc is interpreted as in CALL_FUNCTION. The top element on the stack contains the keyword arguments dictionary, followed by the variable-arguments tuple, followed by explicit keyword and positional arguments.\"\n raise NotImplementedError\n\n \n\n##################################################################\n# CLASS CXXCODER #\n##################################################################\nclass CXXCoder(ByteCodeMeaning):\n\n ##################################################################\n # MEMBER TYPEDEF_BY_VALUE #\n ##################################################################\n def typedef_by_value(self,v):\n raise NotImplementedError # VIRTUAL\n \n ##################################################################\n # MEMBER __INIT__ #\n ##################################################################\n def __init__(self,function,signature,name=None):\n assert type(function) == FunctionType,\"Arg must be a user function\"\n assert not function.func_defaults ,\"Function cannot have default args (yet)\"\n if name is None: name = function.func_name\n self.name = name\n self.function = function\n self.signature = signature\n self.codeobject = function.func_code\n self.__uid = 0 # Builds temps\n self.__indent = 1\n return\n\n ##################################################################\n # MEMBER EVALUATE #\n ##################################################################\n def evaluate(self, pc,code):\n # See if we posted any forwards for this offset\n if self.forwards.has_key(pc):\n for f in self.forwards[pc]:\n f()\n self.forwards[pc] = []\n return ByteCodeMeaning.evaluate(self,pc,code)\n \n ##################################################################\n # MEMBER GENERATE #\n ##################################################################\n def generate(self):\n self.forwards = {} # Actions on forward interprets\n self.__body = '' # Body will be built\n self.helpers = [] # headers and stuff\n\n # -----------------------------------------------\n # OK, crack open the function object and build\n # initial stack (not a real frame!)\n # -----------------------------------------------\n arglen = self.codeobject.co_argcount\n nlocals = self.codeobject.co_nlocals\n\n self.consts = self.codeobject.co_consts\n self.stack = list(self.codeobject.co_varnames)\n self.types = list(self.signature)+[None]*(nlocals-arglen)\n self.used = []\n for T in self.types:\n if T not in self.used: self.used.append(T)\n\n # -----------------------------------------------\n # One pass through the byte codes to generate\n # the body\n # -----------------------------------------------\n code = self.codeobject.co_code\n bytes = len(code)\n pc = 0\n while pc != None and pc < bytes:\n pc = self.evaluate(pc,code)\n\n # -----------------------------------------------\n # Return?\n # -----------------------------------------------\n if self.rtype == NoneType:\n rtype = 'void'\n else:\n rtype = self.rtype.cxxtype\n \n # -----------------------------------------------\n # Insert code body if available\n # -----------------------------------------------\n source = inspect.getsource(self.function)\n if not source: source = ''\n comments = inspect.getcomments(self.function)\n if comments: source = comments+source\n code = string.join(map(lambda x: '/////// '+x,string.split(source,'\\n')),\n '\\n')+'\\n'\n\n # -----------------------------------------------\n # Add in the headers\n # -----------------------------------------------\n code += '#include \"Python.h\"\\n'\n for T in self.used:\n if T is None: continue\n for pre in T.prerequisites:\n code += pre\n code += '\\n'\n\n # -----------------------------------------------\n # Real body\n # -----------------------------------------------\n code += '\\n'\n code += '\\nstatic %s %s('%(rtype,self.name)\n for i in range(len(self.signature)):\n if i != 0: code += ', '\n n = self.stack[i]\n t = self.types[i]\n code += '%s %s'%(t.cxxtype,n)\n code += ') {\\n'\n\n # Add in non-argument temporaries\n # Assuming first argcount locals are positional args\n for i in range(self.codeobject.co_argcount,\n self.codeobject.co_nlocals):\n t = self.types[i]\n code += '%s %s;\\n'%(\n t.cxxtype,\n self.codeobject.co_varnames[i],\n )\n\n # Add in the body\n code += self.__body\n code += '}\\n\\n'\n return code\n\n\n ##################################################################\n # MEMBER WRAPPED_CODE #\n ##################################################################\n def wrapped_code(self):\n code = self.generate()\n \n # -----------------------------------------------\n # Wrapper\n # -----------------------------------------------\n code += 'static PyObject* wrapper_%s(PyObject*,PyObject* args) {\\n'%self.name\n\n code += ' // Length check\\n'\n code += ' if ( PyTuple_Size(args) != %d ) {\\n'%len(self.signature)\n code += ' PyErr_SetString(PyExc_TypeError,\"Expected %d arguments\");\\n'%len(self.signature)\n code += ' return 0;\\n'\n code += ' }\\n'\n\n code += '\\n // Load Py versions of args\\n'\n for i in range(len(self.signature)):\n T = self.signature[i]\n code += ' PyObject* py_%s = PyTuple_GET_ITEM(args,%d);\\n'%(\n self.codeobject.co_varnames[i],i\n )\n\n code += ' if ( !(%s) ) {\\n'% \\\n T.check('py_'+self.codeobject.co_varnames[i])\n #code += ' PyObject_Print(py_A,stdout,0); puts(\"\");\\n'\n #code += ' printf(\"nd=%d typecode=%d\\\\n\",((PyArrayObject*)py_A)->nd,((PyArrayObject*)py_A)->descr->type_num);\\n'\n code += ' PyErr_SetString(PyExc_TypeError,\"Bad type for arg %d (expected %s)\");\\n'%(\n i+1,\n T.__class__.__name__)\n code += ' return 0;\\n'\n code += ' }\\n'\n \n code += '\\n // Do conversions\\n'\n argnames = []\n for i in range(len(self.signature)):\n T = self.signature[i]\n\n code += ' %s %s=%s;\\n'%(\n T.cxxtype,\n self.codeobject.co_varnames[i],\n T.inbound('py_'+self.codeobject.co_varnames[i]),\n )\n code += ' if ( PyErr_Occurred() ) return 0;\\n'\n argnames.append(self.codeobject.co_varnames[i])\n\n code += '\\n // Compute result\\n'\n if self.rtype != NoneType:\n code += ' %s _result = '%(\n self.rtype.cxxtype,\n )\n else:\n code += ' '\n code += '%s(%s);\\n'%(\n self.name,\n string.join(argnames,','),\n )\n\n\n code += '\\n // Pack return\\n'\n if ( self.rtype == NoneType ):\n code += ' Py_INCREF(Py_None);\\n'\n code += ' return Py_None;\\n'\n else:\n result = self.rtype.outbound('_result')\n code += ' return %s;\\n'%result\n code += '}\\n'\n return code\n\n def indent(self):\n self.__indent += 1\n return\n\n def dedent(self):\n self.__indent -= 1\n return\n\n ##################################################################\n # MEMBER EMIT #\n ##################################################################\n def emit(self,s):\n self.__body += ' '*(3*self.__indent)\n self.__body += s\n self.__body += '\\n'\n return\n\n ##################################################################\n # MEMBER PUSH #\n ##################################################################\n def push(self,v,t):\n self.stack.append(v)\n self.types.append(t)\n return\n\n ##################################################################\n # MEMBER POP #\n ##################################################################\n def pop(self):\n v = self.stack[-1]\n assert type(v) != TupleType\n del self.stack[-1]\n t = self.types[-1]\n assert type(t) != TupleType\n del self.types[-1]\n return v,t\n\n ##################################################################\n # MEMBER PUSHTUPLE #\n ##################################################################\n def pushTuple(self,V,T):\n assert type(V) == TupleType\n self.stack.append(V)\n assert type(V) == TupleType\n self.types.append(T)\n return\n\n\n ##################################################################\n # MEMBER POPTUPLE #\n ##################################################################\n def popTuple(self):\n v = self.stack[-1]\n assert type(v) == TupleType\n del self.stack[-1]\n t = self.types[-1]\n assert type(t) == TupleType\n del self.types[-1]\n return v,t\n ##################################################################\n # MEMBER MULTIARG #\n ##################################################################\n def multiarg(self):\n return type(self.stack[-1]) == TupleType\n \n ##################################################################\n # MEMBER UNIQUE #\n ##################################################################\n def unique(self):\n self.__uid += 1\n return 't%d'%self.__uid\n\n ##################################################################\n # MEMBER POST #\n ##################################################################\n def post(self,pc,action):\n if not self.forwards.has_key(pc):\n self.forwards[pc] = []\n self.forwards[pc].append(action)\n return\n\n ##################################################################\n # MEMBER EMIT_VALUE #\n ##################################################################\n def emit_value(self, v):\n descriptor = self.typedef_by_value(v)\n \n # Convert representation to CXX rhs\n rhs = descriptor.literalizer(v)\n lhs = self.unique()\n self.emit('%s %s = %s;'%(\n descriptor.cxxtype,\n lhs,\n rhs))\n self.push(lhs,descriptor)\n return \n\n ##################################################################\n # MEMBER GLOBAL_INFO #\n ##################################################################\n def global_info(self,var_num):\n # This is the name value is known by\n var_name = self.codeobject.co_names[var_num]\n\n # First, figure out who owns this global\n import sys\n myHash = id(self.function.func_globals)\n for module_name in sys.modules.keys():\n module = sys.modules[module_name]\n if module and id(module.__dict__) == myHash:\n break\n else:\n raise ValueError,'Cannot locate module owning %s'%varname\n return module_name,var_name\n\n\n ##################################################################\n # MEMBER CODEUP #\n ##################################################################\n def codeup(self, rhs, rhs_type):\n lhs = self.unique()\n self.emit('%s %s = %s;\\n'%(\n rhs_type.cxxtype,\n lhs,\n rhs))\n print self.__body\n self.push(lhs,rhs_type)\n return \n \n\n ##################################################################\n # MEMBER BINOP #\n ##################################################################\n def binop(self,pc,symbol):\n v2,t2 = self.pop()\n v1,t1 = self.pop()\n\n if t1 == t2:\n rhs,rhs_type = t1.binop(symbol,v1,v2)\n else:\n rhs,rhs_type = t1.binopMixed(symbol,v1,v2,t2)\n\n self.codeup(rhs,rhs_type)\n return\n\n ##################################################################\n # MEMBER BINARY_XXX #\n ##################################################################\n def BINARY_ADD(self,pc):\n return self.binop(pc,'+')\n def BINARY_SUBTRACT(self,pc):\n return self.binop(pc,'-')\n def BINARY_MULTIPLY(self,pc):\n print 'MULTIPLY',self.stack[-2],self.types[-2],'*',self.stack[-1],self.types[-1]\n return self.binop(pc,'*')\n def BINARY_DIVIDE(self,pc):\n return self.binop(pc,'/')\n def BINARY_MODULO(self,pc):\n return self.binop(pc,'%')\n def BINARY_SUBSCR(self,pc):\n if self.multiarg():\n v2,t2 = self.popTuple()\n else:\n v2,t2 = self.pop()\n v2 = (v2,)\n t2 = (t2,)\n v1,t1 = self.pop()\n rhs,rhs_type = t1.getitem(v1,v2,t2)\n self.codeup(rhs,rhs_type)\n return\n\n def STORE_SUBSCR(self,pc):\n if self.multiarg():\n v2,t2 = self.popTuple()\n else:\n v2,t2 = self.pop()\n v2 = (v2,)\n t2 = (t2,)\n v1,t1 = self.pop()\n v0,t0 = self.pop()\n \n rhs,rhs_type = t1.setitem(v1,v2,t2)\n assert rhs_type == t0,\"Store the right thing\"\n self.emit('%s = %s;'%(rhs,v0))\n return\n\n def COMPARE_OP(self,pc,opname):\n symbol = self.cmp_op(opname) # convert numeric to name\n return self.binop(pc,symbol)\n\n\n ##################################################################\n # MEMBER PRINT_ITEM #\n ##################################################################\n def PRINT_ITEM(self,pc):\n # Printing correctly is tricky... best to let Python\n # do the real work here\n w = self.unique()\n self.emit('PyObject* %s = PySys_GetObject(\"stdout\");'%w)\n self.emit('if (PyFile_SoftSpace(%s,1)) PyFile_WriteString(\" \",%s);'%(w,w))\n v,t = self.pop()\n\n py = self.unique()\n self.emit('PyObject* %s = %s;'%(py, t.outbound(v)))\n self.emit('PyFile_WriteObject(%s,%s,Py_PRINT_RAW);'%(\n py,w))\n self.emit('Py_XDECREF(%s);'%py)\n return\n\n\n ##################################################################\n # MEMBER PRINT_NEWLINE #\n ##################################################################\n def PRINT_NEWLINE(self,pc):\n # Printing correctly is tricky... best to let Python\n # do the real work here\n w = self.unique()\n self.emit('PyObject* %s = PySys_GetObject(\"stdout\");'%w)\n self.emit('PyFile_WriteString(\"\\\\n\",%s);'%w);\n self.emit('PyFile_SoftSpace(%s,0);'%w);\n return\n \n ##################################################################\n # MEMBER SET_LINENO #\n ##################################################################\n def SET_LINENO(self,pc,lineno):\n self.emit('// %s:%d'%(self.codeobject.co_filename,lineno))\n return\n\n ##################################################################\n # MEMBER POP_TOP #\n ##################################################################\n def POP_TOP(self,pc):\n v,t = self.pop()\n return\n\n ##################################################################\n # MEMBER LOAD_CONST #\n ##################################################################\n def LOAD_CONST(self,pc,consti):\n # Fetch the constant\n k = self.consts[consti]\n t = type(k)\n print 'LOAD_CONST',repr(k),t\n\n # Fetch a None is just skipped\n if t == NoneType:\n self.push('',t) \n return\n\n self.emit_value(k)\n return\n\n\n ##################################################################\n # MEMBER BUILD_TUPLE #\n ##################################################################\n def BUILD_TUPLE(self,pc,count):\n \"Creates a tuple consuming count items from the stack, and pushes the resulting tuple onto the stack.\"\n V = []\n T = []\n for i in range(count):\n v,t = self.pop()\n V.append(v)\n T.append(t)\n V.reverse()\n T.reverse()\n self.pushTuple(tuple(V),tuple(T))\n return\n\n ##################################################################\n # MEMBER LOAD_FAST #\n ##################################################################\n def LOAD_FAST(self,pc,var_num):\n v = self.stack[var_num]\n t = self.types[var_num]\n print 'LOADFAST',var_num,v,t\n for VV,TT in map(None, self.stack, self.types):\n print VV,':',TT\n if t is None:\n raise TypeError,'%s used before set?'%v\n print self.__body\n print 'PC',pc\n self.push(v,t)\n return\n\n ##################################################################\n # MEMBER LOAD_GLOBAL #\n ##################################################################\n def LOAD_GLOBAL(self,pc,var_num):\n # Figure out the name and load it\n try:\n F = self.function.func_globals[self.codeobject.co_names[var_num]]\n except:\n F = __builtins__[self.codeobject.co_names[var_num]]\n\n # For functions, we see if we know about this function\n if callable(F):\n self.push(F,type(F))\n return\n\n # We need the name of the module that matches\n # the global state for the function and\n # the name of the variable\n module_name,var_name = self.global_info(var_num)\n\n # We hope it's type is correct\n t = type(F)\n descriptor = typedefs[t]\n native = self.unique()\n py = self.unique()\n mod = self.unique()\n\n self.emit('')\n self.emit('PyObject* %s = PyImport_ImportModule(\"%s\");'%(\n mod,module_name))\n self.emit('PyObject* %s = PyObject_GetAttrString(%s,\"%s\");'%(\n py,mod,var_name))\n self.emit('%s %s = %s;'%(\n descriptor.cxxtype,\n native,\n descriptor.inbound%py))\n\n self.push(native,t)\n return\n\n def SETUP_LOOP(self,pc,delta):\n \"Pushes a block for a loop onto the block stack. The block spans from the current instruction with a size of delta bytes.\"\n return\n\n def FOR_LOOP(self,pc,delta):\n \"Iterate over a sequence. TOS is the current index, TOS1 the sequence. First, the next element is computed. If the sequence is exhausted, increment byte code counter by delta. Otherwise, push the sequence, the incremented counter, and the current item onto the stack.\"\n # Pull off control variable and range info\n v2,t2 = self.pop()\n v1,t1 = self.pop()\n self.emit('for(%s=%s.low; %s<%s.high; %s += %s.step) {'%(\n v2,v1,v2,v1,v2,v1))\n\n # Put range back on for assignment\n self.push(v2,t2)\n return\n\n def JUMP_ABSOLUTE(self,pc,target):\n \"Set byte code counter to target.\"\n self.emit('}')\n return\n\n def POP_BLOCK(self,pc):\n \"Removes one block from the block stack. Per frame, there is a stack of blocks, denoting nested loops, try statements, and such.\"\n return\n\n\n ##################################################################\n # MEMBER STORE_FAST #\n ##################################################################\n def STORE_FAST(self,pc,var_num):\n\n v,t = self.pop()\n print 'STORE FAST',var_num,v,t\n\n save = self.stack[var_num]\n saveT = self.types[var_num]\n\n # See if type is same....\n # Note that None means no assignment made yet\n if saveT is None or t == saveT:\n if t.refcount:\n self.emit('Py_XINCREF(%s);'%v)\n self.emit('Py_XDECREF(%s);'%save)\n self.emit('%s = %s;\\n'%(save,v))\n self.types[var_num] = t\n return\n\n raise TypeError,(t,saveT)\n\n ##################################################################\n # MEMBER STORE_GLOBAL #\n ##################################################################\n def STORE_GLOBAL(self,pc,var_num):\n\n # We need the name of the module that matches\n # the global state for the function and\n # the name of the variable\n module_name,var_name = self.global_info(var_num)\n\n # Convert the value to Python object\n v,t = self.pop()\n descriptor = typedefs[t]\n py = self.unique()\n self.emit('PyObject* %s = %s;'%(\n py,\n descriptor.outbound%v))\n mod = self.unique()\n self.emit('PyObject* %s = PyImport_ImportModule(\"%s\");'%(\n mod,module_name))\n self.emit('PyObject_SetAttrString(%s,\"%s\",%s);'%(\n mod,var_name,py))\n self.emit('Py_DECREF(%s);'%py)\n return\n\n ##################################################################\n # MEMBER CALL_FUNCTION #\n ##################################################################\n def CALL_FUNCTION(self,pc,argc):\n # Pull args off stack\n args = []\n types = []\n for i in range(argc):\n v,t = self.pop()\n args = [v]+args\n types = [t]+types\n \n # Pull function object off stack and get descriptor\n f,t = self.pop()\n signature = (f,tuple(types))\n descriptor = self.function_by_signature(signature)\n #self.prerequisites += descriptor['prerequisite']+'\\n'\n \n # Build a rhs\n rhs = descriptor.code%string.join(args,',')\n\n # Build a statement\n temp = self.unique()\n self.emit('%s %s = %s;\\n'%(\n descriptor.return_type.cxxtype,\n temp,\n rhs))\n\n self.push(temp,descriptor.return_type)\n return\n\n\n ##################################################################\n # MEMBER JUMP_IF_FALSE #\n ##################################################################\n def JUMP_IF_FALSE(self,pc,delta):\n v,t = self.pop()\n self.push(v,t)\n # We need to do some work when we get to the\n # else part (put the value that's gonna get\n # popped back on the stack, emit } else {,\n # ...)\n action = lambda v=v,t=t,self=self: (\n self.emit('} else {'),\n self.push(v,t),\n )\n self.post(pc+delta,action)\n if t != IntType: raise TypeError, 'Invalid comparison type %s'%t\n self.emit('if (%s) {\\n'%v)\n return\n \n\n ##################################################################\n # MEMBER JUMP_FORWARD #\n ##################################################################\n def JUMP_FORWARD(self,pc,delta):\n # We need to close the if after the delta\n action = lambda self=self: (\n self.emit('}'),\n )\n self.post(pc+delta,action)\n return\n \n ##################################################################\n # MEMBER RETURN_VALUE #\n ##################################################################\n def RETURN_VALUE(self,pc):\n v,t = self.pop()\n if hasattr(self,'rtype'):\n print v,t\n if t == NoneType: return # just the extra return\n raise ValueError,'multiple returns'\n self.rtype = t\n if t == NoneType:\n self.emit('return;')\n else:\n self.emit('return %s;'%v)\n print 'return with',v\n return\n\n", + "methods": [ + { + "name": "__repr__", + "long_name": "__repr__( self )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 19, + "end_line": 20, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , code , return_type , support = '' )", + "filename": "bytecodecompiler.py", + "nloc": 5, + "complexity": 1, + "token_count": 29, + "parameters": [ + "self", + "code", + "return_type", + "support" + ], + "start_line": 32, + "end_line": 36, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "opcodize", + "long_name": "opcodize( s )", + "filename": "bytecodecompiler.py", + "nloc": 16, + "complexity": 3, + "token_count": 92, + "parameters": [ + "s" + ], + "start_line": 159, + "end_line": 174, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "listing", + "long_name": "listing( f )", + "filename": "bytecodecompiler.py", + "nloc": 29, + "complexity": 9, + "token_count": 166, + "parameters": [ + "f" + ], + "start_line": 181, + "end_line": 209, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 0 + }, + { + "name": "fetch", + "long_name": "fetch( self , pc , code )", + "filename": "bytecodecompiler.py", + "nloc": 9, + "complexity": 2, + "token_count": 67, + "parameters": [ + "self", + "pc", + "code" + ], + "start_line": 215, + "end_line": 223, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "execute", + "long_name": "execute( self , pc , opcode , argument )", + "filename": "bytecodecompiler.py", + "nloc": 7, + "complexity": 2, + "token_count": 54, + "parameters": [ + "self", + "pc", + "opcode", + "argument" + ], + "start_line": 225, + "end_line": 231, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "evaluate", + "long_name": "evaluate( self , pc , code )", + "filename": "bytecodecompiler.py", + "nloc": 9, + "complexity": 3, + "token_count": 54, + "parameters": [ + "self", + "pc", + "code" + ], + "start_line": 233, + "end_line": 241, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "cmp_op", + "long_name": "cmp_op( self , opname )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 14, + "parameters": [ + "self", + "opname" + ], + "start_line": 248, + "end_line": 249, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "STOP_CODE", + "long_name": "STOP_CODE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 251, + "end_line": 253, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "POP_TOP", + "long_name": "POP_TOP( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 254, + "end_line": 256, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "ROT_TWO", + "long_name": "ROT_TWO( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 258, + "end_line": 260, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "ROT_THREE", + "long_name": "ROT_THREE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 262, + "end_line": 264, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "ROT_FOUR", + "long_name": "ROT_FOUR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 266, + "end_line": 268, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DUP_TOP", + "long_name": "DUP_TOP( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 270, + "end_line": 272, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "UNARY_POSITIVE", + "long_name": "UNARY_POSITIVE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 276, + "end_line": 278, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "UNARY_NEGATIVE", + "long_name": "UNARY_NEGATIVE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 280, + "end_line": 282, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "UNARY_NOT", + "long_name": "UNARY_NOT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 284, + "end_line": 286, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "UNARY_CONVERT", + "long_name": "UNARY_CONVERT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 288, + "end_line": 290, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "UNARY_INVERT", + "long_name": "UNARY_INVERT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 292, + "end_line": 294, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_POWER", + "long_name": "BINARY_POWER( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 298, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_MULTIPLY", + "long_name": "BINARY_MULTIPLY( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 302, + "end_line": 304, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_DIVIDE", + "long_name": "BINARY_DIVIDE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 306, + "end_line": 308, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_MODULO", + "long_name": "BINARY_MODULO( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 310, + "end_line": 312, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_ADD", + "long_name": "BINARY_ADD( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 314, + "end_line": 316, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_SUBTRACT", + "long_name": "BINARY_SUBTRACT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 318, + "end_line": 320, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_SUBSCR", + "long_name": "BINARY_SUBSCR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 322, + "end_line": 324, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_LSHIFT", + "long_name": "BINARY_LSHIFT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 326, + "end_line": 328, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_RSHIFT", + "long_name": "BINARY_RSHIFT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 330, + "end_line": 332, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_AND", + "long_name": "BINARY_AND( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 334, + "end_line": 336, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_XOR", + "long_name": "BINARY_XOR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 338, + "end_line": 340, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_OR", + "long_name": "BINARY_OR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 342, + "end_line": 344, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_POWER", + "long_name": "INPLACE_POWER( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 348, + "end_line": 350, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_MULTIPLY", + "long_name": "INPLACE_MULTIPLY( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 352, + "end_line": 354, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_DIVIDE", + "long_name": "INPLACE_DIVIDE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 356, + "end_line": 358, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_MODULO", + "long_name": "INPLACE_MODULO( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 360, + "end_line": 362, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_ADD", + "long_name": "INPLACE_ADD( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 364, + "end_line": 366, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_SUBTRACT", + "long_name": "INPLACE_SUBTRACT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 368, + "end_line": 370, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_LSHIFT", + "long_name": "INPLACE_LSHIFT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 372, + "end_line": 374, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_RSHIFT", + "long_name": "INPLACE_RSHIFT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 376, + "end_line": 378, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_AND", + "long_name": "INPLACE_AND( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 380, + "end_line": 382, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_XOR", + "long_name": "INPLACE_XOR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 384, + "end_line": 386, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_OR", + "long_name": "INPLACE_OR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 388, + "end_line": 390, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SLICE_0", + "long_name": "SLICE_0( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 394, + "end_line": 396, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SLICE_1", + "long_name": "SLICE_1( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 398, + "end_line": 400, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SLICE_2", + "long_name": "SLICE_2( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 402, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SLICE_3", + "long_name": "SLICE_3( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 406, + "end_line": 408, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_SLICE_0", + "long_name": "STORE_SLICE_0( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 412, + "end_line": 414, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_SLICE_1", + "long_name": "STORE_SLICE_1( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 416, + "end_line": 418, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_SLICE_2", + "long_name": "STORE_SLICE_2( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 420, + "end_line": 422, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_SLICE_3", + "long_name": "STORE_SLICE_3( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 424, + "end_line": 426, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_SLICE_0", + "long_name": "DELETE_SLICE_0( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 428, + "end_line": 430, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_SLICE_1", + "long_name": "DELETE_SLICE_1( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 432, + "end_line": 434, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_SLICE_2", + "long_name": "DELETE_SLICE_2( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 436, + "end_line": 438, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_SLICE_3", + "long_name": "DELETE_SLICE_3( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 440, + "end_line": 442, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_SUBSCR", + "long_name": "STORE_SUBSCR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 444, + "end_line": 446, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_SUBSCR", + "long_name": "DELETE_SUBSCR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 448, + "end_line": 450, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "PRINT_EXPR", + "long_name": "PRINT_EXPR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 452, + "end_line": 454, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "PRINT_ITEM", + "long_name": "PRINT_ITEM( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 456, + "end_line": 458, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "PRINT_ITEM_TO", + "long_name": "PRINT_ITEM_TO( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 460, + "end_line": 462, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "PRINT_NEWLINE", + "long_name": "PRINT_NEWLINE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 464, + "end_line": 466, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "PRINT_NEWLINE_TO", + "long_name": "PRINT_NEWLINE_TO( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 468, + "end_line": 470, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BREAK_LOOP", + "long_name": "BREAK_LOOP( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 472, + "end_line": 474, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_LOCALS", + "long_name": "LOAD_LOCALS( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 476, + "end_line": 478, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "RETURN_VALUE", + "long_name": "RETURN_VALUE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 480, + "end_line": 482, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "IMPORT_STAR", + "long_name": "IMPORT_STAR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 484, + "end_line": 486, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "EXEC_STMT", + "long_name": "EXEC_STMT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 488, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "POP_BLOCK", + "long_name": "POP_BLOCK( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 492, + "end_line": 494, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "END_FINALLY", + "long_name": "END_FINALLY( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 496, + "end_line": 498, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BUILD_CLASS", + "long_name": "BUILD_CLASS( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 500, + "end_line": 502, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_NAME", + "long_name": "STORE_NAME( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 506, + "end_line": 508, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_NAME", + "long_name": "DELETE_NAME( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 510, + "end_line": 512, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "UNPACK_SEQUENCE", + "long_name": "UNPACK_SEQUENCE( self , pc , count )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "count" + ], + "start_line": 514, + "end_line": 516, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DUP_TOPX", + "long_name": "DUP_TOPX( self , pc , count )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "count" + ], + "start_line": 518, + "end_line": 520, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_ATTR", + "long_name": "STORE_ATTR( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 522, + "end_line": 524, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_ATTR", + "long_name": "DELETE_ATTR( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 526, + "end_line": 528, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_GLOBAL", + "long_name": "STORE_GLOBAL( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 530, + "end_line": 532, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_GLOBAL", + "long_name": "DELETE_GLOBAL( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 534, + "end_line": 536, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_CONST", + "long_name": "LOAD_CONST( self , pc , consti )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "consti" + ], + "start_line": 538, + "end_line": 540, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_NAME", + "long_name": "LOAD_NAME( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 542, + "end_line": 544, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BUILD_TUPLE", + "long_name": "BUILD_TUPLE( self , pc , count )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "count" + ], + "start_line": 546, + "end_line": 548, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BUILD_LIST", + "long_name": "BUILD_LIST( self , pc , count )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "count" + ], + "start_line": 550, + "end_line": 552, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BUILD_MAP", + "long_name": "BUILD_MAP( self , pc , zero )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "zero" + ], + "start_line": 554, + "end_line": 556, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_ATTR", + "long_name": "LOAD_ATTR( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 558, + "end_line": 560, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "COMPARE_OP", + "long_name": "COMPARE_OP( self , pc , opname )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "opname" + ], + "start_line": 562, + "end_line": 564, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "IMPORT_NAME", + "long_name": "IMPORT_NAME( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 566, + "end_line": 568, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "IMPORT_FROM", + "long_name": "IMPORT_FROM( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 570, + "end_line": 572, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "JUMP_FORWARD", + "long_name": "JUMP_FORWARD( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 574, + "end_line": 576, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "JUMP_IF_TRUE", + "long_name": "JUMP_IF_TRUE( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 578, + "end_line": 580, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "JUMP_IF_FALSE", + "long_name": "JUMP_IF_FALSE( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 582, + "end_line": 584, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "JUMP_ABSOLUTE", + "long_name": "JUMP_ABSOLUTE( self , pc , target )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "target" + ], + "start_line": 586, + "end_line": 588, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "FOR_LOOP", + "long_name": "FOR_LOOP( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 590, + "end_line": 592, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_GLOBAL", + "long_name": "LOAD_GLOBAL( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 594, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SETUP_LOOP", + "long_name": "SETUP_LOOP( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 598, + "end_line": 600, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SETUP_EXCEPT", + "long_name": "SETUP_EXCEPT( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 602, + "end_line": 604, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SETUP_FINALLY", + "long_name": "SETUP_FINALLY( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 606, + "end_line": 608, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_FAST", + "long_name": "LOAD_FAST( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 610, + "end_line": 612, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_FAST", + "long_name": "STORE_FAST( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 614, + "end_line": 616, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_FAST", + "long_name": "DELETE_FAST( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 618, + "end_line": 620, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_CLOSURE", + "long_name": "LOAD_CLOSURE( self , pc , i )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "i" + ], + "start_line": 622, + "end_line": 624, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_DEREF", + "long_name": "LOAD_DEREF( self , pc , i )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "i" + ], + "start_line": 626, + "end_line": 628, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_DEREF", + "long_name": "STORE_DEREF( self , pc , i )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "i" + ], + "start_line": 630, + "end_line": 632, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SET_LINENO", + "long_name": "SET_LINENO( self , pc , lineno )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "lineno" + ], + "start_line": 634, + "end_line": 636, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "RAISE_VARARGS", + "long_name": "RAISE_VARARGS( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 638, + "end_line": 640, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "CALL_FUNCTION", + "long_name": "CALL_FUNCTION( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 642, + "end_line": 644, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "MAKE_FUNCTION", + "long_name": "MAKE_FUNCTION( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 646, + "end_line": 648, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "MAKE_CLOSURE", + "long_name": "MAKE_CLOSURE( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 650, + "end_line": 652, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BUILD_SLICE", + "long_name": "BUILD_SLICE( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 654, + "end_line": 656, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "EXTENDED_ARG", + "long_name": "EXTENDED_ARG( self , pc , ext )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "ext" + ], + "start_line": 658, + "end_line": 660, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "CALL_FUNCTION_VAR", + "long_name": "CALL_FUNCTION_VAR( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 662, + "end_line": 664, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "CALL_FUNCTION_KW", + "long_name": "CALL_FUNCTION_KW( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 666, + "end_line": 668, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "CALL_FUNCTION_VAR_KW", + "long_name": "CALL_FUNCTION_VAR_KW( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 670, + "end_line": 672, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "typedef_by_value", + "long_name": "typedef_by_value( self , v )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "v" + ], + "start_line": 684, + "end_line": 685, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , function , signature , name = None )", + "filename": "bytecodecompiler.py", + "nloc": 11, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "function", + "signature", + "name" + ], + "start_line": 690, + "end_line": 700, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "evaluate", + "long_name": "evaluate( self , pc , code )", + "filename": "bytecodecompiler.py", + "nloc": 6, + "complexity": 3, + "token_count": 52, + "parameters": [ + "self", + "pc", + "code" + ], + "start_line": 705, + "end_line": 711, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "generate", + "long_name": "generate( self )", + "filename": "bytecodecompiler.py", + "nloc": 52, + "complexity": 14, + "token_count": 376, + "parameters": [ + "self" + ], + "start_line": 716, + "end_line": 800, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 85, + "top_nesting_level": 1 + }, + { + "name": "wrapped_code", + "long_name": "wrapped_code( self )", + "filename": "bytecodecompiler.py", + "nloc": 54, + "complexity": 6, + "token_count": 303, + "parameters": [ + "self" + ], + "start_line": 806, + "end_line": 872, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 67, + "top_nesting_level": 1 + }, + { + "name": "indent", + "long_name": "indent( self )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 874, + "end_line": 876, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "dedent", + "long_name": "dedent( self )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 878, + "end_line": 880, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , s )", + "filename": "bytecodecompiler.py", + "nloc": 5, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "s" + ], + "start_line": 885, + "end_line": 889, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "push", + "long_name": "push( self , v , t )", + "filename": "bytecodecompiler.py", + "nloc": 4, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self", + "v", + "t" + ], + "start_line": 894, + "end_line": 897, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "pop", + "long_name": "pop( self )", + "filename": "bytecodecompiler.py", + "nloc": 8, + "complexity": 1, + "token_count": 57, + "parameters": [ + "self" + ], + "start_line": 902, + "end_line": 909, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "pushTuple", + "long_name": "pushTuple( self , V , T )", + "filename": "bytecodecompiler.py", + "nloc": 6, + "complexity": 1, + "token_count": 40, + "parameters": [ + "self", + "V", + "T" + ], + "start_line": 914, + "end_line": 919, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "popTuple", + "long_name": "popTuple( self )", + "filename": "bytecodecompiler.py", + "nloc": 8, + "complexity": 1, + "token_count": 57, + "parameters": [ + "self" + ], + "start_line": 925, + "end_line": 932, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "multiarg", + "long_name": "multiarg( self )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self" + ], + "start_line": 936, + "end_line": 937, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "unique", + "long_name": "unique( self )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 16, + "parameters": [ + "self" + ], + "start_line": 942, + "end_line": 944, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "post", + "long_name": "post( self , pc , action )", + "filename": "bytecodecompiler.py", + "nloc": 5, + "complexity": 2, + "token_count": 41, + "parameters": [ + "self", + "pc", + "action" + ], + "start_line": 949, + "end_line": 953, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "emit_value", + "long_name": "emit_value( self , v )", + "filename": "bytecodecompiler.py", + "nloc": 10, + "complexity": 1, + "token_count": 55, + "parameters": [ + "self", + "v" + ], + "start_line": 958, + "end_line": 969, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "global_info", + "long_name": "global_info( self , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 11, + "complexity": 4, + "token_count": 73, + "parameters": [ + "self", + "var_num" + ], + "start_line": 974, + "end_line": 987, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 1 + }, + { + "name": "codeup", + "long_name": "codeup( self , rhs , rhs_type )", + "filename": "bytecodecompiler.py", + "nloc": 9, + "complexity": 1, + "token_count": 45, + "parameters": [ + "self", + "rhs", + "rhs_type" + ], + "start_line": 993, + "end_line": 1001, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "binop", + "long_name": "binop( self , pc , symbol )", + "filename": "bytecodecompiler.py", + "nloc": 9, + "complexity": 2, + "token_count": 73, + "parameters": [ + "self", + "pc", + "symbol" + ], + "start_line": 1007, + "end_line": 1017, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "BINARY_ADD", + "long_name": "BINARY_ADD( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "self", + "pc" + ], + "start_line": 1022, + "end_line": 1023, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "BINARY_SUBTRACT", + "long_name": "BINARY_SUBTRACT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "self", + "pc" + ], + "start_line": 1024, + "end_line": 1025, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "BINARY_MULTIPLY", + "long_name": "BINARY_MULTIPLY( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self", + "pc" + ], + "start_line": 1026, + "end_line": 1028, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_DIVIDE", + "long_name": "BINARY_DIVIDE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "self", + "pc" + ], + "start_line": 1029, + "end_line": 1030, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "BINARY_MODULO", + "long_name": "BINARY_MODULO( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "self", + "pc" + ], + "start_line": 1031, + "end_line": 1032, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "BINARY_SUBSCR", + "long_name": "BINARY_SUBSCR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 11, + "complexity": 2, + "token_count": 78, + "parameters": [ + "self", + "pc" + ], + "start_line": 1033, + "end_line": 1043, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "STORE_SUBSCR", + "long_name": "STORE_SUBSCR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 13, + "complexity": 2, + "token_count": 97, + "parameters": [ + "self", + "pc" + ], + "start_line": 1045, + "end_line": 1058, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 1 + }, + { + "name": "COMPARE_OP", + "long_name": "COMPARE_OP( self , pc , opname )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self", + "pc", + "opname" + ], + "start_line": 1060, + "end_line": 1062, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "PRINT_ITEM", + "long_name": "PRINT_ITEM( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 13, + "complexity": 2, + "token_count": 96, + "parameters": [ + "self", + "pc" + ], + "start_line": 1068, + "end_line": 1083, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "PRINT_NEWLINE", + "long_name": "PRINT_NEWLINE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 6, + "complexity": 1, + "token_count": 41, + "parameters": [ + "self", + "pc" + ], + "start_line": 1089, + "end_line": 1096, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "SET_LINENO", + "long_name": "SET_LINENO( self , pc , lineno )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self", + "pc", + "lineno" + ], + "start_line": 1101, + "end_line": 1103, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "POP_TOP", + "long_name": "POP_TOP( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "pc" + ], + "start_line": 1108, + "end_line": 1110, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_CONST", + "long_name": "LOAD_CONST( self , pc , consti )", + "filename": "bytecodecompiler.py", + "nloc": 9, + "complexity": 2, + "token_count": 53, + "parameters": [ + "self", + "pc", + "consti" + ], + "start_line": 1115, + "end_line": 1127, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "BUILD_TUPLE", + "long_name": "BUILD_TUPLE( self , pc , count )", + "filename": "bytecodecompiler.py", + "nloc": 12, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "pc", + "count" + ], + "start_line": 1133, + "end_line": 1144, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "LOAD_FAST", + "long_name": "LOAD_FAST( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 12, + "complexity": 3, + "token_count": 85, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 1149, + "end_line": 1160, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "LOAD_ATTR", + "long_name": "LOAD_ATTR( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 13, + "complexity": 1, + "token_count": 88, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 1166, + "end_line": 1178, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "STORE_ATTR", + "long_name": "STORE_ATTR( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 14, + "complexity": 1, + "token_count": 90, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 1184, + "end_line": 1197, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 1 + }, + { + "name": "LOAD_GLOBAL", + "long_name": "LOAD_GLOBAL( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 25, + "complexity": 3, + "token_count": 165, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 1202, + "end_line": 1237, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 36, + "top_nesting_level": 1 + }, + { + "name": "SETUP_LOOP", + "long_name": "SETUP_LOOP( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 1239, + "end_line": 1241, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "FOR_LOOP", + "long_name": "FOR_LOOP( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 8, + "complexity": 1, + "token_count": 57, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 1243, + "end_line": 1253, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "JUMP_ABSOLUTE", + "long_name": "JUMP_ABSOLUTE( self , pc , target )", + "filename": "bytecodecompiler.py", + "nloc": 4, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "pc", + "target" + ], + "start_line": 1255, + "end_line": 1258, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "POP_BLOCK", + "long_name": "POP_BLOCK( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "pc" + ], + "start_line": 1260, + "end_line": 1262, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_FAST", + "long_name": "STORE_FAST( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 13, + "complexity": 4, + "token_count": 101, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 1268, + "end_line": 1286, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "STORE_GLOBAL", + "long_name": "STORE_GLOBAL( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 16, + "complexity": 2, + "token_count": 117, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 1291, + "end_line": 1312, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 1 + }, + { + "name": "CALL_FUNCTION", + "long_name": "CALL_FUNCTION( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 18, + "complexity": 2, + "token_count": 125, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 1317, + "end_line": 1343, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 27, + "top_nesting_level": 1 + }, + { + "name": "JUMP_IF_FALSE", + "long_name": "JUMP_IF_FALSE( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 11, + "complexity": 2, + "token_count": 89, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 1349, + "end_line": 1363, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "JUMP_FORWARD", + "long_name": "JUMP_FORWARD( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 6, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 1369, + "end_line": 1375, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "RETURN_VALUE", + "long_name": "RETURN_VALUE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 13, + "complexity": 4, + "token_count": 69, + "parameters": [ + "self", + "pc" + ], + "start_line": 1380, + "end_line": 1392, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + } + ], + "methods_before": [ + { + "name": "__repr__", + "long_name": "__repr__( self )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 19, + "end_line": 20, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , code , return_type , support = '' )", + "filename": "bytecodecompiler.py", + "nloc": 5, + "complexity": 1, + "token_count": 29, + "parameters": [ + "self", + "code", + "return_type", + "support" + ], + "start_line": 32, + "end_line": 36, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "opcodize", + "long_name": "opcodize( s )", + "filename": "bytecodecompiler.py", + "nloc": 16, + "complexity": 3, + "token_count": 92, + "parameters": [ + "s" + ], + "start_line": 159, + "end_line": 174, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "listing", + "long_name": "listing( f )", + "filename": "bytecodecompiler.py", + "nloc": 29, + "complexity": 9, + "token_count": 166, + "parameters": [ + "f" + ], + "start_line": 181, + "end_line": 209, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 0 + }, + { + "name": "fetch", + "long_name": "fetch( self , pc , code )", + "filename": "bytecodecompiler.py", + "nloc": 9, + "complexity": 2, + "token_count": 67, + "parameters": [ + "self", + "pc", + "code" + ], + "start_line": 215, + "end_line": 223, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "execute", + "long_name": "execute( self , pc , opcode , argument )", + "filename": "bytecodecompiler.py", + "nloc": 7, + "complexity": 2, + "token_count": 54, + "parameters": [ + "self", + "pc", + "opcode", + "argument" + ], + "start_line": 225, + "end_line": 231, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "evaluate", + "long_name": "evaluate( self , pc , code )", + "filename": "bytecodecompiler.py", + "nloc": 9, + "complexity": 3, + "token_count": 54, + "parameters": [ + "self", + "pc", + "code" + ], + "start_line": 233, + "end_line": 241, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "cmp_op", + "long_name": "cmp_op( self , opname )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 14, + "parameters": [ + "self", + "opname" + ], + "start_line": 248, + "end_line": 249, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "STOP_CODE", + "long_name": "STOP_CODE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 251, + "end_line": 253, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "POP_TOP", + "long_name": "POP_TOP( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 254, + "end_line": 256, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "ROT_TWO", + "long_name": "ROT_TWO( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 258, + "end_line": 260, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "ROT_THREE", + "long_name": "ROT_THREE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 262, + "end_line": 264, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "ROT_FOUR", + "long_name": "ROT_FOUR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 266, + "end_line": 268, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DUP_TOP", + "long_name": "DUP_TOP( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 270, + "end_line": 272, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "UNARY_POSITIVE", + "long_name": "UNARY_POSITIVE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 276, + "end_line": 278, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "UNARY_NEGATIVE", + "long_name": "UNARY_NEGATIVE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 280, + "end_line": 282, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "UNARY_NOT", + "long_name": "UNARY_NOT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 284, + "end_line": 286, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "UNARY_CONVERT", + "long_name": "UNARY_CONVERT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 288, + "end_line": 290, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "UNARY_INVERT", + "long_name": "UNARY_INVERT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 292, + "end_line": 294, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_POWER", + "long_name": "BINARY_POWER( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 298, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_MULTIPLY", + "long_name": "BINARY_MULTIPLY( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 302, + "end_line": 304, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_DIVIDE", + "long_name": "BINARY_DIVIDE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 306, + "end_line": 308, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_MODULO", + "long_name": "BINARY_MODULO( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 310, + "end_line": 312, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_ADD", + "long_name": "BINARY_ADD( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 314, + "end_line": 316, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_SUBTRACT", + "long_name": "BINARY_SUBTRACT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 318, + "end_line": 320, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_SUBSCR", + "long_name": "BINARY_SUBSCR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 322, + "end_line": 324, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_LSHIFT", + "long_name": "BINARY_LSHIFT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 326, + "end_line": 328, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_RSHIFT", + "long_name": "BINARY_RSHIFT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 330, + "end_line": 332, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_AND", + "long_name": "BINARY_AND( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 334, + "end_line": 336, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_XOR", + "long_name": "BINARY_XOR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 338, + "end_line": 340, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_OR", + "long_name": "BINARY_OR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 342, + "end_line": 344, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_POWER", + "long_name": "INPLACE_POWER( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 348, + "end_line": 350, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_MULTIPLY", + "long_name": "INPLACE_MULTIPLY( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 352, + "end_line": 354, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_DIVIDE", + "long_name": "INPLACE_DIVIDE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 356, + "end_line": 358, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_MODULO", + "long_name": "INPLACE_MODULO( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 360, + "end_line": 362, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_ADD", + "long_name": "INPLACE_ADD( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 364, + "end_line": 366, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_SUBTRACT", + "long_name": "INPLACE_SUBTRACT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 368, + "end_line": 370, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_LSHIFT", + "long_name": "INPLACE_LSHIFT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 372, + "end_line": 374, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_RSHIFT", + "long_name": "INPLACE_RSHIFT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 376, + "end_line": 378, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_AND", + "long_name": "INPLACE_AND( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 380, + "end_line": 382, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_XOR", + "long_name": "INPLACE_XOR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 384, + "end_line": 386, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "INPLACE_OR", + "long_name": "INPLACE_OR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 388, + "end_line": 390, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SLICE_0", + "long_name": "SLICE_0( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 394, + "end_line": 396, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SLICE_1", + "long_name": "SLICE_1( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 398, + "end_line": 400, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SLICE_2", + "long_name": "SLICE_2( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 402, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SLICE_3", + "long_name": "SLICE_3( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 406, + "end_line": 408, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_SLICE_0", + "long_name": "STORE_SLICE_0( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 412, + "end_line": 414, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_SLICE_1", + "long_name": "STORE_SLICE_1( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 416, + "end_line": 418, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_SLICE_2", + "long_name": "STORE_SLICE_2( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 420, + "end_line": 422, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_SLICE_3", + "long_name": "STORE_SLICE_3( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 424, + "end_line": 426, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_SLICE_0", + "long_name": "DELETE_SLICE_0( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 428, + "end_line": 430, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_SLICE_1", + "long_name": "DELETE_SLICE_1( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 432, + "end_line": 434, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_SLICE_2", + "long_name": "DELETE_SLICE_2( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 436, + "end_line": 438, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_SLICE_3", + "long_name": "DELETE_SLICE_3( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 440, + "end_line": 442, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_SUBSCR", + "long_name": "STORE_SUBSCR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 444, + "end_line": 446, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_SUBSCR", + "long_name": "DELETE_SUBSCR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 448, + "end_line": 450, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "PRINT_EXPR", + "long_name": "PRINT_EXPR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 452, + "end_line": 454, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "PRINT_ITEM", + "long_name": "PRINT_ITEM( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 456, + "end_line": 458, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "PRINT_ITEM_TO", + "long_name": "PRINT_ITEM_TO( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 460, + "end_line": 462, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "PRINT_NEWLINE", + "long_name": "PRINT_NEWLINE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 464, + "end_line": 466, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "PRINT_NEWLINE_TO", + "long_name": "PRINT_NEWLINE_TO( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 468, + "end_line": 470, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BREAK_LOOP", + "long_name": "BREAK_LOOP( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 472, + "end_line": 474, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_LOCALS", + "long_name": "LOAD_LOCALS( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 476, + "end_line": 478, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "RETURN_VALUE", + "long_name": "RETURN_VALUE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 480, + "end_line": 482, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "IMPORT_STAR", + "long_name": "IMPORT_STAR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 484, + "end_line": 486, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "EXEC_STMT", + "long_name": "EXEC_STMT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 488, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "POP_BLOCK", + "long_name": "POP_BLOCK( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 492, + "end_line": 494, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "END_FINALLY", + "long_name": "END_FINALLY( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 496, + "end_line": 498, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BUILD_CLASS", + "long_name": "BUILD_CLASS( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self", + "pc" + ], + "start_line": 500, + "end_line": 502, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_NAME", + "long_name": "STORE_NAME( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 506, + "end_line": 508, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_NAME", + "long_name": "DELETE_NAME( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 510, + "end_line": 512, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "UNPACK_SEQUENCE", + "long_name": "UNPACK_SEQUENCE( self , pc , count )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "count" + ], + "start_line": 514, + "end_line": 516, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DUP_TOPX", + "long_name": "DUP_TOPX( self , pc , count )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "count" + ], + "start_line": 518, + "end_line": 520, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_ATTR", + "long_name": "STORE_ATTR( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 522, + "end_line": 524, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_ATTR", + "long_name": "DELETE_ATTR( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 526, + "end_line": 528, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_GLOBAL", + "long_name": "STORE_GLOBAL( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 530, + "end_line": 532, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_GLOBAL", + "long_name": "DELETE_GLOBAL( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 534, + "end_line": 536, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_CONST", + "long_name": "LOAD_CONST( self , pc , consti )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "consti" + ], + "start_line": 538, + "end_line": 540, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_NAME", + "long_name": "LOAD_NAME( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 542, + "end_line": 544, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BUILD_TUPLE", + "long_name": "BUILD_TUPLE( self , pc , count )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "count" + ], + "start_line": 546, + "end_line": 548, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BUILD_LIST", + "long_name": "BUILD_LIST( self , pc , count )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "count" + ], + "start_line": 550, + "end_line": 552, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BUILD_MAP", + "long_name": "BUILD_MAP( self , pc , zero )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "zero" + ], + "start_line": 554, + "end_line": 556, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_ATTR", + "long_name": "LOAD_ATTR( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 558, + "end_line": 560, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "COMPARE_OP", + "long_name": "COMPARE_OP( self , pc , opname )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "opname" + ], + "start_line": 562, + "end_line": 564, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "IMPORT_NAME", + "long_name": "IMPORT_NAME( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 566, + "end_line": 568, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "IMPORT_FROM", + "long_name": "IMPORT_FROM( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 570, + "end_line": 572, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "JUMP_FORWARD", + "long_name": "JUMP_FORWARD( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 574, + "end_line": 576, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "JUMP_IF_TRUE", + "long_name": "JUMP_IF_TRUE( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 578, + "end_line": 580, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "JUMP_IF_FALSE", + "long_name": "JUMP_IF_FALSE( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 582, + "end_line": 584, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "JUMP_ABSOLUTE", + "long_name": "JUMP_ABSOLUTE( self , pc , target )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "target" + ], + "start_line": 586, + "end_line": 588, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "FOR_LOOP", + "long_name": "FOR_LOOP( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 590, + "end_line": 592, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_GLOBAL", + "long_name": "LOAD_GLOBAL( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 594, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SETUP_LOOP", + "long_name": "SETUP_LOOP( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 598, + "end_line": 600, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SETUP_EXCEPT", + "long_name": "SETUP_EXCEPT( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 602, + "end_line": 604, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SETUP_FINALLY", + "long_name": "SETUP_FINALLY( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 606, + "end_line": 608, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_FAST", + "long_name": "LOAD_FAST( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 610, + "end_line": 612, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_FAST", + "long_name": "STORE_FAST( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 614, + "end_line": 616, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "DELETE_FAST", + "long_name": "DELETE_FAST( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 618, + "end_line": 620, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_CLOSURE", + "long_name": "LOAD_CLOSURE( self , pc , i )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "i" + ], + "start_line": 622, + "end_line": 624, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_DEREF", + "long_name": "LOAD_DEREF( self , pc , i )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "i" + ], + "start_line": 626, + "end_line": 628, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_DEREF", + "long_name": "STORE_DEREF( self , pc , i )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "i" + ], + "start_line": 630, + "end_line": 632, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "SET_LINENO", + "long_name": "SET_LINENO( self , pc , lineno )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "lineno" + ], + "start_line": 634, + "end_line": 636, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "RAISE_VARARGS", + "long_name": "RAISE_VARARGS( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 638, + "end_line": 640, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "CALL_FUNCTION", + "long_name": "CALL_FUNCTION( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 642, + "end_line": 644, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "MAKE_FUNCTION", + "long_name": "MAKE_FUNCTION( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 646, + "end_line": 648, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "MAKE_CLOSURE", + "long_name": "MAKE_CLOSURE( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 650, + "end_line": 652, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BUILD_SLICE", + "long_name": "BUILD_SLICE( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 654, + "end_line": 656, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "EXTENDED_ARG", + "long_name": "EXTENDED_ARG( self , pc , ext )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "ext" + ], + "start_line": 658, + "end_line": 660, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "CALL_FUNCTION_VAR", + "long_name": "CALL_FUNCTION_VAR( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 662, + "end_line": 664, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "CALL_FUNCTION_KW", + "long_name": "CALL_FUNCTION_KW( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 666, + "end_line": 668, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "CALL_FUNCTION_VAR_KW", + "long_name": "CALL_FUNCTION_VAR_KW( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 670, + "end_line": 672, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "typedef_by_value", + "long_name": "typedef_by_value( self , v )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "v" + ], + "start_line": 684, + "end_line": 685, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , function , signature , name = None )", + "filename": "bytecodecompiler.py", + "nloc": 11, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "function", + "signature", + "name" + ], + "start_line": 690, + "end_line": 700, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "evaluate", + "long_name": "evaluate( self , pc , code )", + "filename": "bytecodecompiler.py", + "nloc": 6, + "complexity": 3, + "token_count": 52, + "parameters": [ + "self", + "pc", + "code" + ], + "start_line": 705, + "end_line": 711, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "generate", + "long_name": "generate( self )", + "filename": "bytecodecompiler.py", + "nloc": 51, + "complexity": 14, + "token_count": 373, + "parameters": [ + "self" + ], + "start_line": 716, + "end_line": 798, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 83, + "top_nesting_level": 1 + }, + { + "name": "wrapped_code", + "long_name": "wrapped_code( self )", + "filename": "bytecodecompiler.py", + "nloc": 52, + "complexity": 5, + "token_count": 294, + "parameters": [ + "self" + ], + "start_line": 804, + "end_line": 869, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 66, + "top_nesting_level": 1 + }, + { + "name": "indent", + "long_name": "indent( self )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 871, + "end_line": 873, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "dedent", + "long_name": "dedent( self )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 875, + "end_line": 877, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "emit", + "long_name": "emit( self , s )", + "filename": "bytecodecompiler.py", + "nloc": 5, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "s" + ], + "start_line": 882, + "end_line": 886, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "push", + "long_name": "push( self , v , t )", + "filename": "bytecodecompiler.py", + "nloc": 4, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self", + "v", + "t" + ], + "start_line": 891, + "end_line": 894, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "pop", + "long_name": "pop( self )", + "filename": "bytecodecompiler.py", + "nloc": 8, + "complexity": 1, + "token_count": 57, + "parameters": [ + "self" + ], + "start_line": 899, + "end_line": 906, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "pushTuple", + "long_name": "pushTuple( self , V , T )", + "filename": "bytecodecompiler.py", + "nloc": 6, + "complexity": 1, + "token_count": 40, + "parameters": [ + "self", + "V", + "T" + ], + "start_line": 911, + "end_line": 916, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "popTuple", + "long_name": "popTuple( self )", + "filename": "bytecodecompiler.py", + "nloc": 8, + "complexity": 1, + "token_count": 57, + "parameters": [ + "self" + ], + "start_line": 922, + "end_line": 929, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "multiarg", + "long_name": "multiarg( self )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self" + ], + "start_line": 933, + "end_line": 934, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "unique", + "long_name": "unique( self )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 16, + "parameters": [ + "self" + ], + "start_line": 939, + "end_line": 941, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "post", + "long_name": "post( self , pc , action )", + "filename": "bytecodecompiler.py", + "nloc": 5, + "complexity": 2, + "token_count": 41, + "parameters": [ + "self", + "pc", + "action" + ], + "start_line": 946, + "end_line": 950, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "emit_value", + "long_name": "emit_value( self , v )", + "filename": "bytecodecompiler.py", + "nloc": 10, + "complexity": 1, + "token_count": 55, + "parameters": [ + "self", + "v" + ], + "start_line": 955, + "end_line": 966, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "global_info", + "long_name": "global_info( self , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 11, + "complexity": 4, + "token_count": 73, + "parameters": [ + "self", + "var_num" + ], + "start_line": 971, + "end_line": 984, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 1 + }, + { + "name": "codeup", + "long_name": "codeup( self , rhs , rhs_type )", + "filename": "bytecodecompiler.py", + "nloc": 9, + "complexity": 1, + "token_count": 45, + "parameters": [ + "self", + "rhs", + "rhs_type" + ], + "start_line": 990, + "end_line": 998, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "binop", + "long_name": "binop( self , pc , symbol )", + "filename": "bytecodecompiler.py", + "nloc": 9, + "complexity": 2, + "token_count": 73, + "parameters": [ + "self", + "pc", + "symbol" + ], + "start_line": 1004, + "end_line": 1014, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "BINARY_ADD", + "long_name": "BINARY_ADD( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "self", + "pc" + ], + "start_line": 1019, + "end_line": 1020, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "BINARY_SUBTRACT", + "long_name": "BINARY_SUBTRACT( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "self", + "pc" + ], + "start_line": 1021, + "end_line": 1022, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "BINARY_MULTIPLY", + "long_name": "BINARY_MULTIPLY( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self", + "pc" + ], + "start_line": 1023, + "end_line": 1025, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "BINARY_DIVIDE", + "long_name": "BINARY_DIVIDE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "self", + "pc" + ], + "start_line": 1026, + "end_line": 1027, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "BINARY_MODULO", + "long_name": "BINARY_MODULO( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 2, + "complexity": 1, + "token_count": 16, + "parameters": [ + "self", + "pc" + ], + "start_line": 1028, + "end_line": 1029, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "BINARY_SUBSCR", + "long_name": "BINARY_SUBSCR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 11, + "complexity": 2, + "token_count": 78, + "parameters": [ + "self", + "pc" + ], + "start_line": 1030, + "end_line": 1040, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "STORE_SUBSCR", + "long_name": "STORE_SUBSCR( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 13, + "complexity": 2, + "token_count": 97, + "parameters": [ + "self", + "pc" + ], + "start_line": 1042, + "end_line": 1055, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 1 + }, + { + "name": "COMPARE_OP", + "long_name": "COMPARE_OP( self , pc , opname )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self", + "pc", + "opname" + ], + "start_line": 1057, + "end_line": 1059, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "PRINT_ITEM", + "long_name": "PRINT_ITEM( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 11, + "complexity": 1, + "token_count": 88, + "parameters": [ + "self", + "pc" + ], + "start_line": 1065, + "end_line": 1078, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 1 + }, + { + "name": "PRINT_NEWLINE", + "long_name": "PRINT_NEWLINE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 6, + "complexity": 1, + "token_count": 41, + "parameters": [ + "self", + "pc" + ], + "start_line": 1084, + "end_line": 1091, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "SET_LINENO", + "long_name": "SET_LINENO( self , pc , lineno )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self", + "pc", + "lineno" + ], + "start_line": 1096, + "end_line": 1098, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "POP_TOP", + "long_name": "POP_TOP( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "pc" + ], + "start_line": 1103, + "end_line": 1105, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "LOAD_CONST", + "long_name": "LOAD_CONST( self , pc , consti )", + "filename": "bytecodecompiler.py", + "nloc": 9, + "complexity": 2, + "token_count": 53, + "parameters": [ + "self", + "pc", + "consti" + ], + "start_line": 1110, + "end_line": 1122, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "BUILD_TUPLE", + "long_name": "BUILD_TUPLE( self , pc , count )", + "filename": "bytecodecompiler.py", + "nloc": 12, + "complexity": 2, + "token_count": 72, + "parameters": [ + "self", + "pc", + "count" + ], + "start_line": 1128, + "end_line": 1139, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "LOAD_FAST", + "long_name": "LOAD_FAST( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 12, + "complexity": 3, + "token_count": 85, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 1144, + "end_line": 1155, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "LOAD_GLOBAL", + "long_name": "LOAD_GLOBAL( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 25, + "complexity": 3, + "token_count": 165, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 1160, + "end_line": 1195, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 36, + "top_nesting_level": 1 + }, + { + "name": "SETUP_LOOP", + "long_name": "SETUP_LOOP( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 1197, + "end_line": 1199, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "FOR_LOOP", + "long_name": "FOR_LOOP( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 8, + "complexity": 1, + "token_count": 57, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 1201, + "end_line": 1211, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "JUMP_ABSOLUTE", + "long_name": "JUMP_ABSOLUTE( self , pc , target )", + "filename": "bytecodecompiler.py", + "nloc": 4, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "pc", + "target" + ], + "start_line": 1213, + "end_line": 1216, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "POP_BLOCK", + "long_name": "POP_BLOCK( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 3, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "pc" + ], + "start_line": 1218, + "end_line": 1220, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "STORE_FAST", + "long_name": "STORE_FAST( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 13, + "complexity": 4, + "token_count": 101, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 1226, + "end_line": 1244, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "STORE_GLOBAL", + "long_name": "STORE_GLOBAL( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 15, + "complexity": 1, + "token_count": 99, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 1249, + "end_line": 1269, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "CALL_FUNCTION", + "long_name": "CALL_FUNCTION( self , pc , argc )", + "filename": "bytecodecompiler.py", + "nloc": 18, + "complexity": 2, + "token_count": 125, + "parameters": [ + "self", + "pc", + "argc" + ], + "start_line": 1274, + "end_line": 1300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 27, + "top_nesting_level": 1 + }, + { + "name": "JUMP_IF_FALSE", + "long_name": "JUMP_IF_FALSE( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 11, + "complexity": 2, + "token_count": 89, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 1306, + "end_line": 1320, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "JUMP_FORWARD", + "long_name": "JUMP_FORWARD( self , pc , delta )", + "filename": "bytecodecompiler.py", + "nloc": 6, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self", + "pc", + "delta" + ], + "start_line": 1326, + "end_line": 1332, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 1 + }, + { + "name": "RETURN_VALUE", + "long_name": "RETURN_VALUE( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 13, + "complexity": 4, + "token_count": 69, + "parameters": [ + "self", + "pc" + ], + "start_line": 1337, + "end_line": 1349, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + } + ], + "changed_methods": [ + { + "name": "wrapped_code", + "long_name": "wrapped_code( self )", + "filename": "bytecodecompiler.py", + "nloc": 54, + "complexity": 6, + "token_count": 303, + "parameters": [ + "self" + ], + "start_line": 806, + "end_line": 872, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 67, + "top_nesting_level": 1 + }, + { + "name": "LOAD_ATTR", + "long_name": "LOAD_ATTR( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 13, + "complexity": 1, + "token_count": 88, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 1166, + "end_line": 1178, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "generate", + "long_name": "generate( self )", + "filename": "bytecodecompiler.py", + "nloc": 52, + "complexity": 14, + "token_count": 376, + "parameters": [ + "self" + ], + "start_line": 716, + "end_line": 800, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 85, + "top_nesting_level": 1 + }, + { + "name": "PRINT_ITEM", + "long_name": "PRINT_ITEM( self , pc )", + "filename": "bytecodecompiler.py", + "nloc": 13, + "complexity": 2, + "token_count": 96, + "parameters": [ + "self", + "pc" + ], + "start_line": 1068, + "end_line": 1083, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "STORE_GLOBAL", + "long_name": "STORE_GLOBAL( self , pc , var_num )", + "filename": "bytecodecompiler.py", + "nloc": 16, + "complexity": 2, + "token_count": 117, + "parameters": [ + "self", + "pc", + "var_num" + ], + "start_line": 1291, + "end_line": 1312, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 1 + }, + { + "name": "STORE_ATTR", + "long_name": "STORE_ATTR( self , pc , namei )", + "filename": "bytecodecompiler.py", + "nloc": 14, + "complexity": 1, + "token_count": 90, + "parameters": [ + "self", + "pc", + "namei" + ], + "start_line": 1184, + "end_line": 1197, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 1 + } + ], + "nloc": 967, + "complexity": 216, + "token_count": 5353, + "diff_parsed": { + "added": [ + " code += ' PyObject* tempPY= 0;\\n'", + "", + " result,owned = self.rtype.outbound('_result')", + " if not owned:", + " code += ' Py_INCREF(_result);\\n'", + " code,owned = t.outbound(v)", + " self.emit('PyObject* %s = %s;'%(py, code))", + " if owned:", + " self.emit('Py_XDECREF(%s);'%py)", + "", + " ##################################################################", + " # MEMBER LOAD_ATTR #", + " ##################################################################", + " def LOAD_ATTR(self,pc,namei):", + " v,t = self.pop()", + " attr_name = self.codeobject.co_names[namei]", + " print 'LOAD_ATTR',namei,v,t,attr_name", + " aType,aCode = t.get_attribute(attr_name)", + " print 'ATTR',aType", + " print aCode", + " lhs = self.unique()", + " rhs = v", + " lhsType = aType.cxxtype", + " self.emit(aCode%locals())", + " self.push(lhs,aType)", + " return", + "", + "", + " ##################################################################", + " # MEMBER STORE_ATTR #", + " ##################################################################", + " def STORE_ATTR(self,pc,namei):", + " v,t = self.pop()", + " attr_name = self.codeobject.co_names[namei]", + " print 'STORE_ATTR',namei,v,t,attr_name", + " v2,t2 = self.pop()", + " print 'SA value',v2,t2", + " aType,aCode = t.set_attribute(attr_name)", + " print 'ATTR',aType", + " print aCode", + " assert t2 is aType", + " rhs = v2", + " lhs = v", + " self.emit(aCode%locals())", + " return", + "", + " code,owned = descriptor.outbound(v)", + " self.emit('PyObject* %s = %s;'%(py,code))", + " if not owned:", + " self.emit('Py_INCREF(%s);'%py)" + ], + "deleted": [ + "", + " result = self.rtype.outbound('_result')", + " self.emit('PyObject* %s = %s;'%(py, t.outbound(v)))", + " self.emit('Py_XDECREF(%s);'%py)", + " self.emit('PyObject* %s = %s;'%(", + " py,", + " descriptor.outbound%v))" + ] + } + } + ] + }, + { + "hash": "e0403fd806df19a20b1d73d9efe48b3f550f0b92", + "msg": "changed g77 version checking from -v to --version. This hopefully fixes problems on IRIX, but will disable some optimization flags on intel/amd linux machines when gcc 3.x.x is used. We just need to find what the version number on the 3.x.x reported by g77 --version is to fix this.", + "author": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "committer": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "author_date": "2002-05-03T03:27:23+00:00", + "author_timezone": 0, + "committer_date": "2002-05-03T03:27:23+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "ea80961cbae297b29a20bd67824e6c64d3815272" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 5, + "insertions": 7, + "lines": 12, + "files": 1, + "dmm_unit_size": 1.0, + "dmm_unit_complexity": 1.0, + "dmm_unit_interfacing": 1.0, + "modified_files": [ + { + "old_path": "scipy_distutils/command/build_flib.py", + "new_path": "scipy_distutils/command/build_flib.py", + "filename": "build_flib.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -445,9 +445,9 @@ def get_version(self):\n return self.version\n self.version = ''\n # works I think only for unix... \n- #print 'command:', self.ver_cmd\n+ print 'command:', self.ver_cmd\n exit_status, out_text = run_command(self.ver_cmd)\n- #print exit_status, out_text\n+ print exit_status, out_text\n if not exit_status:\n m = re.match(self.ver_match,out_text)\n if m:\n@@ -636,8 +636,9 @@ def get_extra_link_args(self):\n class gnu_fortran_compiler(fortran_compiler_base):\n \n vendor = 'Gnu'\n- ver_match = r'g77 version (?P[^\\s*]*)'\n-\n+ #ver_match = r'g77 version (?P[^\\s*]*)'\n+ ver_match = r'GNU Fortran (?P[^\\s*]*)'\n+ \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if sys.platform == 'win32':\n@@ -660,7 +661,8 @@ def __init__(self, fc = None, f90c = None):\n switches = switches + ' -fpic '\n \n self.f77_switches = switches\n- self.ver_cmd = self.f77_compiler + ' -v '\n+ #self.ver_cmd = self.f77_compiler + ' -v '\n+ self.ver_cmd = self.f77_compiler + ' --version'\n \n self.f77_opt = self.get_opt()\n \n", + "added_lines": 7, + "deleted_lines": 5, + "source_code": "\"\"\" Implements the build_flib command which should go into Distutils\n at some point.\n \n Note:\n Right now, we're dynamically linking to the Fortran libraries on \n some platforms (Sun for sure). This is fine for local installations\n but a bad thing for redistribution because these libraries won't\n live on any machine that doesn't have a fortran compiler installed.\n It is pretty hard (impossible?) to get gcc to pass the right compiler\n flags on Sun to get the linker to use static libs for the fortran\n stuff. Investigate further...\n\nBugs:\n *** Options -e and -x have no effect when used with --help-compiler\n options. E.g. \n ./setup.py build_flib --help-compiler -e g77-3.0\n finds g77-2.95.\n How to extract these options inside the show_compilers function?\n *** compiler.is_available() method may not work correctly on nt\n because of lack of knowledge how to get exit status in\n run_command function. However, it may give reasonable results\n based on a version string.\n *** Some vendors provide different compilers for F77 and F90\n compilations. Currently, checking the availability of these\n compilers is based on only checking the availability of the\n corresponding F77 compiler. If it exists, then F90 is assumed\n to exist also.\n\nOpen issues:\n *** User-defined compiler flags. Do we need --fflags?\n\nFortran compilers (as to be used with --fcompiler= option):\n Absoft\n Sun\n SGI\n Intel\n Itanium\n NAG\n Compaq\n Gnu\n VAST\n\"\"\"\n\nimport distutils\nimport distutils.dep_util, distutils.dir_util\nimport os,sys,string\nimport commands,re\nfrom types import *\nfrom distutils.ccompiler import CCompiler,gen_preprocess_options\nfrom distutils.command.build_clib import build_clib\nfrom distutils.errors import *\n\nclass FortranCompilerError (CCompilerError):\n \"\"\"Some compile/link operation failed.\"\"\"\nclass FortranCompileError (FortranCompilerError):\n \"\"\"Failure to compile one or more Fortran source files.\"\"\"\n\nif os.name == 'nt':\n def run_command(command):\n \"\"\" not sure how to get exit status on nt. \"\"\"\n in_pipe,out_pipe = os.popen4(command)\n in_pipe.close()\n text = out_pipe.read()\n return 0, text\nelse:\n run_command = commands.getstatusoutput\n \ndef show_compilers():\n for compiler_class in all_compilers:\n compiler = compiler_class()\n if compiler.is_available():\n print compiler\n\nclass build_flib (build_clib):\n\n description = \"build f77/f90 libraries used by Python extensions\"\n\n user_options = [\n ('build-flib', 'b',\n \"directory to build f77/f90 libraries to\"),\n ('build-temp', 't',\n \"directory to put temporary build by-products\"),\n ('debug', 'g',\n \"compile with debugging information\"),\n ('force', 'f',\n \"forcibly build everything (ignore file timestamps)\"),\n ('fcompiler=', 'c',\n \"specify the compiler type\"),\n ('fcompiler-exec=', 'e',\n \"specify the path to F77 compiler\"),\n ('f90compiler-exec=', 'x',\n \"specify the path to F90 compiler\"),\n ]\n\n boolean_options = ['debug', 'force']\n\n help_options = [\n ('help-compiler', None,\n \"list available compilers\", show_compilers),\n ]\n\n def initialize_options (self):\n\n self.build_flib = None\n self.build_temp = None\n\n self.fortran_libraries = None\n self.define = None\n self.undef = None\n self.debug = None\n self.force = 0\n self.fcompiler = None\n self.fcompiler_exec = None\n self.f90compiler_exec = None\n\n # initialize_options()\n\n def finalize_options (self):\n self.set_undefined_options('build',\n ('build_temp', 'build_flib'),\n ('build_temp', 'build_temp'),\n ('debug', 'debug'),\n ('force', 'force'))\n fc = find_fortran_compiler(self.fcompiler,\n self.fcompiler_exec,\n self.f90compiler_exec)\n if not fc:\n raise DistutilsOptionError, 'Fortran compiler not available: %s'%(self.fcompiler)\n else:\n self.announce(' using %s Fortran compiler' % fc)\n self.fcompiler = fc\n if self.has_f_libraries():\n self.fortran_libraries = self.distribution.fortran_libraries\n self.check_library_list(self.fortran_libraries)\n \n # finalize_options()\n\n def has_f_libraries(self):\n return self.distribution.fortran_libraries \\\n and len(self.distribution.fortran_libraries) > 0\n\n def run (self):\n if not self.has_f_libraries():\n return\n self.build_libraries(self.fortran_libraries)\n\n # run ()\n\n def has_f_library(self,name):\n if self.has_f_libraries():\n for (lib_name, build_info) in self.fortran_libraries:\n if lib_name == name:\n return 1\n \n def get_library_names(self, name=None):\n if not self.has_f_libraries():\n return None\n\n lib_names = []\n\n if name is None:\n for (lib_name, build_info) in self.fortran_libraries:\n lib_names.append(lib_name)\n\n if self.fcompiler is not None:\n lib_names.extend(self.fcompiler.get_libraries())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n for n in build_info.get('libraries',[]):\n lib_names.append(n)\n #XXX: how to catch recursive calls here?\n lib_names.extend(self.get_library_names(n))\n break\n return lib_names\n\n def get_fcompiler_library_names(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_libraries()\n return []\n\n def get_fcompiler_library_dirs(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_library_dirs()\n return []\n\n # get_library_names ()\n\n def get_library_dirs(self, name=None):\n if not self.has_f_libraries():\n return []\n\n lib_dirs = [] \n\n if name is None:\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_library_dirs())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n lib_dirs.extend(build_info.get('library_dirs',[]))\n for n in build_info.get('libraries',[]):\n lib_dirs.extend(self.get_library_dirs(n))\n break\n\n return lib_dirs\n\n # get_library_dirs ()\n\n def get_runtime_library_dirs(self):\n #if not self.has_f_libraries():\n # return []\n\n lib_dirs = []\n\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_runtime_library_dirs())\n \n return lib_dirs\n\n # get_library_dirs ()\n\n def get_source_files (self):\n if not self.has_f_libraries():\n return []\n\n self.check_library_list(self.fortran_libraries)\n filenames = []\n\n # Gets source files specified \n for ext in self.fortran_libraries:\n filenames.extend(ext[1]['sources'])\n\n return filenames \n \n def build_libraries (self, fortran_libraries):\n \n fcompiler = self.fcompiler\n \n for (lib_name, build_info) in fortran_libraries:\n self.announce(\" building '%s' library\" % lib_name)\n\n sources = build_info.get('sources')\n if sources is None or type(sources) not in (ListType, TupleType):\n raise DistutilsSetupError, \\\n (\"in 'fortran_libraries' option (library '%s'), \" +\n \"'sources' must be present and must be \" +\n \"a list of source filenames\") % lib_name\n sources = list(sources)\n module_dirs = build_info.get('module_dirs')\n module_files = build_info.get('module_files')\n\n\n include_dirs = build_info.get('include_dirs')\n\n if include_dirs:\n fcompiler.set_include_dirs(include_dirs)\n for n,v in build_info.get('define_macros') or []:\n fcompiler.define_macro(n,v)\n for n in build_info.get('undef_macros') or []:\n fcompiler.undefine_macro(n)\n\n if module_files:\n fcompiler.build_library(lib_name, module_files,\n temp_dir=self.build_temp)\n \n fcompiler.build_library(lib_name, sources,\n module_dirs, temp_dir=self.build_temp)\n\n # for loop\n\n # build_libraries ()\n\n\nclass fortran_compiler_base(CCompiler):\n\n vendor = None\n ver_match = None\n\n compiler_type = 'fortran'\n executables = {}\n \n def __init__(self,verbose=0,dry_run=0,force=0):\n # Default initialization. Constructors of derived classes MUST\n # call this function.\n CCompiler.__init__(self,verbose,dry_run,force)\n\n self.version = None\n \n self.f77_switches = ''\n self.f77_opt = ''\n self.f77_debug = ''\n \n self.f90_switches = ''\n self.f90_opt = ''\n self.f90_debug = ''\n \n #self.libraries = []\n #self.library_dirs = []\n\n if self.vendor is None:\n raise DistutilsInternalError,\\\n '%s must define vendor attribute'%(self.__class__)\n if self.ver_match is None:\n raise DistutilsInternalError,\\\n '%s must define ver_match attribute'%(self.__class__)\n\n def to_object(self,\n dirty_files,\n module_dirs=None,\n temp_dir=''):\n files = string.join(dirty_files)\n f90_files = get_f90_files(dirty_files)\n f77_files = get_f77_files(dirty_files)\n if f90_files != []:\n obj1 = self.f90_compile(f90_files,module_dirs,temp_dir = temp_dir)\n else:\n obj1 = []\n if f77_files != []:\n obj2 = self.f77_compile(f77_files, temp_dir = temp_dir)\n else:\n obj2 = []\n return obj1 + obj2\n\n def source_to_object_names(self,source_files, temp_dir=''):\n file_list = map(lambda x: os.path.basename(x),source_files)\n file_base_ext = map(lambda x: os.path.splitext(x),file_list)\n object_list = map(lambda x: x[0] +'.o',file_base_ext)\n object_files = map(lambda x,td=temp_dir: os.path.join(td,x),object_list)\n return object_files\n \n def source_and_object_pairs(self,source_files, temp_dir=''):\n object_files = self.source_to_object_names(source_files,temp_dir)\n file_pairs = zip(source_files,object_files)\n return file_pairs\n \n def f_compile(self,compiler,switches, source_files,\n module_dirs=None, temp_dir=''):\n\n pp_opts = gen_preprocess_options(self.macros,self.include_dirs)\n\n switches = switches + ' ' + string.join(pp_opts,' ')\n\n module_switch = self.build_module_switch(module_dirs)\n file_pairs = self.source_and_object_pairs(source_files,temp_dir)\n object_files = []\n for source,object in file_pairs:\n if distutils.dep_util.newer(source,object):\n cmd = compiler + ' ' + switches + ' '+\\\n module_switch + \\\n ' -c ' + source + ' -o ' + object \n print cmd\n failure = os.system(cmd)\n if failure:\n raise FortranCompileError, 'failure during compile' \n object_files.append(object)\n return object_files\n #return all object files to make sure everything is archived \n #return map(lambda x: x[1], file_pairs)\n\n def f90_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f90_switches, self.f90_opt))\n return self.f_compile(self.f90_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n def f77_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f77_switches, self.f77_opt))\n return self.f_compile(self.f77_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n\n def build_module_switch(self, module_dirs):\n return ''\n\n def create_static_lib(self, object_files, library_name,\n output_dir='', debug=None):\n lib_file = os.path.join(output_dir,'lib'+library_name+'.a')\n newer = distutils.dep_util.newer\n # This doesn't work -- no way to know if the file is in the archive\n #object_files = filter(lambda o,lib=lib_file:\\\n # distutils.dep_util.newer(o,lib),object_files)\n objects = string.join(object_files)\n if objects:\n cmd = 'ar -cur %s %s' % (lib_file,objects)\n print cmd\n os.system(cmd)\n cmd = 'ranlib %s ' % lib_file\n print cmd\n os.system(cmd)\n\n def build_library(self,library_name,source_list,module_dirs=None,\n temp_dir = ''):\n #make sure the temp directory exists before trying to build files\n import distutils.dir_util\n distutils.dir_util.mkpath(temp_dir)\n\n #this compiles the files\n object_list = self.to_object(source_list,\n module_dirs,\n temp_dir)\n\n # actually we need to use all the object file names here to\n # make sure the library is always built. It could occur that an\n # object file exists but hasn't been put in the archive. (happens\n # a lot when builds fail once and are restarted).\n object_list = self.source_to_object_names(source_list, temp_dir)\n\n if os.name == 'nt':\n # This is pure bunk...\n # Windows fails for long argument strings on the command line.\n # if objects is real long (> 2048 chars or so on my machine),\n # the command fails (cmd.exe /e:2048 on w2k)\n # for now we'll split linking into to steps which should work for\n objects = object_list[:]\n while objects:\n obj,objects = objects[:20],objects[20:]\n self.create_static_lib(obj,library_name,temp_dir)\n else:\n self.create_static_lib(object_list,library_name,temp_dir)\n\n def dummy_fortran_files(self):\n import tempfile \n d = tempfile.gettempdir()\n dummy_name = os.path.join(d,'__dummy.f')\n dummy = open(dummy_name,'w')\n dummy.write(\" subroutine dummy()\\n end\\n\")\n dummy.close()\n return (os.path.join(d,'__dummy.f'),os.path.join(d,'__dummy.o'))\n \n def is_available(self):\n return self.get_version()\n \n def get_version(self):\n \"\"\"Return the compiler version. If compiler is not available,\n return empty string.\"\"\"\n # XXX: Is there compilers that have no version? If yes,\n # this test will fail even if the compiler is available.\n if self.version is not None:\n # Finding version is expensive, so return previously found\n # version string.\n return self.version\n self.version = ''\n # works I think only for unix... \n print 'command:', self.ver_cmd\n exit_status, out_text = run_command(self.ver_cmd)\n print exit_status, out_text\n if not exit_status:\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n return self.version\n\n def get_libraries(self):\n return self.libraries\n def get_library_dirs(self):\n return self.library_dirs\n def get_extra_link_args(self):\n return []\n def get_runtime_library_dirs(self):\n return []\n def get_linker_so(self):\n \"\"\"\n If a compiler requires specific linker then return a list\n containing a linker executable name and linker options.\n Otherwise, return None.\n \"\"\"\n\n def __str__(self):\n return \"%s %s\" % (self.vendor, self.get_version())\n\n\nclass absoft_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Absoft'\n ver_match = r'FORTRAN 77 Compiler (?P[^\\s*,]*).*?Absoft Corp'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n # got rid of -B108 cause it was generating 2 underscores instead\n # of one on the newest version. Now we use -YEXT_SFX=_ to \n # specify the output format\n if os.name == 'nt':\n self.f90_switches = '-f fixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -Q100'\n self.f77_switches = '-N22 -N90 -N110'\n self.f77_opt = '-O -Q100'\n self.libraries = ['fio', 'fmath', 'f90math', 'COMDLG32']\n else:\n self.f90_switches = '-ffixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -B101' \n self.f77_switches = '-N22 -N90 -N110 -B108'\n self.f77_opt = '-O -B101'\n\n self.libraries = ['fio', 'f77math', 'f90math']\n \n try:\n dir = os.environ['ABSOFT'] \n self.library_dirs = [os.path.join(dir,'lib')]\n except KeyError:\n self.library_dirs = []\n\n self.ver_cmd = self.f77_compiler + ' -V -c %s -o %s' % \\\n self.dummy_fortran_files()\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -p' + mod\n return res\n\n def get_extra_link_args(self):\n return []\n # Couldn't get this to link for anything using gcc.\n #dr = \"c:\\\\Absoft62\\\\lib\"\n #libs = ['fio.lib', 'COMDLG32.lib','fmath.lib', 'f90math.lib','libcomdlg32.a' ] \n #libs = map(lambda x,dr=dr:os.path.join(dr,x),libs)\n #return libs\n\n\nclass sun_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Sun'\n #ver_match = r'f77: (?P[^\\s*,]*)'\n ver_match = r'f90: Sun (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -pic '\n self.f77_opt = ' -fast -dalign '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -fixed ' # ??? why fixed?\n self.f90_opt = ' -fast -dalign '\n\n self.ver_cmd = self.f90_compiler + ' -V'\n\n #self.libraries = ['f90', 'F77', 'M77', 'sunmath', 'm']\n self.libraries = ['fsu', 'F77', 'M77', 'sunmath', 'm']\n \n #threaded\n #self.libraries = ['f90', 'F77_mt', 'sunmath_mt', 'm', 'thread']\n #self.libraries = []\n self.library_dirs = self.find_lib_dir()\n #print 'sun:',self.library_dirs\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -M' + mod\n return res\n\n def find_lib_dir(self):\n library_dirs = []\n lib_match = r'### f90: Note: LD_RUN_PATH\\s*= '\\\n '(?P[^\\s.]*).*'\n cmd = self.f90_compiler + ' -dryrun dummy.f'\n exit_status, output = run_command(cmd)\n if not exit_status:\n libs = re.findall(lib_match,output)\n if libs:\n library_dirs = string.split(libs[0],':')\n self.get_version() # force version calculation\n compiler_home = os.path.dirname(library_dirs[0])\n library_dirs.append(os.path.join(compiler_home,\n self.version,'lib'))\n return library_dirs\n def get_runtime_library_dirs(self):\n return self.find_lib_dir()\n def get_extra_link_args(self):\n return ['-mimpure-text']\n\n\nclass mips_fortran_compiler(fortran_compiler_base):\n\n vendor = 'SGI'\n ver_match = r'MIPSpro Compilers: Version (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -n32 -KPIC '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -n32 -KPIC -fixedform ' # why fixed ???\n self.f90_opt = ' ' \n\n self.ver_cmd = self.f77_compiler + ' -version'\n \n self.libraries = ['fortran', 'ftn', 'm']\n self.library_dirs = self.find_lib_dir()\n\n\n\n def build_module_switch(self,module_dirs):\n res = ''\n return res \n def find_lib_dir(self):\n library_dirs = []\n return library_dirs\n def get_runtime_library_dirs(self):\n\treturn self.find_lib_dir() \n def get_extra_link_args(self):\n\treturn []\n\n\nclass gnu_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Gnu'\n #ver_match = r'g77 version (?P[^\\s*]*)'\n ver_match = r'GNU Fortran (?P[^\\s*]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if sys.platform == 'win32':\n self.libraries = ['gcc','g2c']\n self.library_dirs = self.find_lib_directories()\n else:\n # On linux g77 does not need lib_directories to be specified.\n self.libraries = ['g2c']\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n\n switches = ' -Wall -fno-second-underscore '\n\n if os.name != 'nt':\n switches = switches + ' -fpic '\n\n self.f77_switches = switches\n #self.ver_cmd = self.f77_compiler + ' -v '\n self.ver_cmd = self.f77_compiler + ' --version'\n\n self.f77_opt = self.get_opt()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 -funroll-loops '\n \n # only check for more optimization if g77 can handle\n # it.\n if self.get_version():\n if self.version[0]=='3': # is g77 3.x.x\n if cpu.is_AthlonK6():\n opt = opt + ' -march=k6 '\n elif cpu.is_AthlonK7():\n opt = opt + ' -march=athlon '\n if cpu.is_i686():\n opt = opt + ' -march=i686 '\n elif cpu.is_i586():\n opt = opt + ' -march=i586 '\n elif cpu.is_i486():\n opt = opt + ' -march=i486 '\n elif cpu.is_i386():\n opt = opt + ' -march=i386 '\n if cpu.is_Intel():\n opt = opt + ' -malign-double ' \n return opt\n \n def find_lib_directories(self):\n lib_dir = []\n match = r'Reading specs from (.*)/specs'\n\n # works I think only for unix... \n exit_status, out_text = run_command('g77 -v')\n if not exit_status:\n m = re.findall(match,out_text)\n if m:\n lib_dir= m #m[0] \n return lib_dir\n\n def get_linker_so(self):\n # win32 linking should be handled by standard linker\n if sys.platform != 'win32' and os.uname()[0] != 'Darwin':\n return [self.f77_compiler,'-shared']\n \n def f90_compile(self,source_files,module_files,temp_dir=''):\n raise DistutilsExecError, 'f90 not supported by Gnu'\n\n\n#http://developer.intel.com/software/products/compilers/f50/linux/\nclass intel_ia32_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Intel' # Intel(R) Corporation \n ver_match = r'Intel\\(R\\) Fortran Compiler for 32-bit applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'ifc'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -KPIC '\n\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n if cpu.has_fdiv_bug():\n switches = switches + ' -fdiv_check '\n if cpu.has_f00f_bug():\n switches = switches + ' -0f_check '\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -FI -w90 -w95 '\n\n self.f77_opt = self.f90_opt = self.get_opt()\n \n debug = ' -g -C '\n self.f77_debug = self.f90_debug = debug\n\n self.ver_cmd = self.f77_compiler+' -FI -V -c %s -o %s' %\\\n self.dummy_fortran_files()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 '\n if cpu.is_PentiumPro() or cpu.is_PentiumII():\n opt = opt + ' -tpp6 -xi '\n elif cpu.is_PentiumIII():\n opt = opt + ' -tpp6 '\n elif cpu.is_Pentium():\n opt = opt + ' -tpp5 '\n elif cpu.is_PentiumIV():\n opt = opt + ' -tpp7 -xW '\n elif cpu.has_mmx():\n opt = opt + ' -xM '\n return opt\n \n\n def get_linker_so(self):\n return [self.f77_compiler,'-shared']\n\n\nclass intel_itanium_fortran_compiler(intel_ia32_fortran_compiler):\n\n vendor = 'Itanium'\n ver_match = r'Intel\\(R\\) Fortran 90 Compiler Itanium\\(TM\\) Compiler for the Itanium\\(TM\\)-based applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n if fc is None:\n fc = 'efc'\n intel_ia32_fortran_compiler.__init__(self, fc, f90c)\n\n\nclass nag_fortran_compiler(fortran_compiler_base):\n\n vendor = 'NAG'\n ver_match = r'NAGWare Fortran 95 compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'f95'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ''\n debug = ' -g -gline -g90 -nan -C '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -fixed '\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -target=native '\n return opt\n\n def get_linker_so(self):\n return [self.f77_compiler,'-Wl,-shared']\n\n\nclass vast_fortran_compiler(fortran_compiler_base):\n\n vendor = 'VAST'\n ver_match = r'\\s*Pacific-Sierra Research vf90 (Personal|Professional)\\s+(?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n d,b = os.path.split(f90c)\n vf90 = os.path.join(d,'v'+b)\n self.ver_cmd = vf90+' -v '\n\n gnu = gnu_fortran_compiler(fc)\n if not gnu.is_available(): # VAST compiler requires g77.\n self.version = ''\n return\n if not self.is_available():\n return\n\n self.f77_switches = gnu.f77_switches\n self.f77_debug = gnu.f77_debug\n self.f77_opt = gnu.f77_opt \n\n # XXX: need f90 switches, debug, opt\n\n def get_linker_so(self):\n return [self.f90_compiler,'-shared']\n\nclass compaq_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Compaq'\n ver_match = r'Compaq Fortran (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'fort'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -assume no2underscore -nomixed_str_len_arg '\n debug = ' -g -check_bounds '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n # XXX: uncomment if required\n #self.libraries = ' -lUfor -lfor -lFutil -lcpml -lots -lc '\n\n # XXX: fix the version showing flag\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -align dcommons -arch host -assume bigarrays -assume nozsize -math_library fast -tune host '\n return opt\n\n def get_linker_so(self):\n # XXX: is -shared needed?\n return [self.f77_compiler,'-shared']\n\n\ndef match_extension(files,ext):\n match = re.compile(r'.*[.]('+ext+r')\\Z',re.I).match\n return filter(lambda x,match = match: match(x),files)\n\ndef get_f77_files(files):\n return match_extension(files,'for|f77|ftn|f')\n\ndef get_f90_files(files):\n return match_extension(files,'f90|f95')\n\ndef get_fortran_files(files):\n return match_extension(files,'f90|f95|for|f77|ftn|f')\n\ndef find_fortran_compiler(vendor = None, fc = None, f90c = None):\n fcompiler = None\n for compiler_class in all_compilers:\n if vendor is not None and vendor != compiler_class.vendor:\n continue\n print compiler_class\n compiler = compiler_class(fc,f90c)\n if compiler.is_available():\n fcompiler = compiler\n break\n return fcompiler\n\nall_compilers = [absoft_fortran_compiler,\n mips_fortran_compiler,\n sun_fortran_compiler,\n intel_ia32_fortran_compiler,\n intel_itanium_fortran_compiler,\n nag_fortran_compiler,\n compaq_fortran_compiler,\n vast_fortran_compiler,\n gnu_fortran_compiler,\n ]\n\nif __name__ == \"__main__\":\n show_compilers()\n", + "source_code_before": "\"\"\" Implements the build_flib command which should go into Distutils\n at some point.\n \n Note:\n Right now, we're dynamically linking to the Fortran libraries on \n some platforms (Sun for sure). This is fine for local installations\n but a bad thing for redistribution because these libraries won't\n live on any machine that doesn't have a fortran compiler installed.\n It is pretty hard (impossible?) to get gcc to pass the right compiler\n flags on Sun to get the linker to use static libs for the fortran\n stuff. Investigate further...\n\nBugs:\n *** Options -e and -x have no effect when used with --help-compiler\n options. E.g. \n ./setup.py build_flib --help-compiler -e g77-3.0\n finds g77-2.95.\n How to extract these options inside the show_compilers function?\n *** compiler.is_available() method may not work correctly on nt\n because of lack of knowledge how to get exit status in\n run_command function. However, it may give reasonable results\n based on a version string.\n *** Some vendors provide different compilers for F77 and F90\n compilations. Currently, checking the availability of these\n compilers is based on only checking the availability of the\n corresponding F77 compiler. If it exists, then F90 is assumed\n to exist also.\n\nOpen issues:\n *** User-defined compiler flags. Do we need --fflags?\n\nFortran compilers (as to be used with --fcompiler= option):\n Absoft\n Sun\n SGI\n Intel\n Itanium\n NAG\n Compaq\n Gnu\n VAST\n\"\"\"\n\nimport distutils\nimport distutils.dep_util, distutils.dir_util\nimport os,sys,string\nimport commands,re\nfrom types import *\nfrom distutils.ccompiler import CCompiler,gen_preprocess_options\nfrom distutils.command.build_clib import build_clib\nfrom distutils.errors import *\n\nclass FortranCompilerError (CCompilerError):\n \"\"\"Some compile/link operation failed.\"\"\"\nclass FortranCompileError (FortranCompilerError):\n \"\"\"Failure to compile one or more Fortran source files.\"\"\"\n\nif os.name == 'nt':\n def run_command(command):\n \"\"\" not sure how to get exit status on nt. \"\"\"\n in_pipe,out_pipe = os.popen4(command)\n in_pipe.close()\n text = out_pipe.read()\n return 0, text\nelse:\n run_command = commands.getstatusoutput\n \ndef show_compilers():\n for compiler_class in all_compilers:\n compiler = compiler_class()\n if compiler.is_available():\n print compiler\n\nclass build_flib (build_clib):\n\n description = \"build f77/f90 libraries used by Python extensions\"\n\n user_options = [\n ('build-flib', 'b',\n \"directory to build f77/f90 libraries to\"),\n ('build-temp', 't',\n \"directory to put temporary build by-products\"),\n ('debug', 'g',\n \"compile with debugging information\"),\n ('force', 'f',\n \"forcibly build everything (ignore file timestamps)\"),\n ('fcompiler=', 'c',\n \"specify the compiler type\"),\n ('fcompiler-exec=', 'e',\n \"specify the path to F77 compiler\"),\n ('f90compiler-exec=', 'x',\n \"specify the path to F90 compiler\"),\n ]\n\n boolean_options = ['debug', 'force']\n\n help_options = [\n ('help-compiler', None,\n \"list available compilers\", show_compilers),\n ]\n\n def initialize_options (self):\n\n self.build_flib = None\n self.build_temp = None\n\n self.fortran_libraries = None\n self.define = None\n self.undef = None\n self.debug = None\n self.force = 0\n self.fcompiler = None\n self.fcompiler_exec = None\n self.f90compiler_exec = None\n\n # initialize_options()\n\n def finalize_options (self):\n self.set_undefined_options('build',\n ('build_temp', 'build_flib'),\n ('build_temp', 'build_temp'),\n ('debug', 'debug'),\n ('force', 'force'))\n fc = find_fortran_compiler(self.fcompiler,\n self.fcompiler_exec,\n self.f90compiler_exec)\n if not fc:\n raise DistutilsOptionError, 'Fortran compiler not available: %s'%(self.fcompiler)\n else:\n self.announce(' using %s Fortran compiler' % fc)\n self.fcompiler = fc\n if self.has_f_libraries():\n self.fortran_libraries = self.distribution.fortran_libraries\n self.check_library_list(self.fortran_libraries)\n \n # finalize_options()\n\n def has_f_libraries(self):\n return self.distribution.fortran_libraries \\\n and len(self.distribution.fortran_libraries) > 0\n\n def run (self):\n if not self.has_f_libraries():\n return\n self.build_libraries(self.fortran_libraries)\n\n # run ()\n\n def has_f_library(self,name):\n if self.has_f_libraries():\n for (lib_name, build_info) in self.fortran_libraries:\n if lib_name == name:\n return 1\n \n def get_library_names(self, name=None):\n if not self.has_f_libraries():\n return None\n\n lib_names = []\n\n if name is None:\n for (lib_name, build_info) in self.fortran_libraries:\n lib_names.append(lib_name)\n\n if self.fcompiler is not None:\n lib_names.extend(self.fcompiler.get_libraries())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n for n in build_info.get('libraries',[]):\n lib_names.append(n)\n #XXX: how to catch recursive calls here?\n lib_names.extend(self.get_library_names(n))\n break\n return lib_names\n\n def get_fcompiler_library_names(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_libraries()\n return []\n\n def get_fcompiler_library_dirs(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_library_dirs()\n return []\n\n # get_library_names ()\n\n def get_library_dirs(self, name=None):\n if not self.has_f_libraries():\n return []\n\n lib_dirs = [] \n\n if name is None:\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_library_dirs())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n lib_dirs.extend(build_info.get('library_dirs',[]))\n for n in build_info.get('libraries',[]):\n lib_dirs.extend(self.get_library_dirs(n))\n break\n\n return lib_dirs\n\n # get_library_dirs ()\n\n def get_runtime_library_dirs(self):\n #if not self.has_f_libraries():\n # return []\n\n lib_dirs = []\n\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_runtime_library_dirs())\n \n return lib_dirs\n\n # get_library_dirs ()\n\n def get_source_files (self):\n if not self.has_f_libraries():\n return []\n\n self.check_library_list(self.fortran_libraries)\n filenames = []\n\n # Gets source files specified \n for ext in self.fortran_libraries:\n filenames.extend(ext[1]['sources'])\n\n return filenames \n \n def build_libraries (self, fortran_libraries):\n \n fcompiler = self.fcompiler\n \n for (lib_name, build_info) in fortran_libraries:\n self.announce(\" building '%s' library\" % lib_name)\n\n sources = build_info.get('sources')\n if sources is None or type(sources) not in (ListType, TupleType):\n raise DistutilsSetupError, \\\n (\"in 'fortran_libraries' option (library '%s'), \" +\n \"'sources' must be present and must be \" +\n \"a list of source filenames\") % lib_name\n sources = list(sources)\n module_dirs = build_info.get('module_dirs')\n module_files = build_info.get('module_files')\n\n\n include_dirs = build_info.get('include_dirs')\n\n if include_dirs:\n fcompiler.set_include_dirs(include_dirs)\n for n,v in build_info.get('define_macros') or []:\n fcompiler.define_macro(n,v)\n for n in build_info.get('undef_macros') or []:\n fcompiler.undefine_macro(n)\n\n if module_files:\n fcompiler.build_library(lib_name, module_files,\n temp_dir=self.build_temp)\n \n fcompiler.build_library(lib_name, sources,\n module_dirs, temp_dir=self.build_temp)\n\n # for loop\n\n # build_libraries ()\n\n\nclass fortran_compiler_base(CCompiler):\n\n vendor = None\n ver_match = None\n\n compiler_type = 'fortran'\n executables = {}\n \n def __init__(self,verbose=0,dry_run=0,force=0):\n # Default initialization. Constructors of derived classes MUST\n # call this function.\n CCompiler.__init__(self,verbose,dry_run,force)\n\n self.version = None\n \n self.f77_switches = ''\n self.f77_opt = ''\n self.f77_debug = ''\n \n self.f90_switches = ''\n self.f90_opt = ''\n self.f90_debug = ''\n \n #self.libraries = []\n #self.library_dirs = []\n\n if self.vendor is None:\n raise DistutilsInternalError,\\\n '%s must define vendor attribute'%(self.__class__)\n if self.ver_match is None:\n raise DistutilsInternalError,\\\n '%s must define ver_match attribute'%(self.__class__)\n\n def to_object(self,\n dirty_files,\n module_dirs=None,\n temp_dir=''):\n files = string.join(dirty_files)\n f90_files = get_f90_files(dirty_files)\n f77_files = get_f77_files(dirty_files)\n if f90_files != []:\n obj1 = self.f90_compile(f90_files,module_dirs,temp_dir = temp_dir)\n else:\n obj1 = []\n if f77_files != []:\n obj2 = self.f77_compile(f77_files, temp_dir = temp_dir)\n else:\n obj2 = []\n return obj1 + obj2\n\n def source_to_object_names(self,source_files, temp_dir=''):\n file_list = map(lambda x: os.path.basename(x),source_files)\n file_base_ext = map(lambda x: os.path.splitext(x),file_list)\n object_list = map(lambda x: x[0] +'.o',file_base_ext)\n object_files = map(lambda x,td=temp_dir: os.path.join(td,x),object_list)\n return object_files\n \n def source_and_object_pairs(self,source_files, temp_dir=''):\n object_files = self.source_to_object_names(source_files,temp_dir)\n file_pairs = zip(source_files,object_files)\n return file_pairs\n \n def f_compile(self,compiler,switches, source_files,\n module_dirs=None, temp_dir=''):\n\n pp_opts = gen_preprocess_options(self.macros,self.include_dirs)\n\n switches = switches + ' ' + string.join(pp_opts,' ')\n\n module_switch = self.build_module_switch(module_dirs)\n file_pairs = self.source_and_object_pairs(source_files,temp_dir)\n object_files = []\n for source,object in file_pairs:\n if distutils.dep_util.newer(source,object):\n cmd = compiler + ' ' + switches + ' '+\\\n module_switch + \\\n ' -c ' + source + ' -o ' + object \n print cmd\n failure = os.system(cmd)\n if failure:\n raise FortranCompileError, 'failure during compile' \n object_files.append(object)\n return object_files\n #return all object files to make sure everything is archived \n #return map(lambda x: x[1], file_pairs)\n\n def f90_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f90_switches, self.f90_opt))\n return self.f_compile(self.f90_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n def f77_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f77_switches, self.f77_opt))\n return self.f_compile(self.f77_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n\n def build_module_switch(self, module_dirs):\n return ''\n\n def create_static_lib(self, object_files, library_name,\n output_dir='', debug=None):\n lib_file = os.path.join(output_dir,'lib'+library_name+'.a')\n newer = distutils.dep_util.newer\n # This doesn't work -- no way to know if the file is in the archive\n #object_files = filter(lambda o,lib=lib_file:\\\n # distutils.dep_util.newer(o,lib),object_files)\n objects = string.join(object_files)\n if objects:\n cmd = 'ar -cur %s %s' % (lib_file,objects)\n print cmd\n os.system(cmd)\n cmd = 'ranlib %s ' % lib_file\n print cmd\n os.system(cmd)\n\n def build_library(self,library_name,source_list,module_dirs=None,\n temp_dir = ''):\n #make sure the temp directory exists before trying to build files\n import distutils.dir_util\n distutils.dir_util.mkpath(temp_dir)\n\n #this compiles the files\n object_list = self.to_object(source_list,\n module_dirs,\n temp_dir)\n\n # actually we need to use all the object file names here to\n # make sure the library is always built. It could occur that an\n # object file exists but hasn't been put in the archive. (happens\n # a lot when builds fail once and are restarted).\n object_list = self.source_to_object_names(source_list, temp_dir)\n\n if os.name == 'nt':\n # This is pure bunk...\n # Windows fails for long argument strings on the command line.\n # if objects is real long (> 2048 chars or so on my machine),\n # the command fails (cmd.exe /e:2048 on w2k)\n # for now we'll split linking into to steps which should work for\n objects = object_list[:]\n while objects:\n obj,objects = objects[:20],objects[20:]\n self.create_static_lib(obj,library_name,temp_dir)\n else:\n self.create_static_lib(object_list,library_name,temp_dir)\n\n def dummy_fortran_files(self):\n import tempfile \n d = tempfile.gettempdir()\n dummy_name = os.path.join(d,'__dummy.f')\n dummy = open(dummy_name,'w')\n dummy.write(\" subroutine dummy()\\n end\\n\")\n dummy.close()\n return (os.path.join(d,'__dummy.f'),os.path.join(d,'__dummy.o'))\n \n def is_available(self):\n return self.get_version()\n \n def get_version(self):\n \"\"\"Return the compiler version. If compiler is not available,\n return empty string.\"\"\"\n # XXX: Is there compilers that have no version? If yes,\n # this test will fail even if the compiler is available.\n if self.version is not None:\n # Finding version is expensive, so return previously found\n # version string.\n return self.version\n self.version = ''\n # works I think only for unix... \n #print 'command:', self.ver_cmd\n exit_status, out_text = run_command(self.ver_cmd)\n #print exit_status, out_text\n if not exit_status:\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n return self.version\n\n def get_libraries(self):\n return self.libraries\n def get_library_dirs(self):\n return self.library_dirs\n def get_extra_link_args(self):\n return []\n def get_runtime_library_dirs(self):\n return []\n def get_linker_so(self):\n \"\"\"\n If a compiler requires specific linker then return a list\n containing a linker executable name and linker options.\n Otherwise, return None.\n \"\"\"\n\n def __str__(self):\n return \"%s %s\" % (self.vendor, self.get_version())\n\n\nclass absoft_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Absoft'\n ver_match = r'FORTRAN 77 Compiler (?P[^\\s*,]*).*?Absoft Corp'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n # got rid of -B108 cause it was generating 2 underscores instead\n # of one on the newest version. Now we use -YEXT_SFX=_ to \n # specify the output format\n if os.name == 'nt':\n self.f90_switches = '-f fixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -Q100'\n self.f77_switches = '-N22 -N90 -N110'\n self.f77_opt = '-O -Q100'\n self.libraries = ['fio', 'fmath', 'f90math', 'COMDLG32']\n else:\n self.f90_switches = '-ffixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -B101' \n self.f77_switches = '-N22 -N90 -N110 -B108'\n self.f77_opt = '-O -B101'\n\n self.libraries = ['fio', 'f77math', 'f90math']\n \n try:\n dir = os.environ['ABSOFT'] \n self.library_dirs = [os.path.join(dir,'lib')]\n except KeyError:\n self.library_dirs = []\n\n self.ver_cmd = self.f77_compiler + ' -V -c %s -o %s' % \\\n self.dummy_fortran_files()\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -p' + mod\n return res\n\n def get_extra_link_args(self):\n return []\n # Couldn't get this to link for anything using gcc.\n #dr = \"c:\\\\Absoft62\\\\lib\"\n #libs = ['fio.lib', 'COMDLG32.lib','fmath.lib', 'f90math.lib','libcomdlg32.a' ] \n #libs = map(lambda x,dr=dr:os.path.join(dr,x),libs)\n #return libs\n\n\nclass sun_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Sun'\n #ver_match = r'f77: (?P[^\\s*,]*)'\n ver_match = r'f90: Sun (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -pic '\n self.f77_opt = ' -fast -dalign '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -fixed ' # ??? why fixed?\n self.f90_opt = ' -fast -dalign '\n\n self.ver_cmd = self.f90_compiler + ' -V'\n\n #self.libraries = ['f90', 'F77', 'M77', 'sunmath', 'm']\n self.libraries = ['fsu', 'F77', 'M77', 'sunmath', 'm']\n \n #threaded\n #self.libraries = ['f90', 'F77_mt', 'sunmath_mt', 'm', 'thread']\n #self.libraries = []\n self.library_dirs = self.find_lib_dir()\n #print 'sun:',self.library_dirs\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -M' + mod\n return res\n\n def find_lib_dir(self):\n library_dirs = []\n lib_match = r'### f90: Note: LD_RUN_PATH\\s*= '\\\n '(?P[^\\s.]*).*'\n cmd = self.f90_compiler + ' -dryrun dummy.f'\n exit_status, output = run_command(cmd)\n if not exit_status:\n libs = re.findall(lib_match,output)\n if libs:\n library_dirs = string.split(libs[0],':')\n self.get_version() # force version calculation\n compiler_home = os.path.dirname(library_dirs[0])\n library_dirs.append(os.path.join(compiler_home,\n self.version,'lib'))\n return library_dirs\n def get_runtime_library_dirs(self):\n return self.find_lib_dir()\n def get_extra_link_args(self):\n return ['-mimpure-text']\n\n\nclass mips_fortran_compiler(fortran_compiler_base):\n\n vendor = 'SGI'\n ver_match = r'MIPSpro Compilers: Version (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -n32 -KPIC '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -n32 -KPIC -fixedform ' # why fixed ???\n self.f90_opt = ' ' \n\n self.ver_cmd = self.f77_compiler + ' -version'\n \n self.libraries = ['fortran', 'ftn', 'm']\n self.library_dirs = self.find_lib_dir()\n\n\n\n def build_module_switch(self,module_dirs):\n res = ''\n return res \n def find_lib_dir(self):\n library_dirs = []\n return library_dirs\n def get_runtime_library_dirs(self):\n\treturn self.find_lib_dir() \n def get_extra_link_args(self):\n\treturn []\n\n\nclass gnu_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Gnu'\n ver_match = r'g77 version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if sys.platform == 'win32':\n self.libraries = ['gcc','g2c']\n self.library_dirs = self.find_lib_directories()\n else:\n # On linux g77 does not need lib_directories to be specified.\n self.libraries = ['g2c']\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n\n switches = ' -Wall -fno-second-underscore '\n\n if os.name != 'nt':\n switches = switches + ' -fpic '\n\n self.f77_switches = switches\n self.ver_cmd = self.f77_compiler + ' -v '\n\n self.f77_opt = self.get_opt()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 -funroll-loops '\n \n # only check for more optimization if g77 can handle\n # it.\n if self.get_version():\n if self.version[0]=='3': # is g77 3.x.x\n if cpu.is_AthlonK6():\n opt = opt + ' -march=k6 '\n elif cpu.is_AthlonK7():\n opt = opt + ' -march=athlon '\n if cpu.is_i686():\n opt = opt + ' -march=i686 '\n elif cpu.is_i586():\n opt = opt + ' -march=i586 '\n elif cpu.is_i486():\n opt = opt + ' -march=i486 '\n elif cpu.is_i386():\n opt = opt + ' -march=i386 '\n if cpu.is_Intel():\n opt = opt + ' -malign-double ' \n return opt\n \n def find_lib_directories(self):\n lib_dir = []\n match = r'Reading specs from (.*)/specs'\n\n # works I think only for unix... \n exit_status, out_text = run_command('g77 -v')\n if not exit_status:\n m = re.findall(match,out_text)\n if m:\n lib_dir= m #m[0] \n return lib_dir\n\n def get_linker_so(self):\n # win32 linking should be handled by standard linker\n if sys.platform != 'win32' and os.uname()[0] != 'Darwin':\n return [self.f77_compiler,'-shared']\n \n def f90_compile(self,source_files,module_files,temp_dir=''):\n raise DistutilsExecError, 'f90 not supported by Gnu'\n\n\n#http://developer.intel.com/software/products/compilers/f50/linux/\nclass intel_ia32_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Intel' # Intel(R) Corporation \n ver_match = r'Intel\\(R\\) Fortran Compiler for 32-bit applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'ifc'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -KPIC '\n\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n if cpu.has_fdiv_bug():\n switches = switches + ' -fdiv_check '\n if cpu.has_f00f_bug():\n switches = switches + ' -0f_check '\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -FI -w90 -w95 '\n\n self.f77_opt = self.f90_opt = self.get_opt()\n \n debug = ' -g -C '\n self.f77_debug = self.f90_debug = debug\n\n self.ver_cmd = self.f77_compiler+' -FI -V -c %s -o %s' %\\\n self.dummy_fortran_files()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 '\n if cpu.is_PentiumPro() or cpu.is_PentiumII():\n opt = opt + ' -tpp6 -xi '\n elif cpu.is_PentiumIII():\n opt = opt + ' -tpp6 '\n elif cpu.is_Pentium():\n opt = opt + ' -tpp5 '\n elif cpu.is_PentiumIV():\n opt = opt + ' -tpp7 -xW '\n elif cpu.has_mmx():\n opt = opt + ' -xM '\n return opt\n \n\n def get_linker_so(self):\n return [self.f77_compiler,'-shared']\n\n\nclass intel_itanium_fortran_compiler(intel_ia32_fortran_compiler):\n\n vendor = 'Itanium'\n ver_match = r'Intel\\(R\\) Fortran 90 Compiler Itanium\\(TM\\) Compiler for the Itanium\\(TM\\)-based applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n if fc is None:\n fc = 'efc'\n intel_ia32_fortran_compiler.__init__(self, fc, f90c)\n\n\nclass nag_fortran_compiler(fortran_compiler_base):\n\n vendor = 'NAG'\n ver_match = r'NAGWare Fortran 95 compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'f95'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ''\n debug = ' -g -gline -g90 -nan -C '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -fixed '\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -target=native '\n return opt\n\n def get_linker_so(self):\n return [self.f77_compiler,'-Wl,-shared']\n\n\nclass vast_fortran_compiler(fortran_compiler_base):\n\n vendor = 'VAST'\n ver_match = r'\\s*Pacific-Sierra Research vf90 (Personal|Professional)\\s+(?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n d,b = os.path.split(f90c)\n vf90 = os.path.join(d,'v'+b)\n self.ver_cmd = vf90+' -v '\n\n gnu = gnu_fortran_compiler(fc)\n if not gnu.is_available(): # VAST compiler requires g77.\n self.version = ''\n return\n if not self.is_available():\n return\n\n self.f77_switches = gnu.f77_switches\n self.f77_debug = gnu.f77_debug\n self.f77_opt = gnu.f77_opt \n\n # XXX: need f90 switches, debug, opt\n\n def get_linker_so(self):\n return [self.f90_compiler,'-shared']\n\nclass compaq_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Compaq'\n ver_match = r'Compaq Fortran (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'fort'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -assume no2underscore -nomixed_str_len_arg '\n debug = ' -g -check_bounds '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n # XXX: uncomment if required\n #self.libraries = ' -lUfor -lfor -lFutil -lcpml -lots -lc '\n\n # XXX: fix the version showing flag\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -align dcommons -arch host -assume bigarrays -assume nozsize -math_library fast -tune host '\n return opt\n\n def get_linker_so(self):\n # XXX: is -shared needed?\n return [self.f77_compiler,'-shared']\n\n\ndef match_extension(files,ext):\n match = re.compile(r'.*[.]('+ext+r')\\Z',re.I).match\n return filter(lambda x,match = match: match(x),files)\n\ndef get_f77_files(files):\n return match_extension(files,'for|f77|ftn|f')\n\ndef get_f90_files(files):\n return match_extension(files,'f90|f95')\n\ndef get_fortran_files(files):\n return match_extension(files,'f90|f95|for|f77|ftn|f')\n\ndef find_fortran_compiler(vendor = None, fc = None, f90c = None):\n fcompiler = None\n for compiler_class in all_compilers:\n if vendor is not None and vendor != compiler_class.vendor:\n continue\n print compiler_class\n compiler = compiler_class(fc,f90c)\n if compiler.is_available():\n fcompiler = compiler\n break\n return fcompiler\n\nall_compilers = [absoft_fortran_compiler,\n mips_fortran_compiler,\n sun_fortran_compiler,\n intel_ia32_fortran_compiler,\n intel_itanium_fortran_compiler,\n nag_fortran_compiler,\n compaq_fortran_compiler,\n vast_fortran_compiler,\n gnu_fortran_compiler,\n ]\n\nif __name__ == \"__main__\":\n show_compilers()\n", + "methods": [ + { + "name": "run_command", + "long_name": "run_command( command )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 1, + "token_count": 32, + "parameters": [ + "command" + ], + "start_line": 59, + "end_line": 64, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "show_compilers", + "long_name": "show_compilers( )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 3, + "token_count": 23, + "parameters": [], + "start_line": 68, + "end_line": 72, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "initialize_options", + "long_name": "initialize_options( self )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 1, + "token_count": 55, + "parameters": [ + "self" + ], + "start_line": 102, + "end_line": 114, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "finalize_options", + "long_name": "finalize_options( self )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self" + ], + "start_line": 118, + "end_line": 134, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "has_f_libraries", + "long_name": "has_f_libraries( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 138, + "end_line": 140, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "run", + "long_name": "run( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 142, + "end_line": 145, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "has_f_library", + "long_name": "has_f_library( self , name )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 32, + "parameters": [ + "self", + "name" + ], + "start_line": 149, + "end_line": 153, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "get_library_names", + "long_name": "get_library_names( self , name = None )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 8, + "token_count": 117, + "parameters": [ + "self", + "name" + ], + "start_line": 155, + "end_line": 175, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_names", + "long_name": "get_fcompiler_library_names( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 177, + "end_line": 182, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_dirs", + "long_name": "get_fcompiler_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 184, + "end_line": 189, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self , name = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 109, + "parameters": [ + "self", + "name" + ], + "start_line": 193, + "end_line": 210, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 214, + "end_line": 223, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "get_source_files", + "long_name": "get_source_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self" + ], + "start_line": 227, + "end_line": 238, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "build_libraries", + "long_name": "build_libraries( self , fortran_libraries )", + "filename": "build_flib.py", + "nloc": 25, + "complexity": 10, + "token_count": 181, + "parameters": [ + "self", + "fortran_libraries" + ], + "start_line": 240, + "end_line": 272, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 33, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , verbose = 0 , dry_run = 0 , force = 0 )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "verbose", + "dry_run", + "force" + ], + "start_line": 287, + "end_line": 310, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "to_object", + "long_name": "to_object( self , dirty_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 16, + "complexity": 3, + "token_count": 89, + "parameters": [ + "self", + "dirty_files", + "module_dirs", + "temp_dir" + ], + "start_line": 312, + "end_line": 327, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "source_to_object_names", + "long_name": "source_to_object_names( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 1, + "token_count": 89, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 329, + "end_line": 334, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "source_and_object_pairs", + "long_name": "source_and_object_pairs( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 336, + "end_line": 339, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f_compile", + "long_name": "f_compile( self , compiler , switches , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 4, + "token_count": 132, + "parameters": [ + "self", + "compiler", + "switches", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 341, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 365, + "end_line": 368, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f77_compile", + "long_name": "f77_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 370, + "end_line": 373, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 376, + "end_line": 377, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "create_static_lib", + "long_name": "create_static_lib( self , object_files , library_name , output_dir = '' , debug = None )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 2, + "token_count": 81, + "parameters": [ + "self", + "object_files", + "library_name", + "output_dir", + "debug" + ], + "start_line": 379, + "end_line": 393, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "build_library", + "long_name": "build_library( self , library_name , source_list , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self", + "library_name", + "source_list", + "module_dirs", + "temp_dir" + ], + "start_line": 395, + "end_line": 423, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "dummy_fortran_files", + "long_name": "dummy_fortran_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 1, + "token_count": 69, + "parameters": [ + "self" + ], + "start_line": 425, + "end_line": 432, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "is_available", + "long_name": "is_available( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 434, + "end_line": 435, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 4, + "token_count": 76, + "parameters": [ + "self" + ], + "start_line": 437, + "end_line": 455, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "get_libraries", + "long_name": "get_libraries( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 457, + "end_line": 458, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 459, + "end_line": 460, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 461, + "end_line": 462, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 463, + "end_line": 464, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 1, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 465, + "end_line": 470, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 472, + "end_line": 473, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 31, + "complexity": 5, + "token_count": 177, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 481, + "end_line": 519, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 39, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 521, + "end_line": 526, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 528, + "end_line": 529, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 98, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 543, + "end_line": 566, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 569, + "end_line": 574, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 99, + "parameters": [ + "self" + ], + "start_line": 576, + "end_line": 590, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 591, + "end_line": 592, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 593, + "end_line": 594, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 94, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 602, + "end_line": 620, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 624, + "end_line": 626, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 627, + "end_line": 629, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 630, + "end_line": 631, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 632, + "end_line": 633, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 642, + "end_line": 667, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 21, + "complexity": 10, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 669, + "end_line": 692, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "find_lib_directories", + "long_name": "find_lib_directories( self )", + "filename": "build_flib.py", + "nloc": 9, + "complexity": 3, + "token_count": 43, + "parameters": [ + "self" + ], + "start_line": 694, + "end_line": 704, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 3, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 706, + "end_line": 709, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "source_files", + "module_files", + "temp_dir" + ], + "start_line": 711, + "end_line": 712, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 22, + "complexity": 5, + "token_count": 140, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 721, + "end_line": 749, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 85, + "parameters": [ + "self" + ], + "start_line": 751, + "end_line": 765, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 768, + "end_line": 769, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 777, + "end_line": 780, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 788, + "end_line": 807, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 809, + "end_line": 811, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 813, + "end_line": 814, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 20, + "complexity": 5, + "token_count": 128, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 822, + "end_line": 846, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 850, + "end_line": 851, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 14, + "complexity": 3, + "token_count": 91, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 858, + "end_line": 880, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 882, + "end_line": 884, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 886, + "end_line": 888, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "match_extension", + "long_name": "match_extension( files , ext )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 44, + "parameters": [ + "files", + "ext" + ], + "start_line": 891, + "end_line": 893, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "get_f77_files", + "long_name": "get_f77_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 895, + "end_line": 896, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_f90_files", + "long_name": "get_f90_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 898, + "end_line": 899, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_fortran_files", + "long_name": "get_fortran_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 901, + "end_line": 902, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "find_fortran_compiler", + "long_name": "find_fortran_compiler( vendor = None , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 5, + "token_count": 59, + "parameters": [ + "vendor", + "fc", + "f90c" + ], + "start_line": 904, + "end_line": 914, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "run_command", + "long_name": "run_command( command )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 1, + "token_count": 32, + "parameters": [ + "command" + ], + "start_line": 59, + "end_line": 64, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "show_compilers", + "long_name": "show_compilers( )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 3, + "token_count": 23, + "parameters": [], + "start_line": 68, + "end_line": 72, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "initialize_options", + "long_name": "initialize_options( self )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 1, + "token_count": 55, + "parameters": [ + "self" + ], + "start_line": 102, + "end_line": 114, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "finalize_options", + "long_name": "finalize_options( self )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self" + ], + "start_line": 118, + "end_line": 134, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "has_f_libraries", + "long_name": "has_f_libraries( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 138, + "end_line": 140, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "run", + "long_name": "run( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 142, + "end_line": 145, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "has_f_library", + "long_name": "has_f_library( self , name )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 32, + "parameters": [ + "self", + "name" + ], + "start_line": 149, + "end_line": 153, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "get_library_names", + "long_name": "get_library_names( self , name = None )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 8, + "token_count": 117, + "parameters": [ + "self", + "name" + ], + "start_line": 155, + "end_line": 175, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_names", + "long_name": "get_fcompiler_library_names( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 177, + "end_line": 182, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_dirs", + "long_name": "get_fcompiler_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 184, + "end_line": 189, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self , name = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 109, + "parameters": [ + "self", + "name" + ], + "start_line": 193, + "end_line": 210, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 214, + "end_line": 223, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "get_source_files", + "long_name": "get_source_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self" + ], + "start_line": 227, + "end_line": 238, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "build_libraries", + "long_name": "build_libraries( self , fortran_libraries )", + "filename": "build_flib.py", + "nloc": 25, + "complexity": 10, + "token_count": 181, + "parameters": [ + "self", + "fortran_libraries" + ], + "start_line": 240, + "end_line": 272, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 33, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , verbose = 0 , dry_run = 0 , force = 0 )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "verbose", + "dry_run", + "force" + ], + "start_line": 287, + "end_line": 310, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "to_object", + "long_name": "to_object( self , dirty_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 16, + "complexity": 3, + "token_count": 89, + "parameters": [ + "self", + "dirty_files", + "module_dirs", + "temp_dir" + ], + "start_line": 312, + "end_line": 327, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "source_to_object_names", + "long_name": "source_to_object_names( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 1, + "token_count": 89, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 329, + "end_line": 334, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "source_and_object_pairs", + "long_name": "source_and_object_pairs( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 336, + "end_line": 339, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f_compile", + "long_name": "f_compile( self , compiler , switches , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 4, + "token_count": 132, + "parameters": [ + "self", + "compiler", + "switches", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 341, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 365, + "end_line": 368, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f77_compile", + "long_name": "f77_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 370, + "end_line": 373, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 376, + "end_line": 377, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "create_static_lib", + "long_name": "create_static_lib( self , object_files , library_name , output_dir = '' , debug = None )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 2, + "token_count": 81, + "parameters": [ + "self", + "object_files", + "library_name", + "output_dir", + "debug" + ], + "start_line": 379, + "end_line": 393, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "build_library", + "long_name": "build_library( self , library_name , source_list , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self", + "library_name", + "source_list", + "module_dirs", + "temp_dir" + ], + "start_line": 395, + "end_line": 423, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "dummy_fortran_files", + "long_name": "dummy_fortran_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 1, + "token_count": 69, + "parameters": [ + "self" + ], + "start_line": 425, + "end_line": 432, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "is_available", + "long_name": "is_available( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 434, + "end_line": 435, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 10, + "complexity": 4, + "token_count": 66, + "parameters": [ + "self" + ], + "start_line": 437, + "end_line": 455, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "get_libraries", + "long_name": "get_libraries( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 457, + "end_line": 458, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 459, + "end_line": 460, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 461, + "end_line": 462, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 463, + "end_line": 464, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 1, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 465, + "end_line": 470, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 472, + "end_line": 473, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 31, + "complexity": 5, + "token_count": 177, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 481, + "end_line": 519, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 39, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 521, + "end_line": 526, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 528, + "end_line": 529, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 98, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 543, + "end_line": 566, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 569, + "end_line": 574, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 99, + "parameters": [ + "self" + ], + "start_line": 576, + "end_line": 590, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 591, + "end_line": 592, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 593, + "end_line": 594, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 94, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 602, + "end_line": 620, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 624, + "end_line": 626, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 627, + "end_line": 629, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 630, + "end_line": 631, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 632, + "end_line": 633, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 641, + "end_line": 665, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 21, + "complexity": 10, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 667, + "end_line": 690, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "find_lib_directories", + "long_name": "find_lib_directories( self )", + "filename": "build_flib.py", + "nloc": 9, + "complexity": 3, + "token_count": 43, + "parameters": [ + "self" + ], + "start_line": 692, + "end_line": 702, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 3, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 704, + "end_line": 707, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "source_files", + "module_files", + "temp_dir" + ], + "start_line": 709, + "end_line": 710, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 22, + "complexity": 5, + "token_count": 140, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 719, + "end_line": 747, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 85, + "parameters": [ + "self" + ], + "start_line": 749, + "end_line": 763, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 766, + "end_line": 767, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 775, + "end_line": 778, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 786, + "end_line": 805, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 807, + "end_line": 809, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 811, + "end_line": 812, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 20, + "complexity": 5, + "token_count": 128, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 820, + "end_line": 844, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 848, + "end_line": 849, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 14, + "complexity": 3, + "token_count": 91, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 856, + "end_line": 878, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 880, + "end_line": 882, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 884, + "end_line": 886, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "match_extension", + "long_name": "match_extension( files , ext )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 44, + "parameters": [ + "files", + "ext" + ], + "start_line": 889, + "end_line": 891, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "get_f77_files", + "long_name": "get_f77_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 893, + "end_line": 894, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_f90_files", + "long_name": "get_f90_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 896, + "end_line": 897, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_fortran_files", + "long_name": "get_fortran_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 899, + "end_line": 900, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "find_fortran_compiler", + "long_name": "find_fortran_compiler( vendor = None , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 5, + "token_count": 59, + "parameters": [ + "vendor", + "fc", + "f90c" + ], + "start_line": 902, + "end_line": 912, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + } + ], + "changed_methods": [ + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 4, + "token_count": 76, + "parameters": [ + "self" + ], + "start_line": 437, + "end_line": 455, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 642, + "end_line": 667, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + } + ], + "nloc": 662, + "complexity": 171, + "token_count": 3872, + "diff_parsed": { + "added": [ + " print 'command:', self.ver_cmd", + " print exit_status, out_text", + " #ver_match = r'g77 version (?P[^\\s*]*)'", + " ver_match = r'GNU Fortran (?P[^\\s*]*)'", + "", + " #self.ver_cmd = self.f77_compiler + ' -v '", + " self.ver_cmd = self.f77_compiler + ' --version'" + ], + "deleted": [ + " #print 'command:', self.ver_cmd", + " #print exit_status, out_text", + " ver_match = r'g77 version (?P[^\\s*]*)'", + "", + " self.ver_cmd = self.f77_compiler + ' -v '" + ] + } + } + ] + }, + { + "hash": "b76d86fea40b131d61fe110acd4857b97a5a5feb", + "msg": "fixed bug in auto_test that prevented it from detecting updates on scipy_snapshot\nadded a check to see it the environment DISPLAY variable was set before running\nthe xinfo stuff in xplt. It was causing errors on telnet sessions that didn't\nhave a display present.", + "author": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "committer": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "author_date": "2002-05-03T04:12:12+00:00", + "author_timezone": 0, + "committer_date": "2002-05-03T04:12:12+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "e0403fd806df19a20b1d73d9efe48b3f550f0b92" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 6, + "insertions": 8, + "lines": 14, + "files": 1, + "dmm_unit_size": null, + "dmm_unit_complexity": null, + "dmm_unit_interfacing": null, + "modified_files": [ + { + "old_path": "scipy_distutils/auto_test.py", + "new_path": "scipy_distutils/auto_test.py", + "filename": "auto_test.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -433,7 +433,7 @@ def local_source_up_to_date(self):\n file_time = os.stat(file)[stat.ST_MTIME] \n fyear,fmonth,fday = time.localtime(file_time)[:3]\n year,month,day = time.localtime()[:3]\n- if year == year and month == month and day == day:\n+ if fyear == year and fmonth == month and fday == day:\n up_to_date = 1\n self.logger.info(\"Repository file up to date: %s\" % file)\n except OSError, msg:\n@@ -753,8 +753,8 @@ def full_scipy_build(build_dir = '.',\n \n if __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n- level = 1\n- \"\"\"\n+ level = 10\n+\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.2.1',\n@@ -762,6 +762,7 @@ def full_scipy_build(build_dir = '.',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n+ \"\"\"\n # an older python\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n@@ -779,9 +780,10 @@ def full_scipy_build(build_dir = '.',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n-\n+ \"\"\"\n # This fails because multiarray doesn't have \n # arange defined.\n+ \"\"\"\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n@@ -797,7 +799,7 @@ def full_scipy_build(build_dir = '.',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n- \"\"\"\n+\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n@@ -805,4 +807,4 @@ def full_scipy_build(build_dir = '.',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n-\n+ \"\"\"\n", + "added_lines": 8, + "deleted_lines": 6, + "source_code": "\"\"\" Auto test tools for SciPy\n\n Do not run this as root! If you enter something\n like /usr as your test directory, it'll delete\n /usr/bin, usr/lib, etc. So don't do it!!!\n \n \n Author: Eric Jones (eric@enthought.com)\n\"\"\"\nfrom distutils import file_util\nfrom distutils import dir_util\nfrom distutils.errors import DistutilsFileError\n#import tarfile\nimport sys, os, stat, time\nimport gzip\nimport tempfile, cStringIO\nimport urllib\nimport logging\n\nif sys.platform == 'cygwin':\n local_repository = \"/cygdrive/i/tarballs\"\nelif sys.platform == 'win32': \n local_repository = \"i:\\tarballs\"\nelse:\n local_repository = \"/home/shared/tarballs\"\n\nlocal_mail_server = \"enthought.com\"\n\npython_ftp_url = \"ftp://ftp.python.org/pub/python\"\nnumeric_url = \"http://prdownloads.sourceforge.net/numpy\"\nf2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\nscipy_url = \"ftp://www.scipy.org/pub\"\nblas_url = \"http://www.netlib.org/blas\"\nlapack_url = \"http://www.netlib.org/lapack\"\n#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\natlas_url = \"http://www.scipy.org/Members/eric\"\n\n\n#-----------------------------------------------------------------------------\n# Generic installation class. \n# built to handle downloading/untarring/building/installing arbitrary software\n#-----------------------------------------------------------------------------\n\nclass package_installation: \n def __init__(self,version='', dst_dir = '.',\n logger = None, python_exe='python'):\n #---------------------------------------------------------------------\n # These should be defined in sub-class before calling this\n # constructor\n #---------------------------------------------------------------------\n # \n #self.package_url -- The name of the url where tarball can be found.\n #self.package_base_name -- The base name of the source tarball.\n #self.package_dir_name -- Top level directory of unpacked tarball\n #self.tarball_suffix -- usually tar.gz or .tgz\n #self.build_type -- 'make' or 'setup' for makefile or python setup file\n \n # Version of the software package.\n self.version = version\n\n # Only used by packages built with setup.py\n self.python_exe = python_exe\n \n # Directory where package is unpacked/built/installed\n self.dst_dir = os.path.abspath(dst_dir) \n \n if not logger:\n self.logger = logging\n else:\n self.logger = logger \n\n # make sure the destination exists\n make_dir(self.dst_dir,logger=self.logger)\n\n # Construct any derived names built from the above names.\n self.init_names()\n \n def init_names(self): \n self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)\n self.tarball = self.package_base_name + '.' + self.tarball_suffix\n\n def get_source(self):\n \"\"\" Grab the source tarball from a repository.\n \n Try a local repository first. If the file isn't found,\n grab it from an ftp site.\n \"\"\"\n local_found = 0\n if self.local_source_up_to_date():\n try:\n self.get_source_local()\n local_found = 1 \n except DistutilsFileError:\n pass\n \n if not local_found:\n self.get_source_ftp()\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n return 1\n \n def get_source_local(self):\n \"\"\" Grab the requested tarball from a local repository of source\n tarballs. If it doesn't exist, an error is raised.\n \"\"\"\n file = os.path.join(local_repository,self.tarball) \n dst_file = os.path.join(self.dst_dir,self.tarball)\n self.logger.info(\"Searching local repository for %s\" % file)\n try:\n copy_file(file,dst_file,self.logger)\n except DistutilsFileError, msg:\n self.logger.info(\"Not found:\",msg)\n raise\n \n def get_source_ftp(self):\n \"\"\" Grab requested tarball from a ftp site specified as a url. \n \"\"\"\n url = '/'.join([self.package_url,self.tarball])\n \n self.logger.info('Opening: %s' % url)\n f = urllib.urlopen(url)\n self.logger.info('Downloading: this may take a while')\n contents = f.read(-1)\n f.close()\n self.logger.info('Finished download (size=%d)' % len(contents))\n \n output_file = os.path.join(self.dst_dir,self.tarball)\n write_file(output_file,contents,self.logger)\n\n # Put file in local repository so we don't have to download it again.\n self.logger.info(\"Caching file in repository\" )\n src_file = output_file\n repos_file = os.path.join(local_repository,self.tarball) \n copy_file(src_file,repos_file,self.logger)\n\n def unpack_source(self,sub_dir = None):\n \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir\n \"\"\" \n tarfile = os.path.join(self.dst_dir,self.tarball)\n old_dir = None\n \n # copy and move into sub directory if it is specified.\n if sub_dir:\n dst_dir = os.path.join(self.dst_dir,sub_dir)\n dst_file = os.path.join(dst_dir,self.tarball)\n copy_file(tarfile,dst_file)\n change_dir(dst_dir,self.logger)\n try:\n try:\n # occasionally the tarball is not zipped, try this first.\n untar_file(self.tarball,self.dst_dir,\n self.logger,silent_failure=1)\n except:\n # otherwise, handle the fact that it is zipped \n dst = os.path.join(self.dst_dir,'tmp.tar') \n decompress_file(tarfile,dst,self.logger) \n untar_file(dst,self.dst_dir,self.logger)\n remove_file(dst,self.logger)\n finally:\n if old_dir:\n unchange_dir(self.logger)\n\n #def auto_configure(self):\n # cmd = os.path.join('.','configure')\n # try:\n # text = run_command(cmd,self.package_dir,self.logger,log_output=0)\n # except ValueError, e:\n # status, text = e\n # self.logger.exception('Configuration Error:\\n'+text)\n def auto_configure(self):\n cmd = os.path.join('.','configure')\n text = run_command(cmd,self.package_dir,self.logger)\n \n def build_with_make(self):\n cmd = 'make'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, prefix = None):\n if prefix is None:\n prefix = os.path.abspath(self.dst_dir)\n cmd = 'make install prefix=%s' % prefix\n text = run_command(cmd,self.package_dir,self.logger)\n \n def python_setup(self):\n cmd = self.python_exe + ' setup.py install'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def _make(self,**kw):\n \"\"\" This generally needs to be overrridden in the derived class,\n but this will suffice for the standard configure/make process. \n \"\"\"\n self.logger.info(\"### Begin Configure: %s\" % self.package_base_name)\n self.auto_configure()\n self.logger.info(\"### Finished Configure: %s\" % self.package_base_name)\n self.logger.info(\"### Begin Build: %s\" % self.package_base_name)\n self.build_with_make()\n self.logger.info(\"### Finished Build: %s\" % self.package_base_name)\n self.logger.info(\"### Begin Install: %s\" % self.package_base_name)\n self.install_with_make()\n self.logger.info(\"### Finished Install: %s\" % self.package_base_name)\n\n def install(self):\n self.logger.info('####### Building: %s' % self.package_base_name)\n self.logger.info(' Version: %s' % self.version)\n self.logger.info(' Url: %s' % self.package_url)\n self.logger.info(' Install dir: %s' % self.dst_dir)\n self.logger.info(' Package dir: %s' % self.package_dir)\n self.logger.info(' Suffix: %s' % self.tarball_suffix)\n self.logger.info(' Build type: %s' % self.build_type)\n\n self.logger.info(\"### Begin Get Source: %s\" % self.package_base_name)\n self.get_source()\n self.unpack_source()\n self.logger.info(\"### Finished Get Source: %s\" % self.package_base_name)\n\n if self.build_type == 'setup':\n self.python_setup()\n else: \n self._make()\n self.logger.info('####### Finished Building: %s' % self.package_base_name) \n \n#-----------------------------------------------------------------------------\n# Installation class for Python itself.\n#-----------------------------------------------------------------------------\n \nclass python_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Python. \n self.package_base_name = 'Python-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = '/'.join([python_ftp_url,version])\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def write_install_config(self): \n \"\"\" Make doesn't seem to install scripts in the correct places.\n \n Writing this to the python directory will solve the problem.\n [install_script]\n install-dir= \n \"\"\"\n self.logger.info('### Writing Install Script Hack')\n text = \"[install_scripts]\\n\"\\\n \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n file = os.path.join(self.package_dir,'setup.cfg') \n write_file(file,text,self.logger,mode='w')\n self.logger.info('### Finished writing Install Script Hack')\n\n def install_with_make(self):\n \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n file is written to force installation in the correct place.\n \"\"\" \n self.write_install_config()\n package_installation.install_with_make(self)\n\n def get_exe_name(self):\n pyname = os.path.join('.','python')\n cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"\n text = run_command(cmd,self.package_dir,self.logger)\n exe = os.path.join(self.dst_dir,'bin','python'+text)\n return exe\n\n#-----------------------------------------------------------------------------\n# Installation class for Blas.\n#-----------------------------------------------------------------------------\n\nclass blas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for for \"slow\" blas\n self.package_base_name = 'blas'\n self.package_dir_name = 'BLAS'\n self.package_url = blas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def unpack_source(self,subdir=None):\n \"\"\" Dag. blas.tgz doesn't have directory information -- its\n just a tar ball of fortran source code. untar it in the\n BLAS directory\n \"\"\"\n package_installation.unpack_source(self,self.package_dir_name)\n \n def auto_configure(self):\n # nothing to do.\n pass\n def build_with_make(self, **kw):\n libname = 'blas_LINUX.a'\n cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over. \n src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n self.logger.info(\"Installing blas\")\n copy_file(src_file,dst_file,self.logger)\n \n#-----------------------------------------------------------------------------\n# Installation class for Lapack.\n#-----------------------------------------------------------------------------\n\nclass lapack_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Lapack 3.0 + updates \n self.package_base_name = 'lapack'\n self.package_dir_name = 'LAPACK'\n self.package_url = lapack_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self):\n # perhaps this should actually override auto_conifgure\n # before make, we need to copy the appropriate setup file in.\n # should work anywhere g77 works...\n make_inc = 'make.inc.' + self.platform\n src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n dst_file = os.path.join(self.package_dir,'make.inc')\n copy_file(src_file,dst_file,self.logger)\n \n def build_with_make(self, **kw):\n cmd = 'make install lapacklib'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over.\n src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','liblapack.a') \n copy_file(src_file,dst_file,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for Numeric\n#-----------------------------------------------------------------------------\n\nclass numeric_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'Numeric-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = numeric_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for f2py\n#-----------------------------------------------------------------------------\n\nclass f2py_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Typical file format: F2PY-2.13.175-1250.tar.gz\n self.package_base_name = 'F2PY-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = f2py_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for Atlas.\n# This is a binary install *NOT* a source install.\n# The source install is a pain to automate.\n#-----------------------------------------------------------------------------\n\nclass atlas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n #self.package_base_name = 'atlas' + version\n #self.package_dir_name = 'ATLAS'\n self.package_base_name = 'atlas-RH7.1-PIII'\n self.package_dir_name = 'atlas'\n self.package_url = atlas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self,**kw):\n pass\n def build_with_make(self,**kw):\n pass\n def install_with_make(self, **kw):\n # just copy the tree over.\n dst = os.path.join(self.dst_dir,'lib','atlas')\n self.logger.info(\"Installing Atlas\")\n copy_tree(self.package_dir,dst,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for scipy\n#-----------------------------------------------------------------------------\n\nclass scipy_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'scipy_snapshot'\n self.package_dir_name = 'scipy'\n self.package_url = scipy_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'setup'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n file = os.path.join(local_repository,self.tarball)\n up_to_date = 0\n try:\n file_time = os.stat(file)[stat.ST_MTIME] \n fyear,fmonth,fday = time.localtime(file_time)[:3]\n year,month,day = time.localtime()[:3]\n if fyear == year and fmonth == month and fday == day:\n up_to_date = 1\n self.logger.info(\"Repository file up to date: %s\" % file)\n except OSError, msg:\n pass\n return up_to_date\n \n#-----------------------------------------------------------------------------\n# Utilities\n#-----------------------------------------------------------------------------\n\n\n#if os.name == 'nt':\n# def exec_command(command):\n# \"\"\" not sure how to get exit status on nt. \"\"\"\n# in_pipe,out_pipe = os.popen4(command)\n# in_pipe.close()\n# text = out_pipe.read()\n# return 0, text\n#else:\n# import commands\n# exec_command = commands.getstatusoutput\n \n# This may not work on Win98... The above stuff was to handle these machines.\nimport commands\nexec_command = commands.getstatusoutput\n\ndef copy_file(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying %s->%s\" % (src,dst)) \n try:\n file_util.copy_file(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef copy_tree(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying directory tree %s->%s\" % (src,dst)) \n try:\n dir_util.copy_tree(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef remove_tree(directory,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Removing directory tree %s\" % directory) \n try:\n dir_util.remove_tree(directory)\n except Exception, e: \n logger.exception(\"Remove failed: %s\" % e) \n raise\n\ndef remove_file(file,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Remove file %s\" % file) \n try:\n os.remove(file)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef write_file(file,contents,logger=None,mode='wb'):\n if not logger:\n logger = logging\n logger.info('Write file: %s' % file)\n try:\n new_file = open(file,mode)\n new_file.write(contents)\n new_file.close()\n except Exception, e: \n logger.exception(\"Write failed\") \n raise\n\ndef make_dir(name,logger=None):\n if not logger:\n logger = logging\n logger.info('Make directory: %s' % name)\n try: \n dir_util.mkpath(os.path.abspath(name))\n except Exception, e: \n logger.exception(\"Make Directory failed\") \n raise\n\n# I know, I know...\nold_dir = []\n\ndef change_dir(d, logger = None):\n if not logger:\n logger = logging\n global old_dir \n cwd = os.getcwd() \n old_dir.append(cwd)\n d = os.path.abspath(d)\n if d != old_dir[-1]:\n logger.info(\"Change directory: %s\" % d) \n try:\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n #if d == '.':\n # import sys,traceback\n # f = sys._getframe()\n # traceback.print_stack(f)\n\ndef unchange_dir(logger=None):\n if not logger:\n logger = logging \n global old_dir\n try:\n cwd = os.getcwd()\n d = old_dir.pop(-1) \n try:\n if d != cwd:\n logger.info(\"Change directory : %s\" % d)\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n except IndexError:\n logger.exception(\"Change directory failed\")\n \ndef decompress_file(src,dst,logger = None):\n if not logger:\n logger = logging\n logger.info(\"Upacking %s->%s\" % (src,dst))\n try:\n f = gzip.open(src,'rb')\n contents = f.read(-1)\n f = open(dst, 'wb')\n f.write(contents)\n except Exception, e: \n logger.exception(\"Unpack failed\")\n raise \n\n \ndef untar_file(file,dst_dir='.',logger = None,silent_failure = 0): \n if not logger:\n logger = logging\n logger.info(\"Untarring file: %s\" % (file))\n try:\n run_command('tar -xf ' + file,directory = dst_dir,\n logger=logger, silent_failure = silent_failure)\n except Exception, e:\n if not silent_failure: \n logger.exception(\"Untar failed\")\n raise \n\ndef unpack_file(file,logger = None):\n \"\"\" equivalent to 'tar -xzvf file'\n \"\"\"\n dst = 'tmp.tar'\n decompress_file(file,dst,logger) \n untar_file(dst.logger)\n remove_file(dst,logger) \n\n\ndef run_command(cmd,directory='.',logger=None,silent_failure = 0):\n if not logger:\n logger = logging\n change_dir(directory,logger) \n try: \n msg = 'Running: %s' % cmd\n logger.info(msg) \n status,text = exec_command(cmd)\n if status and silent_failure:\n msg = '(failed silently)'\n logger.info(msg) \n if status and text and not silent_failure:\n logger.error('Command Failed (status=%d)\\n'% status +text)\n finally:\n unchange_dir(logger)\n if status:\n raise ValueError, (status,text)\n return text \n\ndef mail_report(from_addr,to_addr,subject,mail_server,\n build_log, test_results,info):\n \n msg = ''\n msg = msg + 'To: %s\\n' % to_addr\n msg = msg + 'Subject: %s\\n' % subject\n msg = msg + '\\r\\n\\r\\n'\n\n for k,v in info.items(): \n msg = msg + '%s: %s\\n' % (k,v)\n msg = msg + test_results + '\\n'\n msg = msg + '-----------------------------\\n' \n msg = msg + '-------- BUILD LOG -------\\n' \n msg = msg + '-----------------------------\\n' \n msg = msg + build_log\n print msg\n \n # mail results\n import smtplib \n server = smtplib.SMTP(mail_server) \n server.sendmail(from_addr, to_addr, msg)\n server.quit()\n \n\ndef full_scipy_build(build_dir = '.',\n test_level = 10,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot'):\n \n # for now the atlas version is ignored. Only the \n # binaries for RH are supported at the moment.\n\n build_info = {'python_version' : python_version,\n 'test_level' : test_level,\n 'numeric_version': numeric_version,\n 'f2py_version' : f2py_version,\n 'atlas_version' : atlas_version,\n 'scipy_version' : scipy_version}\n \n dst_dir = os.path.join(build_dir,sys.platform)\n\n logger = logging.Logger(\"SciPy Test\")\n fmt = logging.Formatter(logging.BASIC_FORMAT)\n log_stream = cStringIO.StringIO()\n stream_handler = logging.StreamHandler(log_stream)\n stream_handler.setFormatter(fmt)\n logger.addHandler(stream_handler)\n # also write to stderr\n stderr = logging.StreamHandler()\n stderr.setFormatter(fmt)\n logger.addHandler(stderr)\n\n try:\n try: \n \n # before doing anything, we need to wipe the \n # /bin, /lib, /man, and /include directories\n # in dst_dir. Don't run as root. \n make_dir(dst_dir,logger=logger) \n change_dir(dst_dir , logger)\n for d in ['bin','lib','man','include']:\n try: remove_tree(d, logger)\n except OSError: pass \n unchange_dir(logger)\n \n python = python_installation(version=python_version,\n logger = logger,\n dst_dir = dst_dir)\n python.install()\n \n python_name = python.get_exe_name()\n \n numeric = numeric_installation(version=numeric_version,\n dst_dir = dst_dir,\n logger = logger,\n python_exe=python_name)\n numeric.install()\n \n f2py = f2py_installation(version=f2py_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n f2py.install() \n \n # download files don't have a version specified \n #lapack = lapack_installation(version='',\n # dst_dir = dst_dir\n # python_exe=python_name)\n #lapack.install() \n \n # download files don't have a version specified \n #blas = blas_installation(version='',\n # logger = logger,\n # dst_dir = dst_dir,\n # python_exe=python_name)\n #blas.install() \n \n # ATLAS\n atlas = atlas_installation(version=atlas_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n atlas.install()\n \n # version not currently used -- need to fix this.\n scipy = scipy_installation(version=scipy_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n scipy.install() \n \n # The change to tmp makes sure there isn't a scipy directory in \n # the local scope.\n # All tests are run.\n logger.info('Beginning Test')\n cmd = python_name +' -c \"import sys,scipy;suite=scipy.test(%d);\"'\\\n % test_level\n test_results = run_command(cmd, logger=logger,\n directory = tempfile.gettempdir())\n build_info['results'] = 'test completed (check below for pass/fail)'\n except Exception, msg:\n test_results = ''\n build_info['results'] = 'build failed: %s' % msg\n logger.exception('Build failed')\n finally: \n to_addr = \"scipy-testlog@scipy.org\"\n from_addr = \"scipy-test@enthought.com\"\n subject = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n numeric_version,scipy_version) \n build_log = log_stream.getvalue()\n mail_report(from_addr,to_addr,subject,local_mail_server,\n build_log,test_results,build_info)\n\nif __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n level = 10\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n \"\"\"\n # an older python\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older numeric\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.3',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n \"\"\"\n # This fails because multiarray doesn't have \n # arange defined.\n \"\"\"\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '19.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '18.4.1',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n \"\"\"\n", + "source_code_before": "\"\"\" Auto test tools for SciPy\n\n Do not run this as root! If you enter something\n like /usr as your test directory, it'll delete\n /usr/bin, usr/lib, etc. So don't do it!!!\n \n \n Author: Eric Jones (eric@enthought.com)\n\"\"\"\nfrom distutils import file_util\nfrom distutils import dir_util\nfrom distutils.errors import DistutilsFileError\n#import tarfile\nimport sys, os, stat, time\nimport gzip\nimport tempfile, cStringIO\nimport urllib\nimport logging\n\nif sys.platform == 'cygwin':\n local_repository = \"/cygdrive/i/tarballs\"\nelif sys.platform == 'win32': \n local_repository = \"i:\\tarballs\"\nelse:\n local_repository = \"/home/shared/tarballs\"\n\nlocal_mail_server = \"enthought.com\"\n\npython_ftp_url = \"ftp://ftp.python.org/pub/python\"\nnumeric_url = \"http://prdownloads.sourceforge.net/numpy\"\nf2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\nscipy_url = \"ftp://www.scipy.org/pub\"\nblas_url = \"http://www.netlib.org/blas\"\nlapack_url = \"http://www.netlib.org/lapack\"\n#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\natlas_url = \"http://www.scipy.org/Members/eric\"\n\n\n#-----------------------------------------------------------------------------\n# Generic installation class. \n# built to handle downloading/untarring/building/installing arbitrary software\n#-----------------------------------------------------------------------------\n\nclass package_installation: \n def __init__(self,version='', dst_dir = '.',\n logger = None, python_exe='python'):\n #---------------------------------------------------------------------\n # These should be defined in sub-class before calling this\n # constructor\n #---------------------------------------------------------------------\n # \n #self.package_url -- The name of the url where tarball can be found.\n #self.package_base_name -- The base name of the source tarball.\n #self.package_dir_name -- Top level directory of unpacked tarball\n #self.tarball_suffix -- usually tar.gz or .tgz\n #self.build_type -- 'make' or 'setup' for makefile or python setup file\n \n # Version of the software package.\n self.version = version\n\n # Only used by packages built with setup.py\n self.python_exe = python_exe\n \n # Directory where package is unpacked/built/installed\n self.dst_dir = os.path.abspath(dst_dir) \n \n if not logger:\n self.logger = logging\n else:\n self.logger = logger \n\n # make sure the destination exists\n make_dir(self.dst_dir,logger=self.logger)\n\n # Construct any derived names built from the above names.\n self.init_names()\n \n def init_names(self): \n self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)\n self.tarball = self.package_base_name + '.' + self.tarball_suffix\n\n def get_source(self):\n \"\"\" Grab the source tarball from a repository.\n \n Try a local repository first. If the file isn't found,\n grab it from an ftp site.\n \"\"\"\n local_found = 0\n if self.local_source_up_to_date():\n try:\n self.get_source_local()\n local_found = 1 \n except DistutilsFileError:\n pass\n \n if not local_found:\n self.get_source_ftp()\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n return 1\n \n def get_source_local(self):\n \"\"\" Grab the requested tarball from a local repository of source\n tarballs. If it doesn't exist, an error is raised.\n \"\"\"\n file = os.path.join(local_repository,self.tarball) \n dst_file = os.path.join(self.dst_dir,self.tarball)\n self.logger.info(\"Searching local repository for %s\" % file)\n try:\n copy_file(file,dst_file,self.logger)\n except DistutilsFileError, msg:\n self.logger.info(\"Not found:\",msg)\n raise\n \n def get_source_ftp(self):\n \"\"\" Grab requested tarball from a ftp site specified as a url. \n \"\"\"\n url = '/'.join([self.package_url,self.tarball])\n \n self.logger.info('Opening: %s' % url)\n f = urllib.urlopen(url)\n self.logger.info('Downloading: this may take a while')\n contents = f.read(-1)\n f.close()\n self.logger.info('Finished download (size=%d)' % len(contents))\n \n output_file = os.path.join(self.dst_dir,self.tarball)\n write_file(output_file,contents,self.logger)\n\n # Put file in local repository so we don't have to download it again.\n self.logger.info(\"Caching file in repository\" )\n src_file = output_file\n repos_file = os.path.join(local_repository,self.tarball) \n copy_file(src_file,repos_file,self.logger)\n\n def unpack_source(self,sub_dir = None):\n \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir\n \"\"\" \n tarfile = os.path.join(self.dst_dir,self.tarball)\n old_dir = None\n \n # copy and move into sub directory if it is specified.\n if sub_dir:\n dst_dir = os.path.join(self.dst_dir,sub_dir)\n dst_file = os.path.join(dst_dir,self.tarball)\n copy_file(tarfile,dst_file)\n change_dir(dst_dir,self.logger)\n try:\n try:\n # occasionally the tarball is not zipped, try this first.\n untar_file(self.tarball,self.dst_dir,\n self.logger,silent_failure=1)\n except:\n # otherwise, handle the fact that it is zipped \n dst = os.path.join(self.dst_dir,'tmp.tar') \n decompress_file(tarfile,dst,self.logger) \n untar_file(dst,self.dst_dir,self.logger)\n remove_file(dst,self.logger)\n finally:\n if old_dir:\n unchange_dir(self.logger)\n\n #def auto_configure(self):\n # cmd = os.path.join('.','configure')\n # try:\n # text = run_command(cmd,self.package_dir,self.logger,log_output=0)\n # except ValueError, e:\n # status, text = e\n # self.logger.exception('Configuration Error:\\n'+text)\n def auto_configure(self):\n cmd = os.path.join('.','configure')\n text = run_command(cmd,self.package_dir,self.logger)\n \n def build_with_make(self):\n cmd = 'make'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, prefix = None):\n if prefix is None:\n prefix = os.path.abspath(self.dst_dir)\n cmd = 'make install prefix=%s' % prefix\n text = run_command(cmd,self.package_dir,self.logger)\n \n def python_setup(self):\n cmd = self.python_exe + ' setup.py install'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def _make(self,**kw):\n \"\"\" This generally needs to be overrridden in the derived class,\n but this will suffice for the standard configure/make process. \n \"\"\"\n self.logger.info(\"### Begin Configure: %s\" % self.package_base_name)\n self.auto_configure()\n self.logger.info(\"### Finished Configure: %s\" % self.package_base_name)\n self.logger.info(\"### Begin Build: %s\" % self.package_base_name)\n self.build_with_make()\n self.logger.info(\"### Finished Build: %s\" % self.package_base_name)\n self.logger.info(\"### Begin Install: %s\" % self.package_base_name)\n self.install_with_make()\n self.logger.info(\"### Finished Install: %s\" % self.package_base_name)\n\n def install(self):\n self.logger.info('####### Building: %s' % self.package_base_name)\n self.logger.info(' Version: %s' % self.version)\n self.logger.info(' Url: %s' % self.package_url)\n self.logger.info(' Install dir: %s' % self.dst_dir)\n self.logger.info(' Package dir: %s' % self.package_dir)\n self.logger.info(' Suffix: %s' % self.tarball_suffix)\n self.logger.info(' Build type: %s' % self.build_type)\n\n self.logger.info(\"### Begin Get Source: %s\" % self.package_base_name)\n self.get_source()\n self.unpack_source()\n self.logger.info(\"### Finished Get Source: %s\" % self.package_base_name)\n\n if self.build_type == 'setup':\n self.python_setup()\n else: \n self._make()\n self.logger.info('####### Finished Building: %s' % self.package_base_name) \n \n#-----------------------------------------------------------------------------\n# Installation class for Python itself.\n#-----------------------------------------------------------------------------\n \nclass python_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Python. \n self.package_base_name = 'Python-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = '/'.join([python_ftp_url,version])\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def write_install_config(self): \n \"\"\" Make doesn't seem to install scripts in the correct places.\n \n Writing this to the python directory will solve the problem.\n [install_script]\n install-dir= \n \"\"\"\n self.logger.info('### Writing Install Script Hack')\n text = \"[install_scripts]\\n\"\\\n \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n file = os.path.join(self.package_dir,'setup.cfg') \n write_file(file,text,self.logger,mode='w')\n self.logger.info('### Finished writing Install Script Hack')\n\n def install_with_make(self):\n \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n file is written to force installation in the correct place.\n \"\"\" \n self.write_install_config()\n package_installation.install_with_make(self)\n\n def get_exe_name(self):\n pyname = os.path.join('.','python')\n cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"\n text = run_command(cmd,self.package_dir,self.logger)\n exe = os.path.join(self.dst_dir,'bin','python'+text)\n return exe\n\n#-----------------------------------------------------------------------------\n# Installation class for Blas.\n#-----------------------------------------------------------------------------\n\nclass blas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for for \"slow\" blas\n self.package_base_name = 'blas'\n self.package_dir_name = 'BLAS'\n self.package_url = blas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def unpack_source(self,subdir=None):\n \"\"\" Dag. blas.tgz doesn't have directory information -- its\n just a tar ball of fortran source code. untar it in the\n BLAS directory\n \"\"\"\n package_installation.unpack_source(self,self.package_dir_name)\n \n def auto_configure(self):\n # nothing to do.\n pass\n def build_with_make(self, **kw):\n libname = 'blas_LINUX.a'\n cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over. \n src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n self.logger.info(\"Installing blas\")\n copy_file(src_file,dst_file,self.logger)\n \n#-----------------------------------------------------------------------------\n# Installation class for Lapack.\n#-----------------------------------------------------------------------------\n\nclass lapack_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Lapack 3.0 + updates \n self.package_base_name = 'lapack'\n self.package_dir_name = 'LAPACK'\n self.package_url = lapack_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self):\n # perhaps this should actually override auto_conifgure\n # before make, we need to copy the appropriate setup file in.\n # should work anywhere g77 works...\n make_inc = 'make.inc.' + self.platform\n src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n dst_file = os.path.join(self.package_dir,'make.inc')\n copy_file(src_file,dst_file,self.logger)\n \n def build_with_make(self, **kw):\n cmd = 'make install lapacklib'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over.\n src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','liblapack.a') \n copy_file(src_file,dst_file,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for Numeric\n#-----------------------------------------------------------------------------\n\nclass numeric_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'Numeric-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = numeric_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for f2py\n#-----------------------------------------------------------------------------\n\nclass f2py_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Typical file format: F2PY-2.13.175-1250.tar.gz\n self.package_base_name = 'F2PY-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = f2py_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for Atlas.\n# This is a binary install *NOT* a source install.\n# The source install is a pain to automate.\n#-----------------------------------------------------------------------------\n\nclass atlas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n #self.package_base_name = 'atlas' + version\n #self.package_dir_name = 'ATLAS'\n self.package_base_name = 'atlas-RH7.1-PIII'\n self.package_dir_name = 'atlas'\n self.package_url = atlas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self,**kw):\n pass\n def build_with_make(self,**kw):\n pass\n def install_with_make(self, **kw):\n # just copy the tree over.\n dst = os.path.join(self.dst_dir,'lib','atlas')\n self.logger.info(\"Installing Atlas\")\n copy_tree(self.package_dir,dst,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for scipy\n#-----------------------------------------------------------------------------\n\nclass scipy_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'scipy_snapshot'\n self.package_dir_name = 'scipy'\n self.package_url = scipy_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'setup'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n file = os.path.join(local_repository,self.tarball)\n up_to_date = 0\n try:\n file_time = os.stat(file)[stat.ST_MTIME] \n fyear,fmonth,fday = time.localtime(file_time)[:3]\n year,month,day = time.localtime()[:3]\n if year == year and month == month and day == day:\n up_to_date = 1\n self.logger.info(\"Repository file up to date: %s\" % file)\n except OSError, msg:\n pass\n return up_to_date\n \n#-----------------------------------------------------------------------------\n# Utilities\n#-----------------------------------------------------------------------------\n\n\n#if os.name == 'nt':\n# def exec_command(command):\n# \"\"\" not sure how to get exit status on nt. \"\"\"\n# in_pipe,out_pipe = os.popen4(command)\n# in_pipe.close()\n# text = out_pipe.read()\n# return 0, text\n#else:\n# import commands\n# exec_command = commands.getstatusoutput\n \n# This may not work on Win98... The above stuff was to handle these machines.\nimport commands\nexec_command = commands.getstatusoutput\n\ndef copy_file(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying %s->%s\" % (src,dst)) \n try:\n file_util.copy_file(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef copy_tree(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying directory tree %s->%s\" % (src,dst)) \n try:\n dir_util.copy_tree(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef remove_tree(directory,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Removing directory tree %s\" % directory) \n try:\n dir_util.remove_tree(directory)\n except Exception, e: \n logger.exception(\"Remove failed: %s\" % e) \n raise\n\ndef remove_file(file,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Remove file %s\" % file) \n try:\n os.remove(file)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef write_file(file,contents,logger=None,mode='wb'):\n if not logger:\n logger = logging\n logger.info('Write file: %s' % file)\n try:\n new_file = open(file,mode)\n new_file.write(contents)\n new_file.close()\n except Exception, e: \n logger.exception(\"Write failed\") \n raise\n\ndef make_dir(name,logger=None):\n if not logger:\n logger = logging\n logger.info('Make directory: %s' % name)\n try: \n dir_util.mkpath(os.path.abspath(name))\n except Exception, e: \n logger.exception(\"Make Directory failed\") \n raise\n\n# I know, I know...\nold_dir = []\n\ndef change_dir(d, logger = None):\n if not logger:\n logger = logging\n global old_dir \n cwd = os.getcwd() \n old_dir.append(cwd)\n d = os.path.abspath(d)\n if d != old_dir[-1]:\n logger.info(\"Change directory: %s\" % d) \n try:\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n #if d == '.':\n # import sys,traceback\n # f = sys._getframe()\n # traceback.print_stack(f)\n\ndef unchange_dir(logger=None):\n if not logger:\n logger = logging \n global old_dir\n try:\n cwd = os.getcwd()\n d = old_dir.pop(-1) \n try:\n if d != cwd:\n logger.info(\"Change directory : %s\" % d)\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n except IndexError:\n logger.exception(\"Change directory failed\")\n \ndef decompress_file(src,dst,logger = None):\n if not logger:\n logger = logging\n logger.info(\"Upacking %s->%s\" % (src,dst))\n try:\n f = gzip.open(src,'rb')\n contents = f.read(-1)\n f = open(dst, 'wb')\n f.write(contents)\n except Exception, e: \n logger.exception(\"Unpack failed\")\n raise \n\n \ndef untar_file(file,dst_dir='.',logger = None,silent_failure = 0): \n if not logger:\n logger = logging\n logger.info(\"Untarring file: %s\" % (file))\n try:\n run_command('tar -xf ' + file,directory = dst_dir,\n logger=logger, silent_failure = silent_failure)\n except Exception, e:\n if not silent_failure: \n logger.exception(\"Untar failed\")\n raise \n\ndef unpack_file(file,logger = None):\n \"\"\" equivalent to 'tar -xzvf file'\n \"\"\"\n dst = 'tmp.tar'\n decompress_file(file,dst,logger) \n untar_file(dst.logger)\n remove_file(dst,logger) \n\n\ndef run_command(cmd,directory='.',logger=None,silent_failure = 0):\n if not logger:\n logger = logging\n change_dir(directory,logger) \n try: \n msg = 'Running: %s' % cmd\n logger.info(msg) \n status,text = exec_command(cmd)\n if status and silent_failure:\n msg = '(failed silently)'\n logger.info(msg) \n if status and text and not silent_failure:\n logger.error('Command Failed (status=%d)\\n'% status +text)\n finally:\n unchange_dir(logger)\n if status:\n raise ValueError, (status,text)\n return text \n\ndef mail_report(from_addr,to_addr,subject,mail_server,\n build_log, test_results,info):\n \n msg = ''\n msg = msg + 'To: %s\\n' % to_addr\n msg = msg + 'Subject: %s\\n' % subject\n msg = msg + '\\r\\n\\r\\n'\n\n for k,v in info.items(): \n msg = msg + '%s: %s\\n' % (k,v)\n msg = msg + test_results + '\\n'\n msg = msg + '-----------------------------\\n' \n msg = msg + '-------- BUILD LOG -------\\n' \n msg = msg + '-----------------------------\\n' \n msg = msg + build_log\n print msg\n \n # mail results\n import smtplib \n server = smtplib.SMTP(mail_server) \n server.sendmail(from_addr, to_addr, msg)\n server.quit()\n \n\ndef full_scipy_build(build_dir = '.',\n test_level = 10,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot'):\n \n # for now the atlas version is ignored. Only the \n # binaries for RH are supported at the moment.\n\n build_info = {'python_version' : python_version,\n 'test_level' : test_level,\n 'numeric_version': numeric_version,\n 'f2py_version' : f2py_version,\n 'atlas_version' : atlas_version,\n 'scipy_version' : scipy_version}\n \n dst_dir = os.path.join(build_dir,sys.platform)\n\n logger = logging.Logger(\"SciPy Test\")\n fmt = logging.Formatter(logging.BASIC_FORMAT)\n log_stream = cStringIO.StringIO()\n stream_handler = logging.StreamHandler(log_stream)\n stream_handler.setFormatter(fmt)\n logger.addHandler(stream_handler)\n # also write to stderr\n stderr = logging.StreamHandler()\n stderr.setFormatter(fmt)\n logger.addHandler(stderr)\n\n try:\n try: \n \n # before doing anything, we need to wipe the \n # /bin, /lib, /man, and /include directories\n # in dst_dir. Don't run as root. \n make_dir(dst_dir,logger=logger) \n change_dir(dst_dir , logger)\n for d in ['bin','lib','man','include']:\n try: remove_tree(d, logger)\n except OSError: pass \n unchange_dir(logger)\n \n python = python_installation(version=python_version,\n logger = logger,\n dst_dir = dst_dir)\n python.install()\n \n python_name = python.get_exe_name()\n \n numeric = numeric_installation(version=numeric_version,\n dst_dir = dst_dir,\n logger = logger,\n python_exe=python_name)\n numeric.install()\n \n f2py = f2py_installation(version=f2py_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n f2py.install() \n \n # download files don't have a version specified \n #lapack = lapack_installation(version='',\n # dst_dir = dst_dir\n # python_exe=python_name)\n #lapack.install() \n \n # download files don't have a version specified \n #blas = blas_installation(version='',\n # logger = logger,\n # dst_dir = dst_dir,\n # python_exe=python_name)\n #blas.install() \n \n # ATLAS\n atlas = atlas_installation(version=atlas_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n atlas.install()\n \n # version not currently used -- need to fix this.\n scipy = scipy_installation(version=scipy_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n scipy.install() \n \n # The change to tmp makes sure there isn't a scipy directory in \n # the local scope.\n # All tests are run.\n logger.info('Beginning Test')\n cmd = python_name +' -c \"import sys,scipy;suite=scipy.test(%d);\"'\\\n % test_level\n test_results = run_command(cmd, logger=logger,\n directory = tempfile.gettempdir())\n build_info['results'] = 'test completed (check below for pass/fail)'\n except Exception, msg:\n test_results = ''\n build_info['results'] = 'build failed: %s' % msg\n logger.exception('Build failed')\n finally: \n to_addr = \"scipy-testlog@scipy.org\"\n from_addr = \"scipy-test@enthought.com\"\n subject = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n numeric_version,scipy_version) \n build_log = log_stream.getvalue()\n mail_report(from_addr,to_addr,subject,local_mail_server,\n build_log,test_results,build_info)\n\nif __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n level = 1\n \"\"\"\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n # an older python\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older numeric\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.3',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # This fails because multiarray doesn't have \n # arange defined.\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '19.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n \"\"\"\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '18.4.1',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n", + "methods": [ + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 76, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 45, + "end_line": 76, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "init_names", + "long_name": "init_names( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 78, + "end_line": 80, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_source", + "long_name": "get_source( self )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 4, + "token_count": 39, + "parameters": [ + "self" + ], + "start_line": 82, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 99, + "end_line": 102, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "get_source_local", + "long_name": "get_source_local( self )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 2, + "token_count": 74, + "parameters": [ + "self" + ], + "start_line": 104, + "end_line": 115, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "get_source_ftp", + "long_name": "get_source_ftp( self )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 1, + "token_count": 136, + "parameters": [ + "self" + ], + "start_line": 117, + "end_line": 136, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , sub_dir = None )", + "filename": "auto_test.py", + "nloc": 20, + "complexity": 5, + "token_count": 153, + "parameters": [ + "self", + "sub_dir" + ], + "start_line": 138, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 172, + "end_line": 174, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 176, + "end_line": 178, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , prefix = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 2, + "token_count": 45, + "parameters": [ + "self", + "prefix" + ], + "start_line": 180, + "end_line": 184, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "python_setup", + "long_name": "python_setup( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 186, + "end_line": 188, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 1, + "token_count": 96, + "parameters": [ + "self", + "kw" + ], + "start_line": 190, + "end_line": 202, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 17, + "complexity": 2, + "token_count": 154, + "parameters": [ + "self" + ], + "start_line": 204, + "end_line": 222, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 73, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 230, + "end_line": 239, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 68, + "parameters": [ + "self" + ], + "start_line": 241, + "end_line": 253, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 260, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_exe_name", + "long_name": "get_exe_name( self )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 56, + "parameters": [ + "self" + ], + "start_line": 262, + "end_line": 267, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 275, + "end_line": 285, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , subdir = None )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "subdir" + ], + "start_line": 287, + "end_line": 292, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 294, + "end_line": 296, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "kw" + ], + "start_line": 297, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 302, + "end_line": 307, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 315, + "end_line": 325, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 327, + "end_line": 334, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "kw" + ], + "start_line": 336, + "end_line": 338, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self", + "kw" + ], + "start_line": 340, + "end_line": 344, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 352, + "end_line": 360, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 369, + "end_line": 378, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 389, + "end_line": 399, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 401, + "end_line": 402, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 403, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "kw" + ], + "start_line": 405, + "end_line": 409, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 417, + "end_line": 425, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self" + ], + "start_line": 427, + "end_line": 441, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "copy_file", + "long_name": "copy_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 463, + "end_line": 471, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "copy_tree", + "long_name": "copy_tree( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 473, + "end_line": 481, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_tree", + "long_name": "remove_tree( directory , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 46, + "parameters": [ + "directory", + "logger" + ], + "start_line": 483, + "end_line": 491, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_file", + "long_name": "remove_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "file", + "logger" + ], + "start_line": 493, + "end_line": 501, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_file", + "long_name": "write_file( file , contents , logger = None , mode = 'wb' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 3, + "token_count": 63, + "parameters": [ + "file", + "contents", + "logger", + "mode" + ], + "start_line": 503, + "end_line": 513, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "make_dir", + "long_name": "make_dir( name , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 51, + "parameters": [ + "name", + "logger" + ], + "start_line": 515, + "end_line": 523, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "change_dir", + "long_name": "change_dir( d , logger = None )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 4, + "token_count": 78, + "parameters": [ + "d", + "logger" + ], + "start_line": 528, + "end_line": 541, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "unchange_dir", + "long_name": "unchange_dir( logger = None )", + "filename": "auto_test.py", + "nloc": 16, + "complexity": 5, + "token_count": 76, + "parameters": [ + "logger" + ], + "start_line": 547, + "end_line": 562, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "decompress_file", + "long_name": "decompress_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 12, + "complexity": 3, + "token_count": 77, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 564, + "end_line": 575, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "untar_file", + "long_name": "untar_file( file , dst_dir = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 4, + "token_count": 70, + "parameters": [ + "file", + "dst_dir", + "logger", + "silent_failure" + ], + "start_line": 578, + "end_line": 588, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "unpack_file", + "long_name": "unpack_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 33, + "parameters": [ + "file", + "logger" + ], + "start_line": 590, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 9, + "token_count": 102, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 599, + "end_line": 616, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 0 + }, + { + "name": "mail_report", + "long_name": "mail_report( from_addr , to_addr , subject , mail_server , build_log , test_results , info )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 2, + "token_count": 115, + "parameters": [ + "from_addr", + "to_addr", + "subject", + "mail_server", + "build_log", + "test_results", + "info" + ], + "start_line": 618, + "end_line": 639, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , test_level = 10 , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 74, + "complexity": 5, + "token_count": 417, + "parameters": [ + "build_dir", + "test_level", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 642, + "end_line": 752, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 111, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 76, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 45, + "end_line": 76, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "init_names", + "long_name": "init_names( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 78, + "end_line": 80, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_source", + "long_name": "get_source( self )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 4, + "token_count": 39, + "parameters": [ + "self" + ], + "start_line": 82, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 99, + "end_line": 102, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "get_source_local", + "long_name": "get_source_local( self )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 2, + "token_count": 74, + "parameters": [ + "self" + ], + "start_line": 104, + "end_line": 115, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "get_source_ftp", + "long_name": "get_source_ftp( self )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 1, + "token_count": 136, + "parameters": [ + "self" + ], + "start_line": 117, + "end_line": 136, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , sub_dir = None )", + "filename": "auto_test.py", + "nloc": 20, + "complexity": 5, + "token_count": 153, + "parameters": [ + "self", + "sub_dir" + ], + "start_line": 138, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 172, + "end_line": 174, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 176, + "end_line": 178, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , prefix = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 2, + "token_count": 45, + "parameters": [ + "self", + "prefix" + ], + "start_line": 180, + "end_line": 184, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "python_setup", + "long_name": "python_setup( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 186, + "end_line": 188, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 1, + "token_count": 96, + "parameters": [ + "self", + "kw" + ], + "start_line": 190, + "end_line": 202, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 17, + "complexity": 2, + "token_count": 154, + "parameters": [ + "self" + ], + "start_line": 204, + "end_line": 222, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 73, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 230, + "end_line": 239, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 68, + "parameters": [ + "self" + ], + "start_line": 241, + "end_line": 253, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 260, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_exe_name", + "long_name": "get_exe_name( self )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 56, + "parameters": [ + "self" + ], + "start_line": 262, + "end_line": 267, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 275, + "end_line": 285, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , subdir = None )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "subdir" + ], + "start_line": 287, + "end_line": 292, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 294, + "end_line": 296, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "kw" + ], + "start_line": 297, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 302, + "end_line": 307, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 315, + "end_line": 325, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 327, + "end_line": 334, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "kw" + ], + "start_line": 336, + "end_line": 338, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self", + "kw" + ], + "start_line": 340, + "end_line": 344, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 352, + "end_line": 360, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 369, + "end_line": 378, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 389, + "end_line": 399, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 401, + "end_line": 402, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 403, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "kw" + ], + "start_line": 405, + "end_line": 409, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 417, + "end_line": 425, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self" + ], + "start_line": 427, + "end_line": 441, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "copy_file", + "long_name": "copy_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 463, + "end_line": 471, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "copy_tree", + "long_name": "copy_tree( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 473, + "end_line": 481, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_tree", + "long_name": "remove_tree( directory , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 46, + "parameters": [ + "directory", + "logger" + ], + "start_line": 483, + "end_line": 491, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_file", + "long_name": "remove_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "file", + "logger" + ], + "start_line": 493, + "end_line": 501, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_file", + "long_name": "write_file( file , contents , logger = None , mode = 'wb' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 3, + "token_count": 63, + "parameters": [ + "file", + "contents", + "logger", + "mode" + ], + "start_line": 503, + "end_line": 513, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "make_dir", + "long_name": "make_dir( name , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 51, + "parameters": [ + "name", + "logger" + ], + "start_line": 515, + "end_line": 523, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "change_dir", + "long_name": "change_dir( d , logger = None )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 4, + "token_count": 78, + "parameters": [ + "d", + "logger" + ], + "start_line": 528, + "end_line": 541, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "unchange_dir", + "long_name": "unchange_dir( logger = None )", + "filename": "auto_test.py", + "nloc": 16, + "complexity": 5, + "token_count": 76, + "parameters": [ + "logger" + ], + "start_line": 547, + "end_line": 562, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "decompress_file", + "long_name": "decompress_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 12, + "complexity": 3, + "token_count": 77, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 564, + "end_line": 575, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "untar_file", + "long_name": "untar_file( file , dst_dir = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 4, + "token_count": 70, + "parameters": [ + "file", + "dst_dir", + "logger", + "silent_failure" + ], + "start_line": 578, + "end_line": 588, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "unpack_file", + "long_name": "unpack_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 33, + "parameters": [ + "file", + "logger" + ], + "start_line": 590, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 9, + "token_count": 102, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 599, + "end_line": 616, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 0 + }, + { + "name": "mail_report", + "long_name": "mail_report( from_addr , to_addr , subject , mail_server , build_log , test_results , info )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 2, + "token_count": 115, + "parameters": [ + "from_addr", + "to_addr", + "subject", + "mail_server", + "build_log", + "test_results", + "info" + ], + "start_line": 618, + "end_line": 639, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , test_level = 10 , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 74, + "complexity": 5, + "token_count": 417, + "parameters": [ + "build_dir", + "test_level", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 642, + "end_line": 752, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 111, + "top_nesting_level": 0 + } + ], + "changed_methods": [ + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self" + ], + "start_line": 427, + "end_line": 441, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + } + ], + "nloc": 543, + "complexity": 100, + "token_count": 3403, + "diff_parsed": { + "added": [ + " if fyear == year and fmonth == month and fday == day:", + " level = 10", + "", + " \"\"\"", + " \"\"\"", + " \"\"\"", + "", + " \"\"\"" + ], + "deleted": [ + " if year == year and month == month and day == day:", + " level = 1", + " \"\"\"", + "", + " \"\"\"", + "" + ] + } + } + ] + }, + { + "hash": "b0e9c8f02bb3c4a879039eac3c2ad43860ca4a3b", + "msg": "auto_test now runs against 2.2.1/21.0 and 2.1.3/21.0 and 2.1.3/20.3. Older Numeric versions are no longer tested.", + "author": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "committer": { + "name": "Eric Jones", + "email": "eric@enthought.com" + }, + "author_date": "2002-05-03T04:13:54+00:00", + "author_timezone": 0, + "committer_date": "2002-05-03T04:13:54+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "b76d86fea40b131d61fe110acd4857b97a5a5feb" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 2, + "insertions": 2, + "lines": 4, + "files": 1, + "dmm_unit_size": null, + "dmm_unit_complexity": null, + "dmm_unit_interfacing": null, + "modified_files": [ + { + "old_path": "scipy_distutils/auto_test.py", + "new_path": "scipy_distutils/auto_test.py", + "filename": "auto_test.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -762,7 +762,7 @@ def full_scipy_build(build_dir = '.',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n- \"\"\"\n+\n # an older python\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n@@ -780,7 +780,7 @@ def full_scipy_build(build_dir = '.',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n- \"\"\"\n+\n # This fails because multiarray doesn't have \n # arange defined.\n \"\"\"\n", + "added_lines": 2, + "deleted_lines": 2, + "source_code": "\"\"\" Auto test tools for SciPy\n\n Do not run this as root! If you enter something\n like /usr as your test directory, it'll delete\n /usr/bin, usr/lib, etc. So don't do it!!!\n \n \n Author: Eric Jones (eric@enthought.com)\n\"\"\"\nfrom distutils import file_util\nfrom distutils import dir_util\nfrom distutils.errors import DistutilsFileError\n#import tarfile\nimport sys, os, stat, time\nimport gzip\nimport tempfile, cStringIO\nimport urllib\nimport logging\n\nif sys.platform == 'cygwin':\n local_repository = \"/cygdrive/i/tarballs\"\nelif sys.platform == 'win32': \n local_repository = \"i:\\tarballs\"\nelse:\n local_repository = \"/home/shared/tarballs\"\n\nlocal_mail_server = \"enthought.com\"\n\npython_ftp_url = \"ftp://ftp.python.org/pub/python\"\nnumeric_url = \"http://prdownloads.sourceforge.net/numpy\"\nf2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\nscipy_url = \"ftp://www.scipy.org/pub\"\nblas_url = \"http://www.netlib.org/blas\"\nlapack_url = \"http://www.netlib.org/lapack\"\n#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\natlas_url = \"http://www.scipy.org/Members/eric\"\n\n\n#-----------------------------------------------------------------------------\n# Generic installation class. \n# built to handle downloading/untarring/building/installing arbitrary software\n#-----------------------------------------------------------------------------\n\nclass package_installation: \n def __init__(self,version='', dst_dir = '.',\n logger = None, python_exe='python'):\n #---------------------------------------------------------------------\n # These should be defined in sub-class before calling this\n # constructor\n #---------------------------------------------------------------------\n # \n #self.package_url -- The name of the url where tarball can be found.\n #self.package_base_name -- The base name of the source tarball.\n #self.package_dir_name -- Top level directory of unpacked tarball\n #self.tarball_suffix -- usually tar.gz or .tgz\n #self.build_type -- 'make' or 'setup' for makefile or python setup file\n \n # Version of the software package.\n self.version = version\n\n # Only used by packages built with setup.py\n self.python_exe = python_exe\n \n # Directory where package is unpacked/built/installed\n self.dst_dir = os.path.abspath(dst_dir) \n \n if not logger:\n self.logger = logging\n else:\n self.logger = logger \n\n # make sure the destination exists\n make_dir(self.dst_dir,logger=self.logger)\n\n # Construct any derived names built from the above names.\n self.init_names()\n \n def init_names(self): \n self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)\n self.tarball = self.package_base_name + '.' + self.tarball_suffix\n\n def get_source(self):\n \"\"\" Grab the source tarball from a repository.\n \n Try a local repository first. If the file isn't found,\n grab it from an ftp site.\n \"\"\"\n local_found = 0\n if self.local_source_up_to_date():\n try:\n self.get_source_local()\n local_found = 1 \n except DistutilsFileError:\n pass\n \n if not local_found:\n self.get_source_ftp()\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n return 1\n \n def get_source_local(self):\n \"\"\" Grab the requested tarball from a local repository of source\n tarballs. If it doesn't exist, an error is raised.\n \"\"\"\n file = os.path.join(local_repository,self.tarball) \n dst_file = os.path.join(self.dst_dir,self.tarball)\n self.logger.info(\"Searching local repository for %s\" % file)\n try:\n copy_file(file,dst_file,self.logger)\n except DistutilsFileError, msg:\n self.logger.info(\"Not found:\",msg)\n raise\n \n def get_source_ftp(self):\n \"\"\" Grab requested tarball from a ftp site specified as a url. \n \"\"\"\n url = '/'.join([self.package_url,self.tarball])\n \n self.logger.info('Opening: %s' % url)\n f = urllib.urlopen(url)\n self.logger.info('Downloading: this may take a while')\n contents = f.read(-1)\n f.close()\n self.logger.info('Finished download (size=%d)' % len(contents))\n \n output_file = os.path.join(self.dst_dir,self.tarball)\n write_file(output_file,contents,self.logger)\n\n # Put file in local repository so we don't have to download it again.\n self.logger.info(\"Caching file in repository\" )\n src_file = output_file\n repos_file = os.path.join(local_repository,self.tarball) \n copy_file(src_file,repos_file,self.logger)\n\n def unpack_source(self,sub_dir = None):\n \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir\n \"\"\" \n tarfile = os.path.join(self.dst_dir,self.tarball)\n old_dir = None\n \n # copy and move into sub directory if it is specified.\n if sub_dir:\n dst_dir = os.path.join(self.dst_dir,sub_dir)\n dst_file = os.path.join(dst_dir,self.tarball)\n copy_file(tarfile,dst_file)\n change_dir(dst_dir,self.logger)\n try:\n try:\n # occasionally the tarball is not zipped, try this first.\n untar_file(self.tarball,self.dst_dir,\n self.logger,silent_failure=1)\n except:\n # otherwise, handle the fact that it is zipped \n dst = os.path.join(self.dst_dir,'tmp.tar') \n decompress_file(tarfile,dst,self.logger) \n untar_file(dst,self.dst_dir,self.logger)\n remove_file(dst,self.logger)\n finally:\n if old_dir:\n unchange_dir(self.logger)\n\n #def auto_configure(self):\n # cmd = os.path.join('.','configure')\n # try:\n # text = run_command(cmd,self.package_dir,self.logger,log_output=0)\n # except ValueError, e:\n # status, text = e\n # self.logger.exception('Configuration Error:\\n'+text)\n def auto_configure(self):\n cmd = os.path.join('.','configure')\n text = run_command(cmd,self.package_dir,self.logger)\n \n def build_with_make(self):\n cmd = 'make'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, prefix = None):\n if prefix is None:\n prefix = os.path.abspath(self.dst_dir)\n cmd = 'make install prefix=%s' % prefix\n text = run_command(cmd,self.package_dir,self.logger)\n \n def python_setup(self):\n cmd = self.python_exe + ' setup.py install'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def _make(self,**kw):\n \"\"\" This generally needs to be overrridden in the derived class,\n but this will suffice for the standard configure/make process. \n \"\"\"\n self.logger.info(\"### Begin Configure: %s\" % self.package_base_name)\n self.auto_configure()\n self.logger.info(\"### Finished Configure: %s\" % self.package_base_name)\n self.logger.info(\"### Begin Build: %s\" % self.package_base_name)\n self.build_with_make()\n self.logger.info(\"### Finished Build: %s\" % self.package_base_name)\n self.logger.info(\"### Begin Install: %s\" % self.package_base_name)\n self.install_with_make()\n self.logger.info(\"### Finished Install: %s\" % self.package_base_name)\n\n def install(self):\n self.logger.info('####### Building: %s' % self.package_base_name)\n self.logger.info(' Version: %s' % self.version)\n self.logger.info(' Url: %s' % self.package_url)\n self.logger.info(' Install dir: %s' % self.dst_dir)\n self.logger.info(' Package dir: %s' % self.package_dir)\n self.logger.info(' Suffix: %s' % self.tarball_suffix)\n self.logger.info(' Build type: %s' % self.build_type)\n\n self.logger.info(\"### Begin Get Source: %s\" % self.package_base_name)\n self.get_source()\n self.unpack_source()\n self.logger.info(\"### Finished Get Source: %s\" % self.package_base_name)\n\n if self.build_type == 'setup':\n self.python_setup()\n else: \n self._make()\n self.logger.info('####### Finished Building: %s' % self.package_base_name) \n \n#-----------------------------------------------------------------------------\n# Installation class for Python itself.\n#-----------------------------------------------------------------------------\n \nclass python_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Python. \n self.package_base_name = 'Python-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = '/'.join([python_ftp_url,version])\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def write_install_config(self): \n \"\"\" Make doesn't seem to install scripts in the correct places.\n \n Writing this to the python directory will solve the problem.\n [install_script]\n install-dir= \n \"\"\"\n self.logger.info('### Writing Install Script Hack')\n text = \"[install_scripts]\\n\"\\\n \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n file = os.path.join(self.package_dir,'setup.cfg') \n write_file(file,text,self.logger,mode='w')\n self.logger.info('### Finished writing Install Script Hack')\n\n def install_with_make(self):\n \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n file is written to force installation in the correct place.\n \"\"\" \n self.write_install_config()\n package_installation.install_with_make(self)\n\n def get_exe_name(self):\n pyname = os.path.join('.','python')\n cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"\n text = run_command(cmd,self.package_dir,self.logger)\n exe = os.path.join(self.dst_dir,'bin','python'+text)\n return exe\n\n#-----------------------------------------------------------------------------\n# Installation class for Blas.\n#-----------------------------------------------------------------------------\n\nclass blas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for for \"slow\" blas\n self.package_base_name = 'blas'\n self.package_dir_name = 'BLAS'\n self.package_url = blas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def unpack_source(self,subdir=None):\n \"\"\" Dag. blas.tgz doesn't have directory information -- its\n just a tar ball of fortran source code. untar it in the\n BLAS directory\n \"\"\"\n package_installation.unpack_source(self,self.package_dir_name)\n \n def auto_configure(self):\n # nothing to do.\n pass\n def build_with_make(self, **kw):\n libname = 'blas_LINUX.a'\n cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over. \n src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n self.logger.info(\"Installing blas\")\n copy_file(src_file,dst_file,self.logger)\n \n#-----------------------------------------------------------------------------\n# Installation class for Lapack.\n#-----------------------------------------------------------------------------\n\nclass lapack_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Lapack 3.0 + updates \n self.package_base_name = 'lapack'\n self.package_dir_name = 'LAPACK'\n self.package_url = lapack_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self):\n # perhaps this should actually override auto_conifgure\n # before make, we need to copy the appropriate setup file in.\n # should work anywhere g77 works...\n make_inc = 'make.inc.' + self.platform\n src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n dst_file = os.path.join(self.package_dir,'make.inc')\n copy_file(src_file,dst_file,self.logger)\n \n def build_with_make(self, **kw):\n cmd = 'make install lapacklib'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over.\n src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','liblapack.a') \n copy_file(src_file,dst_file,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for Numeric\n#-----------------------------------------------------------------------------\n\nclass numeric_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'Numeric-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = numeric_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for f2py\n#-----------------------------------------------------------------------------\n\nclass f2py_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Typical file format: F2PY-2.13.175-1250.tar.gz\n self.package_base_name = 'F2PY-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = f2py_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for Atlas.\n# This is a binary install *NOT* a source install.\n# The source install is a pain to automate.\n#-----------------------------------------------------------------------------\n\nclass atlas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n #self.package_base_name = 'atlas' + version\n #self.package_dir_name = 'ATLAS'\n self.package_base_name = 'atlas-RH7.1-PIII'\n self.package_dir_name = 'atlas'\n self.package_url = atlas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self,**kw):\n pass\n def build_with_make(self,**kw):\n pass\n def install_with_make(self, **kw):\n # just copy the tree over.\n dst = os.path.join(self.dst_dir,'lib','atlas')\n self.logger.info(\"Installing Atlas\")\n copy_tree(self.package_dir,dst,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for scipy\n#-----------------------------------------------------------------------------\n\nclass scipy_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'scipy_snapshot'\n self.package_dir_name = 'scipy'\n self.package_url = scipy_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'setup'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n file = os.path.join(local_repository,self.tarball)\n up_to_date = 0\n try:\n file_time = os.stat(file)[stat.ST_MTIME] \n fyear,fmonth,fday = time.localtime(file_time)[:3]\n year,month,day = time.localtime()[:3]\n if fyear == year and fmonth == month and fday == day:\n up_to_date = 1\n self.logger.info(\"Repository file up to date: %s\" % file)\n except OSError, msg:\n pass\n return up_to_date\n \n#-----------------------------------------------------------------------------\n# Utilities\n#-----------------------------------------------------------------------------\n\n\n#if os.name == 'nt':\n# def exec_command(command):\n# \"\"\" not sure how to get exit status on nt. \"\"\"\n# in_pipe,out_pipe = os.popen4(command)\n# in_pipe.close()\n# text = out_pipe.read()\n# return 0, text\n#else:\n# import commands\n# exec_command = commands.getstatusoutput\n \n# This may not work on Win98... The above stuff was to handle these machines.\nimport commands\nexec_command = commands.getstatusoutput\n\ndef copy_file(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying %s->%s\" % (src,dst)) \n try:\n file_util.copy_file(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef copy_tree(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying directory tree %s->%s\" % (src,dst)) \n try:\n dir_util.copy_tree(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef remove_tree(directory,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Removing directory tree %s\" % directory) \n try:\n dir_util.remove_tree(directory)\n except Exception, e: \n logger.exception(\"Remove failed: %s\" % e) \n raise\n\ndef remove_file(file,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Remove file %s\" % file) \n try:\n os.remove(file)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef write_file(file,contents,logger=None,mode='wb'):\n if not logger:\n logger = logging\n logger.info('Write file: %s' % file)\n try:\n new_file = open(file,mode)\n new_file.write(contents)\n new_file.close()\n except Exception, e: \n logger.exception(\"Write failed\") \n raise\n\ndef make_dir(name,logger=None):\n if not logger:\n logger = logging\n logger.info('Make directory: %s' % name)\n try: \n dir_util.mkpath(os.path.abspath(name))\n except Exception, e: \n logger.exception(\"Make Directory failed\") \n raise\n\n# I know, I know...\nold_dir = []\n\ndef change_dir(d, logger = None):\n if not logger:\n logger = logging\n global old_dir \n cwd = os.getcwd() \n old_dir.append(cwd)\n d = os.path.abspath(d)\n if d != old_dir[-1]:\n logger.info(\"Change directory: %s\" % d) \n try:\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n #if d == '.':\n # import sys,traceback\n # f = sys._getframe()\n # traceback.print_stack(f)\n\ndef unchange_dir(logger=None):\n if not logger:\n logger = logging \n global old_dir\n try:\n cwd = os.getcwd()\n d = old_dir.pop(-1) \n try:\n if d != cwd:\n logger.info(\"Change directory : %s\" % d)\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n except IndexError:\n logger.exception(\"Change directory failed\")\n \ndef decompress_file(src,dst,logger = None):\n if not logger:\n logger = logging\n logger.info(\"Upacking %s->%s\" % (src,dst))\n try:\n f = gzip.open(src,'rb')\n contents = f.read(-1)\n f = open(dst, 'wb')\n f.write(contents)\n except Exception, e: \n logger.exception(\"Unpack failed\")\n raise \n\n \ndef untar_file(file,dst_dir='.',logger = None,silent_failure = 0): \n if not logger:\n logger = logging\n logger.info(\"Untarring file: %s\" % (file))\n try:\n run_command('tar -xf ' + file,directory = dst_dir,\n logger=logger, silent_failure = silent_failure)\n except Exception, e:\n if not silent_failure: \n logger.exception(\"Untar failed\")\n raise \n\ndef unpack_file(file,logger = None):\n \"\"\" equivalent to 'tar -xzvf file'\n \"\"\"\n dst = 'tmp.tar'\n decompress_file(file,dst,logger) \n untar_file(dst.logger)\n remove_file(dst,logger) \n\n\ndef run_command(cmd,directory='.',logger=None,silent_failure = 0):\n if not logger:\n logger = logging\n change_dir(directory,logger) \n try: \n msg = 'Running: %s' % cmd\n logger.info(msg) \n status,text = exec_command(cmd)\n if status and silent_failure:\n msg = '(failed silently)'\n logger.info(msg) \n if status and text and not silent_failure:\n logger.error('Command Failed (status=%d)\\n'% status +text)\n finally:\n unchange_dir(logger)\n if status:\n raise ValueError, (status,text)\n return text \n\ndef mail_report(from_addr,to_addr,subject,mail_server,\n build_log, test_results,info):\n \n msg = ''\n msg = msg + 'To: %s\\n' % to_addr\n msg = msg + 'Subject: %s\\n' % subject\n msg = msg + '\\r\\n\\r\\n'\n\n for k,v in info.items(): \n msg = msg + '%s: %s\\n' % (k,v)\n msg = msg + test_results + '\\n'\n msg = msg + '-----------------------------\\n' \n msg = msg + '-------- BUILD LOG -------\\n' \n msg = msg + '-----------------------------\\n' \n msg = msg + build_log\n print msg\n \n # mail results\n import smtplib \n server = smtplib.SMTP(mail_server) \n server.sendmail(from_addr, to_addr, msg)\n server.quit()\n \n\ndef full_scipy_build(build_dir = '.',\n test_level = 10,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot'):\n \n # for now the atlas version is ignored. Only the \n # binaries for RH are supported at the moment.\n\n build_info = {'python_version' : python_version,\n 'test_level' : test_level,\n 'numeric_version': numeric_version,\n 'f2py_version' : f2py_version,\n 'atlas_version' : atlas_version,\n 'scipy_version' : scipy_version}\n \n dst_dir = os.path.join(build_dir,sys.platform)\n\n logger = logging.Logger(\"SciPy Test\")\n fmt = logging.Formatter(logging.BASIC_FORMAT)\n log_stream = cStringIO.StringIO()\n stream_handler = logging.StreamHandler(log_stream)\n stream_handler.setFormatter(fmt)\n logger.addHandler(stream_handler)\n # also write to stderr\n stderr = logging.StreamHandler()\n stderr.setFormatter(fmt)\n logger.addHandler(stderr)\n\n try:\n try: \n \n # before doing anything, we need to wipe the \n # /bin, /lib, /man, and /include directories\n # in dst_dir. Don't run as root. \n make_dir(dst_dir,logger=logger) \n change_dir(dst_dir , logger)\n for d in ['bin','lib','man','include']:\n try: remove_tree(d, logger)\n except OSError: pass \n unchange_dir(logger)\n \n python = python_installation(version=python_version,\n logger = logger,\n dst_dir = dst_dir)\n python.install()\n \n python_name = python.get_exe_name()\n \n numeric = numeric_installation(version=numeric_version,\n dst_dir = dst_dir,\n logger = logger,\n python_exe=python_name)\n numeric.install()\n \n f2py = f2py_installation(version=f2py_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n f2py.install() \n \n # download files don't have a version specified \n #lapack = lapack_installation(version='',\n # dst_dir = dst_dir\n # python_exe=python_name)\n #lapack.install() \n \n # download files don't have a version specified \n #blas = blas_installation(version='',\n # logger = logger,\n # dst_dir = dst_dir,\n # python_exe=python_name)\n #blas.install() \n \n # ATLAS\n atlas = atlas_installation(version=atlas_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n atlas.install()\n \n # version not currently used -- need to fix this.\n scipy = scipy_installation(version=scipy_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n scipy.install() \n \n # The change to tmp makes sure there isn't a scipy directory in \n # the local scope.\n # All tests are run.\n logger.info('Beginning Test')\n cmd = python_name +' -c \"import sys,scipy;suite=scipy.test(%d);\"'\\\n % test_level\n test_results = run_command(cmd, logger=logger,\n directory = tempfile.gettempdir())\n build_info['results'] = 'test completed (check below for pass/fail)'\n except Exception, msg:\n test_results = ''\n build_info['results'] = 'build failed: %s' % msg\n logger.exception('Build failed')\n finally: \n to_addr = \"scipy-testlog@scipy.org\"\n from_addr = \"scipy-test@enthought.com\"\n subject = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n numeric_version,scipy_version) \n build_log = log_stream.getvalue()\n mail_report(from_addr,to_addr,subject,local_mail_server,\n build_log,test_results,build_info)\n\nif __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n level = 10\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older python\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older numeric\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.3',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # This fails because multiarray doesn't have \n # arange defined.\n \"\"\"\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '19.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '18.4.1',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n \"\"\"\n", + "source_code_before": "\"\"\" Auto test tools for SciPy\n\n Do not run this as root! If you enter something\n like /usr as your test directory, it'll delete\n /usr/bin, usr/lib, etc. So don't do it!!!\n \n \n Author: Eric Jones (eric@enthought.com)\n\"\"\"\nfrom distutils import file_util\nfrom distutils import dir_util\nfrom distutils.errors import DistutilsFileError\n#import tarfile\nimport sys, os, stat, time\nimport gzip\nimport tempfile, cStringIO\nimport urllib\nimport logging\n\nif sys.platform == 'cygwin':\n local_repository = \"/cygdrive/i/tarballs\"\nelif sys.platform == 'win32': \n local_repository = \"i:\\tarballs\"\nelse:\n local_repository = \"/home/shared/tarballs\"\n\nlocal_mail_server = \"enthought.com\"\n\npython_ftp_url = \"ftp://ftp.python.org/pub/python\"\nnumeric_url = \"http://prdownloads.sourceforge.net/numpy\"\nf2py_url = \"http://cens.ioc.ee/projects/f2py2e/2.x\"\nscipy_url = \"ftp://www.scipy.org/pub\"\nblas_url = \"http://www.netlib.org/blas\"\nlapack_url = \"http://www.netlib.org/lapack\"\n#atlas_url = \"http://prdownloads.sourceforge.net/math-atlas\"\natlas_url = \"http://www.scipy.org/Members/eric\"\n\n\n#-----------------------------------------------------------------------------\n# Generic installation class. \n# built to handle downloading/untarring/building/installing arbitrary software\n#-----------------------------------------------------------------------------\n\nclass package_installation: \n def __init__(self,version='', dst_dir = '.',\n logger = None, python_exe='python'):\n #---------------------------------------------------------------------\n # These should be defined in sub-class before calling this\n # constructor\n #---------------------------------------------------------------------\n # \n #self.package_url -- The name of the url where tarball can be found.\n #self.package_base_name -- The base name of the source tarball.\n #self.package_dir_name -- Top level directory of unpacked tarball\n #self.tarball_suffix -- usually tar.gz or .tgz\n #self.build_type -- 'make' or 'setup' for makefile or python setup file\n \n # Version of the software package.\n self.version = version\n\n # Only used by packages built with setup.py\n self.python_exe = python_exe\n \n # Directory where package is unpacked/built/installed\n self.dst_dir = os.path.abspath(dst_dir) \n \n if not logger:\n self.logger = logging\n else:\n self.logger = logger \n\n # make sure the destination exists\n make_dir(self.dst_dir,logger=self.logger)\n\n # Construct any derived names built from the above names.\n self.init_names()\n \n def init_names(self): \n self.package_dir = os.path.join(self.dst_dir,self.package_dir_name)\n self.tarball = self.package_base_name + '.' + self.tarball_suffix\n\n def get_source(self):\n \"\"\" Grab the source tarball from a repository.\n \n Try a local repository first. If the file isn't found,\n grab it from an ftp site.\n \"\"\"\n local_found = 0\n if self.local_source_up_to_date():\n try:\n self.get_source_local()\n local_found = 1 \n except DistutilsFileError:\n pass\n \n if not local_found:\n self.get_source_ftp()\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n return 1\n \n def get_source_local(self):\n \"\"\" Grab the requested tarball from a local repository of source\n tarballs. If it doesn't exist, an error is raised.\n \"\"\"\n file = os.path.join(local_repository,self.tarball) \n dst_file = os.path.join(self.dst_dir,self.tarball)\n self.logger.info(\"Searching local repository for %s\" % file)\n try:\n copy_file(file,dst_file,self.logger)\n except DistutilsFileError, msg:\n self.logger.info(\"Not found:\",msg)\n raise\n \n def get_source_ftp(self):\n \"\"\" Grab requested tarball from a ftp site specified as a url. \n \"\"\"\n url = '/'.join([self.package_url,self.tarball])\n \n self.logger.info('Opening: %s' % url)\n f = urllib.urlopen(url)\n self.logger.info('Downloading: this may take a while')\n contents = f.read(-1)\n f.close()\n self.logger.info('Finished download (size=%d)' % len(contents))\n \n output_file = os.path.join(self.dst_dir,self.tarball)\n write_file(output_file,contents,self.logger)\n\n # Put file in local repository so we don't have to download it again.\n self.logger.info(\"Caching file in repository\" )\n src_file = output_file\n repos_file = os.path.join(local_repository,self.tarball) \n copy_file(src_file,repos_file,self.logger)\n\n def unpack_source(self,sub_dir = None):\n \"\"\" equivalent to 'tar -xzvf file' in the given sub_dir\n \"\"\" \n tarfile = os.path.join(self.dst_dir,self.tarball)\n old_dir = None\n \n # copy and move into sub directory if it is specified.\n if sub_dir:\n dst_dir = os.path.join(self.dst_dir,sub_dir)\n dst_file = os.path.join(dst_dir,self.tarball)\n copy_file(tarfile,dst_file)\n change_dir(dst_dir,self.logger)\n try:\n try:\n # occasionally the tarball is not zipped, try this first.\n untar_file(self.tarball,self.dst_dir,\n self.logger,silent_failure=1)\n except:\n # otherwise, handle the fact that it is zipped \n dst = os.path.join(self.dst_dir,'tmp.tar') \n decompress_file(tarfile,dst,self.logger) \n untar_file(dst,self.dst_dir,self.logger)\n remove_file(dst,self.logger)\n finally:\n if old_dir:\n unchange_dir(self.logger)\n\n #def auto_configure(self):\n # cmd = os.path.join('.','configure')\n # try:\n # text = run_command(cmd,self.package_dir,self.logger,log_output=0)\n # except ValueError, e:\n # status, text = e\n # self.logger.exception('Configuration Error:\\n'+text)\n def auto_configure(self):\n cmd = os.path.join('.','configure')\n text = run_command(cmd,self.package_dir,self.logger)\n \n def build_with_make(self):\n cmd = 'make'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, prefix = None):\n if prefix is None:\n prefix = os.path.abspath(self.dst_dir)\n cmd = 'make install prefix=%s' % prefix\n text = run_command(cmd,self.package_dir,self.logger)\n \n def python_setup(self):\n cmd = self.python_exe + ' setup.py install'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def _make(self,**kw):\n \"\"\" This generally needs to be overrridden in the derived class,\n but this will suffice for the standard configure/make process. \n \"\"\"\n self.logger.info(\"### Begin Configure: %s\" % self.package_base_name)\n self.auto_configure()\n self.logger.info(\"### Finished Configure: %s\" % self.package_base_name)\n self.logger.info(\"### Begin Build: %s\" % self.package_base_name)\n self.build_with_make()\n self.logger.info(\"### Finished Build: %s\" % self.package_base_name)\n self.logger.info(\"### Begin Install: %s\" % self.package_base_name)\n self.install_with_make()\n self.logger.info(\"### Finished Install: %s\" % self.package_base_name)\n\n def install(self):\n self.logger.info('####### Building: %s' % self.package_base_name)\n self.logger.info(' Version: %s' % self.version)\n self.logger.info(' Url: %s' % self.package_url)\n self.logger.info(' Install dir: %s' % self.dst_dir)\n self.logger.info(' Package dir: %s' % self.package_dir)\n self.logger.info(' Suffix: %s' % self.tarball_suffix)\n self.logger.info(' Build type: %s' % self.build_type)\n\n self.logger.info(\"### Begin Get Source: %s\" % self.package_base_name)\n self.get_source()\n self.unpack_source()\n self.logger.info(\"### Finished Get Source: %s\" % self.package_base_name)\n\n if self.build_type == 'setup':\n self.python_setup()\n else: \n self._make()\n self.logger.info('####### Finished Building: %s' % self.package_base_name) \n \n#-----------------------------------------------------------------------------\n# Installation class for Python itself.\n#-----------------------------------------------------------------------------\n \nclass python_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Python. \n self.package_base_name = 'Python-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = '/'.join([python_ftp_url,version])\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def write_install_config(self): \n \"\"\" Make doesn't seem to install scripts in the correct places.\n \n Writing this to the python directory will solve the problem.\n [install_script]\n install-dir= \n \"\"\"\n self.logger.info('### Writing Install Script Hack')\n text = \"[install_scripts]\\n\"\\\n \"install-dir='%s'\" % os.path.join(self.dst_dir,'bin')\n file = os.path.join(self.package_dir,'setup.cfg') \n write_file(file,text,self.logger,mode='w')\n self.logger.info('### Finished writing Install Script Hack')\n\n def install_with_make(self):\n \"\"\" Scripts were failing to install correctly, so a setuo.cfg\n file is written to force installation in the correct place.\n \"\"\" \n self.write_install_config()\n package_installation.install_with_make(self)\n\n def get_exe_name(self):\n pyname = os.path.join('.','python')\n cmd = pyname + \"\"\" -c \"import sys;print '%d.%d' % sys.version_info[:2]\" \"\"\"\n text = run_command(cmd,self.package_dir,self.logger)\n exe = os.path.join(self.dst_dir,'bin','python'+text)\n return exe\n\n#-----------------------------------------------------------------------------\n# Installation class for Blas.\n#-----------------------------------------------------------------------------\n\nclass blas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for for \"slow\" blas\n self.package_base_name = 'blas'\n self.package_dir_name = 'BLAS'\n self.package_url = blas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def unpack_source(self,subdir=None):\n \"\"\" Dag. blas.tgz doesn't have directory information -- its\n just a tar ball of fortran source code. untar it in the\n BLAS directory\n \"\"\"\n package_installation.unpack_source(self,self.package_dir_name)\n \n def auto_configure(self):\n # nothing to do.\n pass\n def build_with_make(self, **kw):\n libname = 'blas_LINUX.a'\n cmd = 'g77 -funroll-all-loops -fno-f2c -O3 -c *.f;ar -cru %s' % libname\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over. \n src_file = os.path.join(self.package_dir,'blas_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','libblas.a')\n self.logger.info(\"Installing blas\")\n copy_file(src_file,dst_file,self.logger)\n \n#-----------------------------------------------------------------------------\n# Installation class for Lapack.\n#-----------------------------------------------------------------------------\n\nclass lapack_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Specialization for Lapack 3.0 + updates \n self.package_base_name = 'lapack'\n self.package_dir_name = 'LAPACK'\n self.package_url = lapack_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make'\n \n self.platform = 'LINUX'\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self):\n # perhaps this should actually override auto_conifgure\n # before make, we need to copy the appropriate setup file in.\n # should work anywhere g77 works...\n make_inc = 'make.inc.' + self.platform\n src_file = os.path.join(self.package_dir,'INSTALL',make_inc)\n dst_file = os.path.join(self.package_dir,'make.inc')\n copy_file(src_file,dst_file,self.logger)\n \n def build_with_make(self, **kw):\n cmd = 'make install lapacklib'\n text = run_command(cmd,self.package_dir,self.logger)\n \n def install_with_make(self, **kw):\n # not really using make -- we'll just copy the file over.\n src_file = os.path.join(self.package_dir,'lapack_%s.a' % self.platform)\n dst_file = os.path.join(self.dst_dir,'lib','liblapack.a') \n copy_file(src_file,dst_file,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for Numeric\n#-----------------------------------------------------------------------------\n\nclass numeric_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'Numeric-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = numeric_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n\n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for f2py\n#-----------------------------------------------------------------------------\n\nclass f2py_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n # Typical file format: F2PY-2.13.175-1250.tar.gz\n self.package_base_name = 'F2PY-'+version\n self.package_dir_name = self.package_base_name\n self.package_url = f2py_url\n self.tarball_suffix = 'tar.gz'\n self.build_type = 'setup' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n\n#-----------------------------------------------------------------------------\n# Installation class for Atlas.\n# This is a binary install *NOT* a source install.\n# The source install is a pain to automate.\n#-----------------------------------------------------------------------------\n\nclass atlas_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n #self.package_base_name = 'atlas' + version\n #self.package_dir_name = 'ATLAS'\n self.package_base_name = 'atlas-RH7.1-PIII'\n self.package_dir_name = 'atlas'\n self.package_url = atlas_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'make' \n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n\n def auto_configure(self,**kw):\n pass\n def build_with_make(self,**kw):\n pass\n def install_with_make(self, **kw):\n # just copy the tree over.\n dst = os.path.join(self.dst_dir,'lib','atlas')\n self.logger.info(\"Installing Atlas\")\n copy_tree(self.package_dir,dst,self.logger)\n\n#-----------------------------------------------------------------------------\n# Installation class for scipy\n#-----------------------------------------------------------------------------\n\nclass scipy_installation(package_installation):\n \n def __init__(self,version='', dst_dir = '.',logger=None,python_exe='python'):\n \n self.package_base_name = 'scipy_snapshot'\n self.package_dir_name = 'scipy'\n self.package_url = scipy_url\n self.tarball_suffix = 'tgz'\n self.build_type = 'setup'\n \n package_installation.__init__(self,version,dst_dir,logger,python_exe)\n \n def local_source_up_to_date(self):\n \"\"\" Hook to test whether a file found in the repository is current\n \"\"\"\n file = os.path.join(local_repository,self.tarball)\n up_to_date = 0\n try:\n file_time = os.stat(file)[stat.ST_MTIME] \n fyear,fmonth,fday = time.localtime(file_time)[:3]\n year,month,day = time.localtime()[:3]\n if fyear == year and fmonth == month and fday == day:\n up_to_date = 1\n self.logger.info(\"Repository file up to date: %s\" % file)\n except OSError, msg:\n pass\n return up_to_date\n \n#-----------------------------------------------------------------------------\n# Utilities\n#-----------------------------------------------------------------------------\n\n\n#if os.name == 'nt':\n# def exec_command(command):\n# \"\"\" not sure how to get exit status on nt. \"\"\"\n# in_pipe,out_pipe = os.popen4(command)\n# in_pipe.close()\n# text = out_pipe.read()\n# return 0, text\n#else:\n# import commands\n# exec_command = commands.getstatusoutput\n \n# This may not work on Win98... The above stuff was to handle these machines.\nimport commands\nexec_command = commands.getstatusoutput\n\ndef copy_file(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying %s->%s\" % (src,dst)) \n try:\n file_util.copy_file(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef copy_tree(src,dst,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Copying directory tree %s->%s\" % (src,dst)) \n try:\n dir_util.copy_tree(src,dst)\n except Exception, e: \n logger.exception(\"Copy Failed\") \n raise\n\ndef remove_tree(directory,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Removing directory tree %s\" % directory) \n try:\n dir_util.remove_tree(directory)\n except Exception, e: \n logger.exception(\"Remove failed: %s\" % e) \n raise\n\ndef remove_file(file,logger=None):\n if not logger:\n logger = logging\n logger.info(\"Remove file %s\" % file) \n try:\n os.remove(file)\n except Exception, e: \n logger.exception(\"Remove failed\") \n raise\n\ndef write_file(file,contents,logger=None,mode='wb'):\n if not logger:\n logger = logging\n logger.info('Write file: %s' % file)\n try:\n new_file = open(file,mode)\n new_file.write(contents)\n new_file.close()\n except Exception, e: \n logger.exception(\"Write failed\") \n raise\n\ndef make_dir(name,logger=None):\n if not logger:\n logger = logging\n logger.info('Make directory: %s' % name)\n try: \n dir_util.mkpath(os.path.abspath(name))\n except Exception, e: \n logger.exception(\"Make Directory failed\") \n raise\n\n# I know, I know...\nold_dir = []\n\ndef change_dir(d, logger = None):\n if not logger:\n logger = logging\n global old_dir \n cwd = os.getcwd() \n old_dir.append(cwd)\n d = os.path.abspath(d)\n if d != old_dir[-1]:\n logger.info(\"Change directory: %s\" % d) \n try:\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n #if d == '.':\n # import sys,traceback\n # f = sys._getframe()\n # traceback.print_stack(f)\n\ndef unchange_dir(logger=None):\n if not logger:\n logger = logging \n global old_dir\n try:\n cwd = os.getcwd()\n d = old_dir.pop(-1) \n try:\n if d != cwd:\n logger.info(\"Change directory : %s\" % d)\n os.chdir(d)\n except Exception, e: \n logger.exception(\"Change directory failed\")\n raise \n except IndexError:\n logger.exception(\"Change directory failed\")\n \ndef decompress_file(src,dst,logger = None):\n if not logger:\n logger = logging\n logger.info(\"Upacking %s->%s\" % (src,dst))\n try:\n f = gzip.open(src,'rb')\n contents = f.read(-1)\n f = open(dst, 'wb')\n f.write(contents)\n except Exception, e: \n logger.exception(\"Unpack failed\")\n raise \n\n \ndef untar_file(file,dst_dir='.',logger = None,silent_failure = 0): \n if not logger:\n logger = logging\n logger.info(\"Untarring file: %s\" % (file))\n try:\n run_command('tar -xf ' + file,directory = dst_dir,\n logger=logger, silent_failure = silent_failure)\n except Exception, e:\n if not silent_failure: \n logger.exception(\"Untar failed\")\n raise \n\ndef unpack_file(file,logger = None):\n \"\"\" equivalent to 'tar -xzvf file'\n \"\"\"\n dst = 'tmp.tar'\n decompress_file(file,dst,logger) \n untar_file(dst.logger)\n remove_file(dst,logger) \n\n\ndef run_command(cmd,directory='.',logger=None,silent_failure = 0):\n if not logger:\n logger = logging\n change_dir(directory,logger) \n try: \n msg = 'Running: %s' % cmd\n logger.info(msg) \n status,text = exec_command(cmd)\n if status and silent_failure:\n msg = '(failed silently)'\n logger.info(msg) \n if status and text and not silent_failure:\n logger.error('Command Failed (status=%d)\\n'% status +text)\n finally:\n unchange_dir(logger)\n if status:\n raise ValueError, (status,text)\n return text \n\ndef mail_report(from_addr,to_addr,subject,mail_server,\n build_log, test_results,info):\n \n msg = ''\n msg = msg + 'To: %s\\n' % to_addr\n msg = msg + 'Subject: %s\\n' % subject\n msg = msg + '\\r\\n\\r\\n'\n\n for k,v in info.items(): \n msg = msg + '%s: %s\\n' % (k,v)\n msg = msg + test_results + '\\n'\n msg = msg + '-----------------------------\\n' \n msg = msg + '-------- BUILD LOG -------\\n' \n msg = msg + '-----------------------------\\n' \n msg = msg + build_log\n print msg\n \n # mail results\n import smtplib \n server = smtplib.SMTP(mail_server) \n server.sendmail(from_addr, to_addr, msg)\n server.quit()\n \n\ndef full_scipy_build(build_dir = '.',\n test_level = 10,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot'):\n \n # for now the atlas version is ignored. Only the \n # binaries for RH are supported at the moment.\n\n build_info = {'python_version' : python_version,\n 'test_level' : test_level,\n 'numeric_version': numeric_version,\n 'f2py_version' : f2py_version,\n 'atlas_version' : atlas_version,\n 'scipy_version' : scipy_version}\n \n dst_dir = os.path.join(build_dir,sys.platform)\n\n logger = logging.Logger(\"SciPy Test\")\n fmt = logging.Formatter(logging.BASIC_FORMAT)\n log_stream = cStringIO.StringIO()\n stream_handler = logging.StreamHandler(log_stream)\n stream_handler.setFormatter(fmt)\n logger.addHandler(stream_handler)\n # also write to stderr\n stderr = logging.StreamHandler()\n stderr.setFormatter(fmt)\n logger.addHandler(stderr)\n\n try:\n try: \n \n # before doing anything, we need to wipe the \n # /bin, /lib, /man, and /include directories\n # in dst_dir. Don't run as root. \n make_dir(dst_dir,logger=logger) \n change_dir(dst_dir , logger)\n for d in ['bin','lib','man','include']:\n try: remove_tree(d, logger)\n except OSError: pass \n unchange_dir(logger)\n \n python = python_installation(version=python_version,\n logger = logger,\n dst_dir = dst_dir)\n python.install()\n \n python_name = python.get_exe_name()\n \n numeric = numeric_installation(version=numeric_version,\n dst_dir = dst_dir,\n logger = logger,\n python_exe=python_name)\n numeric.install()\n \n f2py = f2py_installation(version=f2py_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n f2py.install() \n \n # download files don't have a version specified \n #lapack = lapack_installation(version='',\n # dst_dir = dst_dir\n # python_exe=python_name)\n #lapack.install() \n \n # download files don't have a version specified \n #blas = blas_installation(version='',\n # logger = logger,\n # dst_dir = dst_dir,\n # python_exe=python_name)\n #blas.install() \n \n # ATLAS\n atlas = atlas_installation(version=atlas_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n atlas.install()\n \n # version not currently used -- need to fix this.\n scipy = scipy_installation(version=scipy_version,\n logger = logger,\n dst_dir = dst_dir,\n python_exe=python_name)\n scipy.install() \n \n # The change to tmp makes sure there isn't a scipy directory in \n # the local scope.\n # All tests are run.\n logger.info('Beginning Test')\n cmd = python_name +' -c \"import sys,scipy;suite=scipy.test(%d);\"'\\\n % test_level\n test_results = run_command(cmd, logger=logger,\n directory = tempfile.gettempdir())\n build_info['results'] = 'test completed (check below for pass/fail)'\n except Exception, msg:\n test_results = ''\n build_info['results'] = 'build failed: %s' % msg\n logger.exception('Build failed')\n finally: \n to_addr = \"scipy-testlog@scipy.org\"\n from_addr = \"scipy-test@enthought.com\"\n subject = '%s,py%s,num%s,scipy%s' % (sys.platform,python_version,\n numeric_version,scipy_version) \n build_log = log_stream.getvalue()\n mail_report(from_addr,to_addr,subject,local_mail_server,\n build_log,test_results,build_info)\n\nif __name__ == '__main__':\n build_dir = '/tmp/scipy_test'\n level = 10\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.2.1',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n \"\"\"\n # an older python\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '21.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n # an older numeric\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.3',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n \"\"\"\n # This fails because multiarray doesn't have \n # arange defined.\n \"\"\"\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '20.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '19.0.0',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n\n full_scipy_build(build_dir = build_dir,\n test_level = level,\n python_version = '2.1.3',\n numeric_version = '18.4.1',\n f2py_version = '2.13.175-1250',\n atlas_version = '3.3.14',\n scipy_version = 'snapshot')\n \"\"\"\n", + "methods": [ + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 76, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 45, + "end_line": 76, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "init_names", + "long_name": "init_names( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 78, + "end_line": 80, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_source", + "long_name": "get_source( self )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 4, + "token_count": 39, + "parameters": [ + "self" + ], + "start_line": 82, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 99, + "end_line": 102, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "get_source_local", + "long_name": "get_source_local( self )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 2, + "token_count": 74, + "parameters": [ + "self" + ], + "start_line": 104, + "end_line": 115, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "get_source_ftp", + "long_name": "get_source_ftp( self )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 1, + "token_count": 136, + "parameters": [ + "self" + ], + "start_line": 117, + "end_line": 136, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , sub_dir = None )", + "filename": "auto_test.py", + "nloc": 20, + "complexity": 5, + "token_count": 153, + "parameters": [ + "self", + "sub_dir" + ], + "start_line": 138, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 172, + "end_line": 174, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 176, + "end_line": 178, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , prefix = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 2, + "token_count": 45, + "parameters": [ + "self", + "prefix" + ], + "start_line": 180, + "end_line": 184, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "python_setup", + "long_name": "python_setup( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 186, + "end_line": 188, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 1, + "token_count": 96, + "parameters": [ + "self", + "kw" + ], + "start_line": 190, + "end_line": 202, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 17, + "complexity": 2, + "token_count": 154, + "parameters": [ + "self" + ], + "start_line": 204, + "end_line": 222, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 73, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 230, + "end_line": 239, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 68, + "parameters": [ + "self" + ], + "start_line": 241, + "end_line": 253, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 260, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_exe_name", + "long_name": "get_exe_name( self )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 56, + "parameters": [ + "self" + ], + "start_line": 262, + "end_line": 267, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 275, + "end_line": 285, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , subdir = None )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "subdir" + ], + "start_line": 287, + "end_line": 292, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 294, + "end_line": 296, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "kw" + ], + "start_line": 297, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 302, + "end_line": 307, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 315, + "end_line": 325, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 327, + "end_line": 334, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "kw" + ], + "start_line": 336, + "end_line": 338, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self", + "kw" + ], + "start_line": 340, + "end_line": 344, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 352, + "end_line": 360, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 369, + "end_line": 378, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 389, + "end_line": 399, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 401, + "end_line": 402, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 403, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "kw" + ], + "start_line": 405, + "end_line": 409, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 417, + "end_line": 425, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self" + ], + "start_line": 427, + "end_line": 441, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "copy_file", + "long_name": "copy_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 463, + "end_line": 471, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "copy_tree", + "long_name": "copy_tree( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 473, + "end_line": 481, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_tree", + "long_name": "remove_tree( directory , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 46, + "parameters": [ + "directory", + "logger" + ], + "start_line": 483, + "end_line": 491, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_file", + "long_name": "remove_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "file", + "logger" + ], + "start_line": 493, + "end_line": 501, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_file", + "long_name": "write_file( file , contents , logger = None , mode = 'wb' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 3, + "token_count": 63, + "parameters": [ + "file", + "contents", + "logger", + "mode" + ], + "start_line": 503, + "end_line": 513, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "make_dir", + "long_name": "make_dir( name , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 51, + "parameters": [ + "name", + "logger" + ], + "start_line": 515, + "end_line": 523, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "change_dir", + "long_name": "change_dir( d , logger = None )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 4, + "token_count": 78, + "parameters": [ + "d", + "logger" + ], + "start_line": 528, + "end_line": 541, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "unchange_dir", + "long_name": "unchange_dir( logger = None )", + "filename": "auto_test.py", + "nloc": 16, + "complexity": 5, + "token_count": 76, + "parameters": [ + "logger" + ], + "start_line": 547, + "end_line": 562, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "decompress_file", + "long_name": "decompress_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 12, + "complexity": 3, + "token_count": 77, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 564, + "end_line": 575, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "untar_file", + "long_name": "untar_file( file , dst_dir = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 4, + "token_count": 70, + "parameters": [ + "file", + "dst_dir", + "logger", + "silent_failure" + ], + "start_line": 578, + "end_line": 588, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "unpack_file", + "long_name": "unpack_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 33, + "parameters": [ + "file", + "logger" + ], + "start_line": 590, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 9, + "token_count": 102, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 599, + "end_line": 616, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 0 + }, + { + "name": "mail_report", + "long_name": "mail_report( from_addr , to_addr , subject , mail_server , build_log , test_results , info )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 2, + "token_count": 115, + "parameters": [ + "from_addr", + "to_addr", + "subject", + "mail_server", + "build_log", + "test_results", + "info" + ], + "start_line": 618, + "end_line": 639, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , test_level = 10 , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 74, + "complexity": 5, + "token_count": 417, + "parameters": [ + "build_dir", + "test_level", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 642, + "end_line": 752, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 111, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 2, + "token_count": 76, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 45, + "end_line": 76, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 32, + "top_nesting_level": 1 + }, + { + "name": "init_names", + "long_name": "init_names( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 36, + "parameters": [ + "self" + ], + "start_line": 78, + "end_line": 80, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_source", + "long_name": "get_source( self )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 4, + "token_count": 39, + "parameters": [ + "self" + ], + "start_line": 82, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 99, + "end_line": 102, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "get_source_local", + "long_name": "get_source_local( self )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 2, + "token_count": 74, + "parameters": [ + "self" + ], + "start_line": 104, + "end_line": 115, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "get_source_ftp", + "long_name": "get_source_ftp( self )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 1, + "token_count": 136, + "parameters": [ + "self" + ], + "start_line": 117, + "end_line": 136, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , sub_dir = None )", + "filename": "auto_test.py", + "nloc": 20, + "complexity": 5, + "token_count": 153, + "parameters": [ + "self", + "sub_dir" + ], + "start_line": 138, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 172, + "end_line": 174, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 176, + "end_line": 178, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , prefix = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 2, + "token_count": 45, + "parameters": [ + "self", + "prefix" + ], + "start_line": 180, + "end_line": 184, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "python_setup", + "long_name": "python_setup( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 26, + "parameters": [ + "self" + ], + "start_line": 186, + "end_line": 188, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "_make", + "long_name": "_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 10, + "complexity": 1, + "token_count": 96, + "parameters": [ + "self", + "kw" + ], + "start_line": 190, + "end_line": 202, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "install", + "long_name": "install( self )", + "filename": "auto_test.py", + "nloc": 17, + "complexity": 2, + "token_count": 154, + "parameters": [ + "self" + ], + "start_line": 204, + "end_line": 222, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 73, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 230, + "end_line": 239, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "write_install_config", + "long_name": "write_install_config( self )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 68, + "parameters": [ + "self" + ], + "start_line": 241, + "end_line": 253, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 260, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_exe_name", + "long_name": "get_exe_name( self )", + "filename": "auto_test.py", + "nloc": 6, + "complexity": 1, + "token_count": 56, + "parameters": [ + "self" + ], + "start_line": 262, + "end_line": 267, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 275, + "end_line": 285, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "unpack_source", + "long_name": "unpack_source( self , subdir = None )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "subdir" + ], + "start_line": 287, + "end_line": 292, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 294, + "end_line": 296, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 30, + "parameters": [ + "self", + "kw" + ], + "start_line": 297, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "kw" + ], + "start_line": 302, + "end_line": 307, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 8, + "complexity": 1, + "token_count": 65, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 315, + "end_line": 325, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self" + ], + "start_line": 327, + "end_line": 334, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 3, + "complexity": 1, + "token_count": 25, + "parameters": [ + "self", + "kw" + ], + "start_line": 336, + "end_line": 338, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 52, + "parameters": [ + "self", + "kw" + ], + "start_line": 340, + "end_line": 344, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 352, + "end_line": 360, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 64, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 369, + "end_line": 378, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 389, + "end_line": 399, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "auto_configure", + "long_name": "auto_configure( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 401, + "end_line": 402, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "build_with_make", + "long_name": "build_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "kw" + ], + "start_line": 403, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "install_with_make", + "long_name": "install_with_make( self , ** kw )", + "filename": "auto_test.py", + "nloc": 4, + "complexity": 1, + "token_count": 44, + "parameters": [ + "self", + "kw" + ], + "start_line": 405, + "end_line": 409, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , version = '' , dst_dir = '.' , logger = None , python_exe = 'python' )", + "filename": "auto_test.py", + "nloc": 7, + "complexity": 1, + "token_count": 60, + "parameters": [ + "self", + "version", + "dst_dir", + "logger", + "python_exe" + ], + "start_line": 417, + "end_line": 425, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "local_source_up_to_date", + "long_name": "local_source_up_to_date( self )", + "filename": "auto_test.py", + "nloc": 13, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self" + ], + "start_line": 427, + "end_line": 441, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "copy_file", + "long_name": "copy_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 463, + "end_line": 471, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "copy_tree", + "long_name": "copy_tree( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 52, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 473, + "end_line": 481, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_tree", + "long_name": "remove_tree( directory , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 46, + "parameters": [ + "directory", + "logger" + ], + "start_line": 483, + "end_line": 491, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "remove_file", + "long_name": "remove_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 44, + "parameters": [ + "file", + "logger" + ], + "start_line": 493, + "end_line": 501, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "write_file", + "long_name": "write_file( file , contents , logger = None , mode = 'wb' )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 3, + "token_count": 63, + "parameters": [ + "file", + "contents", + "logger", + "mode" + ], + "start_line": 503, + "end_line": 513, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "make_dir", + "long_name": "make_dir( name , logger = None )", + "filename": "auto_test.py", + "nloc": 9, + "complexity": 3, + "token_count": 51, + "parameters": [ + "name", + "logger" + ], + "start_line": 515, + "end_line": 523, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 0 + }, + { + "name": "change_dir", + "long_name": "change_dir( d , logger = None )", + "filename": "auto_test.py", + "nloc": 14, + "complexity": 4, + "token_count": 78, + "parameters": [ + "d", + "logger" + ], + "start_line": 528, + "end_line": 541, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 14, + "top_nesting_level": 0 + }, + { + "name": "unchange_dir", + "long_name": "unchange_dir( logger = None )", + "filename": "auto_test.py", + "nloc": 16, + "complexity": 5, + "token_count": 76, + "parameters": [ + "logger" + ], + "start_line": 547, + "end_line": 562, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 0 + }, + { + "name": "decompress_file", + "long_name": "decompress_file( src , dst , logger = None )", + "filename": "auto_test.py", + "nloc": 12, + "complexity": 3, + "token_count": 77, + "parameters": [ + "src", + "dst", + "logger" + ], + "start_line": 564, + "end_line": 575, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 0 + }, + { + "name": "untar_file", + "long_name": "untar_file( file , dst_dir = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 11, + "complexity": 4, + "token_count": 70, + "parameters": [ + "file", + "dst_dir", + "logger", + "silent_failure" + ], + "start_line": 578, + "end_line": 588, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + }, + { + "name": "unpack_file", + "long_name": "unpack_file( file , logger = None )", + "filename": "auto_test.py", + "nloc": 5, + "complexity": 1, + "token_count": 33, + "parameters": [ + "file", + "logger" + ], + "start_line": 590, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 7, + "top_nesting_level": 0 + }, + { + "name": "run_command", + "long_name": "run_command( cmd , directory = '.' , logger = None , silent_failure = 0 )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 9, + "token_count": 102, + "parameters": [ + "cmd", + "directory", + "logger", + "silent_failure" + ], + "start_line": 599, + "end_line": 616, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 0 + }, + { + "name": "mail_report", + "long_name": "mail_report( from_addr , to_addr , subject , mail_server , build_log , test_results , info )", + "filename": "auto_test.py", + "nloc": 18, + "complexity": 2, + "token_count": 115, + "parameters": [ + "from_addr", + "to_addr", + "subject", + "mail_server", + "build_log", + "test_results", + "info" + ], + "start_line": 618, + "end_line": 639, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "full_scipy_build", + "long_name": "full_scipy_build( build_dir = '.' , test_level = 10 , python_version = '2.2.1' , numeric_version = '21.0' , f2py_version = '2.13.175-1250' , atlas_version = '3.3.14' , scipy_version = 'snapshot' )", + "filename": "auto_test.py", + "nloc": 74, + "complexity": 5, + "token_count": 417, + "parameters": [ + "build_dir", + "test_level", + "python_version", + "numeric_version", + "f2py_version", + "atlas_version", + "scipy_version" + ], + "start_line": 642, + "end_line": 752, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 111, + "top_nesting_level": 0 + } + ], + "changed_methods": [], + "nloc": 538, + "complexity": 100, + "token_count": 3462, + "diff_parsed": { + "added": [ + "", + "" + ], + "deleted": [ + " \"\"\"", + " \"\"\"" + ] + } + } + ] + }, + { + "hash": "40006b76c878853d4b2ed3be9c264071e6cea220", + "msg": "Introduced F compiler without any support for it because of it cannot compile fixed format F90 sources:(. Added hooks for colored messages for certain terminals, let me know if you hate it;)", + "author": { + "name": "Pearu Peterson", + "email": "pearu.peterson@gmail.com" + }, + "committer": { + "name": "Pearu Peterson", + "email": "pearu.peterson@gmail.com" + }, + "author_date": "2002-05-05T22:05:38+00:00", + "author_timezone": 0, + "committer_date": "2002-05-05T22:05:38+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "b0e9c8f02bb3c4a879039eac3c2ad43860ca4a3b" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 9, + "insertions": 87, + "lines": 96, + "files": 1, + "dmm_unit_size": 0.1724137931034483, + "dmm_unit_complexity": 1.0, + "dmm_unit_interfacing": 0.1724137931034483, + "modified_files": [ + { + "old_path": "scipy_distutils/command/build_flib.py", + "new_path": "scipy_distutils/command/build_flib.py", + "filename": "build_flib.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -25,6 +25,13 @@\n compilers is based on only checking the availability of the\n corresponding F77 compiler. If it exists, then F90 is assumed\n to exist also.\n+ *** F compiler from Fortran Compiler is _not_ supported, though it\n+ is defined below. The reasons is that this F95 compiler is\n+ incomplete: it does not compile fixed format sources and\n+ that is needed by f2py generated wrappers for F90 modules.\n+ To support F as it is, some effort is needed to re-code\n+ f2py but it is not clear if this effort is worth.\n+ May be in future...\n \n Open issues:\n *** User-defined compiler flags. Do we need --fflags?\n@@ -39,6 +46,7 @@\n Compaq\n Gnu\n VAST\n+ F [unsupported]\n \"\"\"\n \n import distutils\n@@ -64,12 +72,29 @@ def run_command(command):\n return 0, text\n else:\n run_command = commands.getstatusoutput\n- \n+\n+# Hooks for colored terminal output. Could be in a more general use.\n+# See also http://www.livinglogic.de/Python/ansistyle\n+if os.environ.get('TERM',None) in ['rxvt','xterm']:\n+ # Need a better way to determine whether a terminal supports colors\n+ def red_text(s): return '\\x1b[31m%s\\x1b[0m'%s\n+ def green_text(s): return '\\x1b[32m%s\\x1b[0m'%s\n+ def yellow_text(s): return '\\x1b[33m%s\\x1b[0m'%s\n+ def blue_text(s): return '\\x1b[34m%s\\x1b[0m'%s\n+ def cyan_text(s): return '\\x1b[35m%s\\x1b[0m'%s\n+else:\n+ def red_text(s): return s\n+ def green_text(s): return s\n+ def yellow_text(s): return s\n+ def cyan_text(s): return s\n+ def blue_text(s): return s\n+\n+\n def show_compilers():\n for compiler_class in all_compilers:\n compiler = compiler_class()\n if compiler.is_available():\n- print compiler\n+ print cyan_text(compiler)\n \n class build_flib (build_clib):\n \n@@ -127,7 +152,7 @@ def finalize_options (self):\n if not fc:\n raise DistutilsOptionError, 'Fortran compiler not available: %s'%(self.fcompiler)\n else:\n- self.announce(' using %s Fortran compiler' % fc)\n+ self.announce(cyan_text(' using %s Fortran compiler' % fc))\n self.fcompiler = fc\n if self.has_f_libraries():\n self.fortran_libraries = self.distribution.fortran_libraries\n@@ -148,6 +173,9 @@ def run (self):\n \n def has_f_library(self,name):\n if self.has_f_libraries():\n+ # If self.fortran_libraries is None at this point\n+ # then it means that build_flib was called before\n+ # build. Always call build before build_flib.\n for (lib_name, build_info) in self.fortran_libraries:\n if lib_name == name:\n return 1\n@@ -275,7 +303,6 @@ def build_libraries (self, fortran_libraries):\n \n # build_libraries ()\n \n-\n class fortran_compiler_base(CCompiler):\n \n vendor = None\n@@ -353,7 +380,7 @@ def f_compile(self,compiler,switches, source_files,\n cmd = compiler + ' ' + switches + ' '+\\\n module_switch + \\\n ' -c ' + source + ' -o ' + object \n- print cmd\n+ print yellow_text(cmd)\n failure = os.system(cmd)\n if failure:\n raise FortranCompileError, 'failure during compile' \n@@ -386,10 +413,10 @@ def create_static_lib(self, object_files, library_name,\n objects = string.join(object_files)\n if objects:\n cmd = 'ar -cur %s %s' % (lib_file,objects)\n- print cmd\n+ print yellow_text(cmd)\n os.system(cmd)\n cmd = 'ranlib %s ' % lib_file\n- print cmd\n+ print yellow_text(cmd)\n os.system(cmd)\n \n def build_library(self,library_name,source_list,module_dirs=None,\n@@ -445,13 +472,16 @@ def get_version(self):\n return self.version\n self.version = ''\n # works I think only for unix... \n- print 'command:', self.ver_cmd\n+ print 'command:', yellow_text(self.ver_cmd)\n exit_status, out_text = run_command(self.ver_cmd)\n- print exit_status, out_text\n+ print exit_status,\n if not exit_status:\n+ print green_text(out_text)\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n+ else:\n+ print red_text(out_text)\n return self.version\n \n def get_libraries(self):\n@@ -813,6 +843,53 @@ def get_opt(self):\n def get_linker_so(self):\n return [self.f77_compiler,'-Wl,-shared']\n \n+# http://www.fortran.com/F/compilers.html\n+#\n+# We define F compiler here but it is quite useless\n+# because it does not support for fixed format sources\n+# which makes it impossible to use with f2py generated\n+# fixed format wrappers to F90 modules.\n+class f_fortran_compiler(fortran_compiler_base):\n+\n+ vendor = 'F'\n+ ver_match = r'Fortran Company/NAG F compiler Release (?P[^\\s]*)'\n+\n+ def __init__(self, fc = None, f90c = None):\n+ fortran_compiler_base.__init__(self)\n+\n+ if fc is None:\n+ fc = 'F'\n+ if f90c is None:\n+ f90c = 'F'\n+\n+ self.f77_compiler = fc\n+ self.f90_compiler = f90c\n+ self.ver_cmd = self.f90_compiler+' -V '\n+\n+ gnu = gnu_fortran_compiler('g77')\n+ if not gnu.is_available(): # F compiler requires gcc.\n+ self.version = ''\n+ return\n+ if not self.is_available():\n+ return\n+\n+ print red_text(\"\"\"\n+WARNING: F compiler is unsupported due to its incompleteness.\n+ Send complaints to its vendor. For adding its support\n+ to scipy_distutils, it must be able to compile\n+ fixed format Fortran 90.\n+\"\"\")\n+\n+ self.f90_switches = ''\n+ self.f90_debug = ' -g -gline -g90 -C '\n+ self.f90_opt = ' -O '\n+\n+ #self.f77_switches = gnu.f77_switches\n+ #self.f77_debug = gnu.f77_debug\n+ #self.f77_opt = gnu.f77_opt\n+\n+ def get_linker_so(self):\n+ return ['gcc','-shared']\n \n class vast_fortran_compiler(fortran_compiler_base):\n \n@@ -921,6 +998,7 @@ def find_fortran_compiler(vendor = None, fc = None, f90c = None):\n nag_fortran_compiler,\n compaq_fortran_compiler,\n vast_fortran_compiler,\n+ f_fortran_compiler,\n gnu_fortran_compiler,\n ]\n \n", + "added_lines": 87, + "deleted_lines": 9, + "source_code": "\"\"\" Implements the build_flib command which should go into Distutils\n at some point.\n \n Note:\n Right now, we're dynamically linking to the Fortran libraries on \n some platforms (Sun for sure). This is fine for local installations\n but a bad thing for redistribution because these libraries won't\n live on any machine that doesn't have a fortran compiler installed.\n It is pretty hard (impossible?) to get gcc to pass the right compiler\n flags on Sun to get the linker to use static libs for the fortran\n stuff. Investigate further...\n\nBugs:\n *** Options -e and -x have no effect when used with --help-compiler\n options. E.g. \n ./setup.py build_flib --help-compiler -e g77-3.0\n finds g77-2.95.\n How to extract these options inside the show_compilers function?\n *** compiler.is_available() method may not work correctly on nt\n because of lack of knowledge how to get exit status in\n run_command function. However, it may give reasonable results\n based on a version string.\n *** Some vendors provide different compilers for F77 and F90\n compilations. Currently, checking the availability of these\n compilers is based on only checking the availability of the\n corresponding F77 compiler. If it exists, then F90 is assumed\n to exist also.\n *** F compiler from Fortran Compiler is _not_ supported, though it\n is defined below. The reasons is that this F95 compiler is\n incomplete: it does not compile fixed format sources and\n that is needed by f2py generated wrappers for F90 modules.\n To support F as it is, some effort is needed to re-code\n f2py but it is not clear if this effort is worth.\n May be in future...\n\nOpen issues:\n *** User-defined compiler flags. Do we need --fflags?\n\nFortran compilers (as to be used with --fcompiler= option):\n Absoft\n Sun\n SGI\n Intel\n Itanium\n NAG\n Compaq\n Gnu\n VAST\n F [unsupported]\n\"\"\"\n\nimport distutils\nimport distutils.dep_util, distutils.dir_util\nimport os,sys,string\nimport commands,re\nfrom types import *\nfrom distutils.ccompiler import CCompiler,gen_preprocess_options\nfrom distutils.command.build_clib import build_clib\nfrom distutils.errors import *\n\nclass FortranCompilerError (CCompilerError):\n \"\"\"Some compile/link operation failed.\"\"\"\nclass FortranCompileError (FortranCompilerError):\n \"\"\"Failure to compile one or more Fortran source files.\"\"\"\n\nif os.name == 'nt':\n def run_command(command):\n \"\"\" not sure how to get exit status on nt. \"\"\"\n in_pipe,out_pipe = os.popen4(command)\n in_pipe.close()\n text = out_pipe.read()\n return 0, text\nelse:\n run_command = commands.getstatusoutput\n\n# Hooks for colored terminal output. Could be in a more general use.\n# See also http://www.livinglogic.de/Python/ansistyle\nif os.environ.get('TERM',None) in ['rxvt','xterm']:\n # Need a better way to determine whether a terminal supports colors\n def red_text(s): return '\\x1b[31m%s\\x1b[0m'%s\n def green_text(s): return '\\x1b[32m%s\\x1b[0m'%s\n def yellow_text(s): return '\\x1b[33m%s\\x1b[0m'%s\n def blue_text(s): return '\\x1b[34m%s\\x1b[0m'%s\n def cyan_text(s): return '\\x1b[35m%s\\x1b[0m'%s\nelse:\n def red_text(s): return s\n def green_text(s): return s\n def yellow_text(s): return s\n def cyan_text(s): return s\n def blue_text(s): return s\n\n\ndef show_compilers():\n for compiler_class in all_compilers:\n compiler = compiler_class()\n if compiler.is_available():\n print cyan_text(compiler)\n\nclass build_flib (build_clib):\n\n description = \"build f77/f90 libraries used by Python extensions\"\n\n user_options = [\n ('build-flib', 'b',\n \"directory to build f77/f90 libraries to\"),\n ('build-temp', 't',\n \"directory to put temporary build by-products\"),\n ('debug', 'g',\n \"compile with debugging information\"),\n ('force', 'f',\n \"forcibly build everything (ignore file timestamps)\"),\n ('fcompiler=', 'c',\n \"specify the compiler type\"),\n ('fcompiler-exec=', 'e',\n \"specify the path to F77 compiler\"),\n ('f90compiler-exec=', 'x',\n \"specify the path to F90 compiler\"),\n ]\n\n boolean_options = ['debug', 'force']\n\n help_options = [\n ('help-compiler', None,\n \"list available compilers\", show_compilers),\n ]\n\n def initialize_options (self):\n\n self.build_flib = None\n self.build_temp = None\n\n self.fortran_libraries = None\n self.define = None\n self.undef = None\n self.debug = None\n self.force = 0\n self.fcompiler = None\n self.fcompiler_exec = None\n self.f90compiler_exec = None\n\n # initialize_options()\n\n def finalize_options (self):\n self.set_undefined_options('build',\n ('build_temp', 'build_flib'),\n ('build_temp', 'build_temp'),\n ('debug', 'debug'),\n ('force', 'force'))\n fc = find_fortran_compiler(self.fcompiler,\n self.fcompiler_exec,\n self.f90compiler_exec)\n if not fc:\n raise DistutilsOptionError, 'Fortran compiler not available: %s'%(self.fcompiler)\n else:\n self.announce(cyan_text(' using %s Fortran compiler' % fc))\n self.fcompiler = fc\n if self.has_f_libraries():\n self.fortran_libraries = self.distribution.fortran_libraries\n self.check_library_list(self.fortran_libraries)\n \n # finalize_options()\n\n def has_f_libraries(self):\n return self.distribution.fortran_libraries \\\n and len(self.distribution.fortran_libraries) > 0\n\n def run (self):\n if not self.has_f_libraries():\n return\n self.build_libraries(self.fortran_libraries)\n\n # run ()\n\n def has_f_library(self,name):\n if self.has_f_libraries():\n # If self.fortran_libraries is None at this point\n # then it means that build_flib was called before\n # build. Always call build before build_flib.\n for (lib_name, build_info) in self.fortran_libraries:\n if lib_name == name:\n return 1\n \n def get_library_names(self, name=None):\n if not self.has_f_libraries():\n return None\n\n lib_names = []\n\n if name is None:\n for (lib_name, build_info) in self.fortran_libraries:\n lib_names.append(lib_name)\n\n if self.fcompiler is not None:\n lib_names.extend(self.fcompiler.get_libraries())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n for n in build_info.get('libraries',[]):\n lib_names.append(n)\n #XXX: how to catch recursive calls here?\n lib_names.extend(self.get_library_names(n))\n break\n return lib_names\n\n def get_fcompiler_library_names(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_libraries()\n return []\n\n def get_fcompiler_library_dirs(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_library_dirs()\n return []\n\n # get_library_names ()\n\n def get_library_dirs(self, name=None):\n if not self.has_f_libraries():\n return []\n\n lib_dirs = [] \n\n if name is None:\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_library_dirs())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n lib_dirs.extend(build_info.get('library_dirs',[]))\n for n in build_info.get('libraries',[]):\n lib_dirs.extend(self.get_library_dirs(n))\n break\n\n return lib_dirs\n\n # get_library_dirs ()\n\n def get_runtime_library_dirs(self):\n #if not self.has_f_libraries():\n # return []\n\n lib_dirs = []\n\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_runtime_library_dirs())\n \n return lib_dirs\n\n # get_library_dirs ()\n\n def get_source_files (self):\n if not self.has_f_libraries():\n return []\n\n self.check_library_list(self.fortran_libraries)\n filenames = []\n\n # Gets source files specified \n for ext in self.fortran_libraries:\n filenames.extend(ext[1]['sources'])\n\n return filenames \n \n def build_libraries (self, fortran_libraries):\n \n fcompiler = self.fcompiler\n \n for (lib_name, build_info) in fortran_libraries:\n self.announce(\" building '%s' library\" % lib_name)\n\n sources = build_info.get('sources')\n if sources is None or type(sources) not in (ListType, TupleType):\n raise DistutilsSetupError, \\\n (\"in 'fortran_libraries' option (library '%s'), \" +\n \"'sources' must be present and must be \" +\n \"a list of source filenames\") % lib_name\n sources = list(sources)\n module_dirs = build_info.get('module_dirs')\n module_files = build_info.get('module_files')\n\n\n include_dirs = build_info.get('include_dirs')\n\n if include_dirs:\n fcompiler.set_include_dirs(include_dirs)\n for n,v in build_info.get('define_macros') or []:\n fcompiler.define_macro(n,v)\n for n in build_info.get('undef_macros') or []:\n fcompiler.undefine_macro(n)\n\n if module_files:\n fcompiler.build_library(lib_name, module_files,\n temp_dir=self.build_temp)\n \n fcompiler.build_library(lib_name, sources,\n module_dirs, temp_dir=self.build_temp)\n\n # for loop\n\n # build_libraries ()\n\nclass fortran_compiler_base(CCompiler):\n\n vendor = None\n ver_match = None\n\n compiler_type = 'fortran'\n executables = {}\n \n def __init__(self,verbose=0,dry_run=0,force=0):\n # Default initialization. Constructors of derived classes MUST\n # call this function.\n CCompiler.__init__(self,verbose,dry_run,force)\n\n self.version = None\n \n self.f77_switches = ''\n self.f77_opt = ''\n self.f77_debug = ''\n \n self.f90_switches = ''\n self.f90_opt = ''\n self.f90_debug = ''\n \n #self.libraries = []\n #self.library_dirs = []\n\n if self.vendor is None:\n raise DistutilsInternalError,\\\n '%s must define vendor attribute'%(self.__class__)\n if self.ver_match is None:\n raise DistutilsInternalError,\\\n '%s must define ver_match attribute'%(self.__class__)\n\n def to_object(self,\n dirty_files,\n module_dirs=None,\n temp_dir=''):\n files = string.join(dirty_files)\n f90_files = get_f90_files(dirty_files)\n f77_files = get_f77_files(dirty_files)\n if f90_files != []:\n obj1 = self.f90_compile(f90_files,module_dirs,temp_dir = temp_dir)\n else:\n obj1 = []\n if f77_files != []:\n obj2 = self.f77_compile(f77_files, temp_dir = temp_dir)\n else:\n obj2 = []\n return obj1 + obj2\n\n def source_to_object_names(self,source_files, temp_dir=''):\n file_list = map(lambda x: os.path.basename(x),source_files)\n file_base_ext = map(lambda x: os.path.splitext(x),file_list)\n object_list = map(lambda x: x[0] +'.o',file_base_ext)\n object_files = map(lambda x,td=temp_dir: os.path.join(td,x),object_list)\n return object_files\n \n def source_and_object_pairs(self,source_files, temp_dir=''):\n object_files = self.source_to_object_names(source_files,temp_dir)\n file_pairs = zip(source_files,object_files)\n return file_pairs\n \n def f_compile(self,compiler,switches, source_files,\n module_dirs=None, temp_dir=''):\n\n pp_opts = gen_preprocess_options(self.macros,self.include_dirs)\n\n switches = switches + ' ' + string.join(pp_opts,' ')\n\n module_switch = self.build_module_switch(module_dirs)\n file_pairs = self.source_and_object_pairs(source_files,temp_dir)\n object_files = []\n for source,object in file_pairs:\n if distutils.dep_util.newer(source,object):\n cmd = compiler + ' ' + switches + ' '+\\\n module_switch + \\\n ' -c ' + source + ' -o ' + object \n print yellow_text(cmd)\n failure = os.system(cmd)\n if failure:\n raise FortranCompileError, 'failure during compile' \n object_files.append(object)\n return object_files\n #return all object files to make sure everything is archived \n #return map(lambda x: x[1], file_pairs)\n\n def f90_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f90_switches, self.f90_opt))\n return self.f_compile(self.f90_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n def f77_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f77_switches, self.f77_opt))\n return self.f_compile(self.f77_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n\n def build_module_switch(self, module_dirs):\n return ''\n\n def create_static_lib(self, object_files, library_name,\n output_dir='', debug=None):\n lib_file = os.path.join(output_dir,'lib'+library_name+'.a')\n newer = distutils.dep_util.newer\n # This doesn't work -- no way to know if the file is in the archive\n #object_files = filter(lambda o,lib=lib_file:\\\n # distutils.dep_util.newer(o,lib),object_files)\n objects = string.join(object_files)\n if objects:\n cmd = 'ar -cur %s %s' % (lib_file,objects)\n print yellow_text(cmd)\n os.system(cmd)\n cmd = 'ranlib %s ' % lib_file\n print yellow_text(cmd)\n os.system(cmd)\n\n def build_library(self,library_name,source_list,module_dirs=None,\n temp_dir = ''):\n #make sure the temp directory exists before trying to build files\n import distutils.dir_util\n distutils.dir_util.mkpath(temp_dir)\n\n #this compiles the files\n object_list = self.to_object(source_list,\n module_dirs,\n temp_dir)\n\n # actually we need to use all the object file names here to\n # make sure the library is always built. It could occur that an\n # object file exists but hasn't been put in the archive. (happens\n # a lot when builds fail once and are restarted).\n object_list = self.source_to_object_names(source_list, temp_dir)\n\n if os.name == 'nt':\n # This is pure bunk...\n # Windows fails for long argument strings on the command line.\n # if objects is real long (> 2048 chars or so on my machine),\n # the command fails (cmd.exe /e:2048 on w2k)\n # for now we'll split linking into to steps which should work for\n objects = object_list[:]\n while objects:\n obj,objects = objects[:20],objects[20:]\n self.create_static_lib(obj,library_name,temp_dir)\n else:\n self.create_static_lib(object_list,library_name,temp_dir)\n\n def dummy_fortran_files(self):\n import tempfile \n d = tempfile.gettempdir()\n dummy_name = os.path.join(d,'__dummy.f')\n dummy = open(dummy_name,'w')\n dummy.write(\" subroutine dummy()\\n end\\n\")\n dummy.close()\n return (os.path.join(d,'__dummy.f'),os.path.join(d,'__dummy.o'))\n \n def is_available(self):\n return self.get_version()\n \n def get_version(self):\n \"\"\"Return the compiler version. If compiler is not available,\n return empty string.\"\"\"\n # XXX: Is there compilers that have no version? If yes,\n # this test will fail even if the compiler is available.\n if self.version is not None:\n # Finding version is expensive, so return previously found\n # version string.\n return self.version\n self.version = ''\n # works I think only for unix... \n print 'command:', yellow_text(self.ver_cmd)\n exit_status, out_text = run_command(self.ver_cmd)\n print exit_status,\n if not exit_status:\n print green_text(out_text)\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n else:\n print red_text(out_text)\n return self.version\n\n def get_libraries(self):\n return self.libraries\n def get_library_dirs(self):\n return self.library_dirs\n def get_extra_link_args(self):\n return []\n def get_runtime_library_dirs(self):\n return []\n def get_linker_so(self):\n \"\"\"\n If a compiler requires specific linker then return a list\n containing a linker executable name and linker options.\n Otherwise, return None.\n \"\"\"\n\n def __str__(self):\n return \"%s %s\" % (self.vendor, self.get_version())\n\n\nclass absoft_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Absoft'\n ver_match = r'FORTRAN 77 Compiler (?P[^\\s*,]*).*?Absoft Corp'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n # got rid of -B108 cause it was generating 2 underscores instead\n # of one on the newest version. Now we use -YEXT_SFX=_ to \n # specify the output format\n if os.name == 'nt':\n self.f90_switches = '-f fixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -Q100'\n self.f77_switches = '-N22 -N90 -N110'\n self.f77_opt = '-O -Q100'\n self.libraries = ['fio', 'fmath', 'f90math', 'COMDLG32']\n else:\n self.f90_switches = '-ffixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -B101' \n self.f77_switches = '-N22 -N90 -N110 -B108'\n self.f77_opt = '-O -B101'\n\n self.libraries = ['fio', 'f77math', 'f90math']\n \n try:\n dir = os.environ['ABSOFT'] \n self.library_dirs = [os.path.join(dir,'lib')]\n except KeyError:\n self.library_dirs = []\n\n self.ver_cmd = self.f77_compiler + ' -V -c %s -o %s' % \\\n self.dummy_fortran_files()\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -p' + mod\n return res\n\n def get_extra_link_args(self):\n return []\n # Couldn't get this to link for anything using gcc.\n #dr = \"c:\\\\Absoft62\\\\lib\"\n #libs = ['fio.lib', 'COMDLG32.lib','fmath.lib', 'f90math.lib','libcomdlg32.a' ] \n #libs = map(lambda x,dr=dr:os.path.join(dr,x),libs)\n #return libs\n\n\nclass sun_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Sun'\n #ver_match = r'f77: (?P[^\\s*,]*)'\n ver_match = r'f90: Sun (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -pic '\n self.f77_opt = ' -fast -dalign '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -fixed ' # ??? why fixed?\n self.f90_opt = ' -fast -dalign '\n\n self.ver_cmd = self.f90_compiler + ' -V'\n\n #self.libraries = ['f90', 'F77', 'M77', 'sunmath', 'm']\n self.libraries = ['fsu', 'F77', 'M77', 'sunmath', 'm']\n \n #threaded\n #self.libraries = ['f90', 'F77_mt', 'sunmath_mt', 'm', 'thread']\n #self.libraries = []\n self.library_dirs = self.find_lib_dir()\n #print 'sun:',self.library_dirs\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -M' + mod\n return res\n\n def find_lib_dir(self):\n library_dirs = []\n lib_match = r'### f90: Note: LD_RUN_PATH\\s*= '\\\n '(?P[^\\s.]*).*'\n cmd = self.f90_compiler + ' -dryrun dummy.f'\n exit_status, output = run_command(cmd)\n if not exit_status:\n libs = re.findall(lib_match,output)\n if libs:\n library_dirs = string.split(libs[0],':')\n self.get_version() # force version calculation\n compiler_home = os.path.dirname(library_dirs[0])\n library_dirs.append(os.path.join(compiler_home,\n self.version,'lib'))\n return library_dirs\n def get_runtime_library_dirs(self):\n return self.find_lib_dir()\n def get_extra_link_args(self):\n return ['-mimpure-text']\n\n\nclass mips_fortran_compiler(fortran_compiler_base):\n\n vendor = 'SGI'\n ver_match = r'MIPSpro Compilers: Version (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -n32 -KPIC '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -n32 -KPIC -fixedform ' # why fixed ???\n self.f90_opt = ' ' \n\n self.ver_cmd = self.f77_compiler + ' -version'\n \n self.libraries = ['fortran', 'ftn', 'm']\n self.library_dirs = self.find_lib_dir()\n\n\n\n def build_module_switch(self,module_dirs):\n res = ''\n return res \n def find_lib_dir(self):\n library_dirs = []\n return library_dirs\n def get_runtime_library_dirs(self):\n\treturn self.find_lib_dir() \n def get_extra_link_args(self):\n\treturn []\n\n\nclass gnu_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Gnu'\n #ver_match = r'g77 version (?P[^\\s*]*)'\n ver_match = r'GNU Fortran (?P[^\\s*]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if sys.platform == 'win32':\n self.libraries = ['gcc','g2c']\n self.library_dirs = self.find_lib_directories()\n else:\n # On linux g77 does not need lib_directories to be specified.\n self.libraries = ['g2c']\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n\n switches = ' -Wall -fno-second-underscore '\n\n if os.name != 'nt':\n switches = switches + ' -fpic '\n\n self.f77_switches = switches\n #self.ver_cmd = self.f77_compiler + ' -v '\n self.ver_cmd = self.f77_compiler + ' --version'\n\n self.f77_opt = self.get_opt()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 -funroll-loops '\n \n # only check for more optimization if g77 can handle\n # it.\n if self.get_version():\n if self.version[0]=='3': # is g77 3.x.x\n if cpu.is_AthlonK6():\n opt = opt + ' -march=k6 '\n elif cpu.is_AthlonK7():\n opt = opt + ' -march=athlon '\n if cpu.is_i686():\n opt = opt + ' -march=i686 '\n elif cpu.is_i586():\n opt = opt + ' -march=i586 '\n elif cpu.is_i486():\n opt = opt + ' -march=i486 '\n elif cpu.is_i386():\n opt = opt + ' -march=i386 '\n if cpu.is_Intel():\n opt = opt + ' -malign-double ' \n return opt\n \n def find_lib_directories(self):\n lib_dir = []\n match = r'Reading specs from (.*)/specs'\n\n # works I think only for unix... \n exit_status, out_text = run_command('g77 -v')\n if not exit_status:\n m = re.findall(match,out_text)\n if m:\n lib_dir= m #m[0] \n return lib_dir\n\n def get_linker_so(self):\n # win32 linking should be handled by standard linker\n if sys.platform != 'win32' and os.uname()[0] != 'Darwin':\n return [self.f77_compiler,'-shared']\n \n def f90_compile(self,source_files,module_files,temp_dir=''):\n raise DistutilsExecError, 'f90 not supported by Gnu'\n\n\n#http://developer.intel.com/software/products/compilers/f50/linux/\nclass intel_ia32_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Intel' # Intel(R) Corporation \n ver_match = r'Intel\\(R\\) Fortran Compiler for 32-bit applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'ifc'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -KPIC '\n\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n if cpu.has_fdiv_bug():\n switches = switches + ' -fdiv_check '\n if cpu.has_f00f_bug():\n switches = switches + ' -0f_check '\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -FI -w90 -w95 '\n\n self.f77_opt = self.f90_opt = self.get_opt()\n \n debug = ' -g -C '\n self.f77_debug = self.f90_debug = debug\n\n self.ver_cmd = self.f77_compiler+' -FI -V -c %s -o %s' %\\\n self.dummy_fortran_files()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 '\n if cpu.is_PentiumPro() or cpu.is_PentiumII():\n opt = opt + ' -tpp6 -xi '\n elif cpu.is_PentiumIII():\n opt = opt + ' -tpp6 '\n elif cpu.is_Pentium():\n opt = opt + ' -tpp5 '\n elif cpu.is_PentiumIV():\n opt = opt + ' -tpp7 -xW '\n elif cpu.has_mmx():\n opt = opt + ' -xM '\n return opt\n \n\n def get_linker_so(self):\n return [self.f77_compiler,'-shared']\n\n\nclass intel_itanium_fortran_compiler(intel_ia32_fortran_compiler):\n\n vendor = 'Itanium'\n ver_match = r'Intel\\(R\\) Fortran 90 Compiler Itanium\\(TM\\) Compiler for the Itanium\\(TM\\)-based applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n if fc is None:\n fc = 'efc'\n intel_ia32_fortran_compiler.__init__(self, fc, f90c)\n\n\nclass nag_fortran_compiler(fortran_compiler_base):\n\n vendor = 'NAG'\n ver_match = r'NAGWare Fortran 95 compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'f95'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ''\n debug = ' -g -gline -g90 -nan -C '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -fixed '\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -target=native '\n return opt\n\n def get_linker_so(self):\n return [self.f77_compiler,'-Wl,-shared']\n\n# http://www.fortran.com/F/compilers.html\n#\n# We define F compiler here but it is quite useless\n# because it does not support for fixed format sources\n# which makes it impossible to use with f2py generated\n# fixed format wrappers to F90 modules.\nclass f_fortran_compiler(fortran_compiler_base):\n\n vendor = 'F'\n ver_match = r'Fortran Company/NAG F compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'F'\n if f90c is None:\n f90c = 'F'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n self.ver_cmd = self.f90_compiler+' -V '\n\n gnu = gnu_fortran_compiler('g77')\n if not gnu.is_available(): # F compiler requires gcc.\n self.version = ''\n return\n if not self.is_available():\n return\n\n print red_text(\"\"\"\nWARNING: F compiler is unsupported due to its incompleteness.\n Send complaints to its vendor. For adding its support\n to scipy_distutils, it must be able to compile\n fixed format Fortran 90.\n\"\"\")\n\n self.f90_switches = ''\n self.f90_debug = ' -g -gline -g90 -C '\n self.f90_opt = ' -O '\n\n #self.f77_switches = gnu.f77_switches\n #self.f77_debug = gnu.f77_debug\n #self.f77_opt = gnu.f77_opt\n\n def get_linker_so(self):\n return ['gcc','-shared']\n\nclass vast_fortran_compiler(fortran_compiler_base):\n\n vendor = 'VAST'\n ver_match = r'\\s*Pacific-Sierra Research vf90 (Personal|Professional)\\s+(?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n d,b = os.path.split(f90c)\n vf90 = os.path.join(d,'v'+b)\n self.ver_cmd = vf90+' -v '\n\n gnu = gnu_fortran_compiler(fc)\n if not gnu.is_available(): # VAST compiler requires g77.\n self.version = ''\n return\n if not self.is_available():\n return\n\n self.f77_switches = gnu.f77_switches\n self.f77_debug = gnu.f77_debug\n self.f77_opt = gnu.f77_opt \n\n # XXX: need f90 switches, debug, opt\n\n def get_linker_so(self):\n return [self.f90_compiler,'-shared']\n\nclass compaq_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Compaq'\n ver_match = r'Compaq Fortran (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'fort'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -assume no2underscore -nomixed_str_len_arg '\n debug = ' -g -check_bounds '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n # XXX: uncomment if required\n #self.libraries = ' -lUfor -lfor -lFutil -lcpml -lots -lc '\n\n # XXX: fix the version showing flag\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -align dcommons -arch host -assume bigarrays -assume nozsize -math_library fast -tune host '\n return opt\n\n def get_linker_so(self):\n # XXX: is -shared needed?\n return [self.f77_compiler,'-shared']\n\n\ndef match_extension(files,ext):\n match = re.compile(r'.*[.]('+ext+r')\\Z',re.I).match\n return filter(lambda x,match = match: match(x),files)\n\ndef get_f77_files(files):\n return match_extension(files,'for|f77|ftn|f')\n\ndef get_f90_files(files):\n return match_extension(files,'f90|f95')\n\ndef get_fortran_files(files):\n return match_extension(files,'f90|f95|for|f77|ftn|f')\n\ndef find_fortran_compiler(vendor = None, fc = None, f90c = None):\n fcompiler = None\n for compiler_class in all_compilers:\n if vendor is not None and vendor != compiler_class.vendor:\n continue\n print compiler_class\n compiler = compiler_class(fc,f90c)\n if compiler.is_available():\n fcompiler = compiler\n break\n return fcompiler\n\nall_compilers = [absoft_fortran_compiler,\n mips_fortran_compiler,\n sun_fortran_compiler,\n intel_ia32_fortran_compiler,\n intel_itanium_fortran_compiler,\n nag_fortran_compiler,\n compaq_fortran_compiler,\n vast_fortran_compiler,\n f_fortran_compiler,\n gnu_fortran_compiler,\n ]\n\nif __name__ == \"__main__\":\n show_compilers()\n", + "source_code_before": "\"\"\" Implements the build_flib command which should go into Distutils\n at some point.\n \n Note:\n Right now, we're dynamically linking to the Fortran libraries on \n some platforms (Sun for sure). This is fine for local installations\n but a bad thing for redistribution because these libraries won't\n live on any machine that doesn't have a fortran compiler installed.\n It is pretty hard (impossible?) to get gcc to pass the right compiler\n flags on Sun to get the linker to use static libs for the fortran\n stuff. Investigate further...\n\nBugs:\n *** Options -e and -x have no effect when used with --help-compiler\n options. E.g. \n ./setup.py build_flib --help-compiler -e g77-3.0\n finds g77-2.95.\n How to extract these options inside the show_compilers function?\n *** compiler.is_available() method may not work correctly on nt\n because of lack of knowledge how to get exit status in\n run_command function. However, it may give reasonable results\n based on a version string.\n *** Some vendors provide different compilers for F77 and F90\n compilations. Currently, checking the availability of these\n compilers is based on only checking the availability of the\n corresponding F77 compiler. If it exists, then F90 is assumed\n to exist also.\n\nOpen issues:\n *** User-defined compiler flags. Do we need --fflags?\n\nFortran compilers (as to be used with --fcompiler= option):\n Absoft\n Sun\n SGI\n Intel\n Itanium\n NAG\n Compaq\n Gnu\n VAST\n\"\"\"\n\nimport distutils\nimport distutils.dep_util, distutils.dir_util\nimport os,sys,string\nimport commands,re\nfrom types import *\nfrom distutils.ccompiler import CCompiler,gen_preprocess_options\nfrom distutils.command.build_clib import build_clib\nfrom distutils.errors import *\n\nclass FortranCompilerError (CCompilerError):\n \"\"\"Some compile/link operation failed.\"\"\"\nclass FortranCompileError (FortranCompilerError):\n \"\"\"Failure to compile one or more Fortran source files.\"\"\"\n\nif os.name == 'nt':\n def run_command(command):\n \"\"\" not sure how to get exit status on nt. \"\"\"\n in_pipe,out_pipe = os.popen4(command)\n in_pipe.close()\n text = out_pipe.read()\n return 0, text\nelse:\n run_command = commands.getstatusoutput\n \ndef show_compilers():\n for compiler_class in all_compilers:\n compiler = compiler_class()\n if compiler.is_available():\n print compiler\n\nclass build_flib (build_clib):\n\n description = \"build f77/f90 libraries used by Python extensions\"\n\n user_options = [\n ('build-flib', 'b',\n \"directory to build f77/f90 libraries to\"),\n ('build-temp', 't',\n \"directory to put temporary build by-products\"),\n ('debug', 'g',\n \"compile with debugging information\"),\n ('force', 'f',\n \"forcibly build everything (ignore file timestamps)\"),\n ('fcompiler=', 'c',\n \"specify the compiler type\"),\n ('fcompiler-exec=', 'e',\n \"specify the path to F77 compiler\"),\n ('f90compiler-exec=', 'x',\n \"specify the path to F90 compiler\"),\n ]\n\n boolean_options = ['debug', 'force']\n\n help_options = [\n ('help-compiler', None,\n \"list available compilers\", show_compilers),\n ]\n\n def initialize_options (self):\n\n self.build_flib = None\n self.build_temp = None\n\n self.fortran_libraries = None\n self.define = None\n self.undef = None\n self.debug = None\n self.force = 0\n self.fcompiler = None\n self.fcompiler_exec = None\n self.f90compiler_exec = None\n\n # initialize_options()\n\n def finalize_options (self):\n self.set_undefined_options('build',\n ('build_temp', 'build_flib'),\n ('build_temp', 'build_temp'),\n ('debug', 'debug'),\n ('force', 'force'))\n fc = find_fortran_compiler(self.fcompiler,\n self.fcompiler_exec,\n self.f90compiler_exec)\n if not fc:\n raise DistutilsOptionError, 'Fortran compiler not available: %s'%(self.fcompiler)\n else:\n self.announce(' using %s Fortran compiler' % fc)\n self.fcompiler = fc\n if self.has_f_libraries():\n self.fortran_libraries = self.distribution.fortran_libraries\n self.check_library_list(self.fortran_libraries)\n \n # finalize_options()\n\n def has_f_libraries(self):\n return self.distribution.fortran_libraries \\\n and len(self.distribution.fortran_libraries) > 0\n\n def run (self):\n if not self.has_f_libraries():\n return\n self.build_libraries(self.fortran_libraries)\n\n # run ()\n\n def has_f_library(self,name):\n if self.has_f_libraries():\n for (lib_name, build_info) in self.fortran_libraries:\n if lib_name == name:\n return 1\n \n def get_library_names(self, name=None):\n if not self.has_f_libraries():\n return None\n\n lib_names = []\n\n if name is None:\n for (lib_name, build_info) in self.fortran_libraries:\n lib_names.append(lib_name)\n\n if self.fcompiler is not None:\n lib_names.extend(self.fcompiler.get_libraries())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n for n in build_info.get('libraries',[]):\n lib_names.append(n)\n #XXX: how to catch recursive calls here?\n lib_names.extend(self.get_library_names(n))\n break\n return lib_names\n\n def get_fcompiler_library_names(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_libraries()\n return []\n\n def get_fcompiler_library_dirs(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_library_dirs()\n return []\n\n # get_library_names ()\n\n def get_library_dirs(self, name=None):\n if not self.has_f_libraries():\n return []\n\n lib_dirs = [] \n\n if name is None:\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_library_dirs())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n lib_dirs.extend(build_info.get('library_dirs',[]))\n for n in build_info.get('libraries',[]):\n lib_dirs.extend(self.get_library_dirs(n))\n break\n\n return lib_dirs\n\n # get_library_dirs ()\n\n def get_runtime_library_dirs(self):\n #if not self.has_f_libraries():\n # return []\n\n lib_dirs = []\n\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_runtime_library_dirs())\n \n return lib_dirs\n\n # get_library_dirs ()\n\n def get_source_files (self):\n if not self.has_f_libraries():\n return []\n\n self.check_library_list(self.fortran_libraries)\n filenames = []\n\n # Gets source files specified \n for ext in self.fortran_libraries:\n filenames.extend(ext[1]['sources'])\n\n return filenames \n \n def build_libraries (self, fortran_libraries):\n \n fcompiler = self.fcompiler\n \n for (lib_name, build_info) in fortran_libraries:\n self.announce(\" building '%s' library\" % lib_name)\n\n sources = build_info.get('sources')\n if sources is None or type(sources) not in (ListType, TupleType):\n raise DistutilsSetupError, \\\n (\"in 'fortran_libraries' option (library '%s'), \" +\n \"'sources' must be present and must be \" +\n \"a list of source filenames\") % lib_name\n sources = list(sources)\n module_dirs = build_info.get('module_dirs')\n module_files = build_info.get('module_files')\n\n\n include_dirs = build_info.get('include_dirs')\n\n if include_dirs:\n fcompiler.set_include_dirs(include_dirs)\n for n,v in build_info.get('define_macros') or []:\n fcompiler.define_macro(n,v)\n for n in build_info.get('undef_macros') or []:\n fcompiler.undefine_macro(n)\n\n if module_files:\n fcompiler.build_library(lib_name, module_files,\n temp_dir=self.build_temp)\n \n fcompiler.build_library(lib_name, sources,\n module_dirs, temp_dir=self.build_temp)\n\n # for loop\n\n # build_libraries ()\n\n\nclass fortran_compiler_base(CCompiler):\n\n vendor = None\n ver_match = None\n\n compiler_type = 'fortran'\n executables = {}\n \n def __init__(self,verbose=0,dry_run=0,force=0):\n # Default initialization. Constructors of derived classes MUST\n # call this function.\n CCompiler.__init__(self,verbose,dry_run,force)\n\n self.version = None\n \n self.f77_switches = ''\n self.f77_opt = ''\n self.f77_debug = ''\n \n self.f90_switches = ''\n self.f90_opt = ''\n self.f90_debug = ''\n \n #self.libraries = []\n #self.library_dirs = []\n\n if self.vendor is None:\n raise DistutilsInternalError,\\\n '%s must define vendor attribute'%(self.__class__)\n if self.ver_match is None:\n raise DistutilsInternalError,\\\n '%s must define ver_match attribute'%(self.__class__)\n\n def to_object(self,\n dirty_files,\n module_dirs=None,\n temp_dir=''):\n files = string.join(dirty_files)\n f90_files = get_f90_files(dirty_files)\n f77_files = get_f77_files(dirty_files)\n if f90_files != []:\n obj1 = self.f90_compile(f90_files,module_dirs,temp_dir = temp_dir)\n else:\n obj1 = []\n if f77_files != []:\n obj2 = self.f77_compile(f77_files, temp_dir = temp_dir)\n else:\n obj2 = []\n return obj1 + obj2\n\n def source_to_object_names(self,source_files, temp_dir=''):\n file_list = map(lambda x: os.path.basename(x),source_files)\n file_base_ext = map(lambda x: os.path.splitext(x),file_list)\n object_list = map(lambda x: x[0] +'.o',file_base_ext)\n object_files = map(lambda x,td=temp_dir: os.path.join(td,x),object_list)\n return object_files\n \n def source_and_object_pairs(self,source_files, temp_dir=''):\n object_files = self.source_to_object_names(source_files,temp_dir)\n file_pairs = zip(source_files,object_files)\n return file_pairs\n \n def f_compile(self,compiler,switches, source_files,\n module_dirs=None, temp_dir=''):\n\n pp_opts = gen_preprocess_options(self.macros,self.include_dirs)\n\n switches = switches + ' ' + string.join(pp_opts,' ')\n\n module_switch = self.build_module_switch(module_dirs)\n file_pairs = self.source_and_object_pairs(source_files,temp_dir)\n object_files = []\n for source,object in file_pairs:\n if distutils.dep_util.newer(source,object):\n cmd = compiler + ' ' + switches + ' '+\\\n module_switch + \\\n ' -c ' + source + ' -o ' + object \n print cmd\n failure = os.system(cmd)\n if failure:\n raise FortranCompileError, 'failure during compile' \n object_files.append(object)\n return object_files\n #return all object files to make sure everything is archived \n #return map(lambda x: x[1], file_pairs)\n\n def f90_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f90_switches, self.f90_opt))\n return self.f_compile(self.f90_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n def f77_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f77_switches, self.f77_opt))\n return self.f_compile(self.f77_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n\n def build_module_switch(self, module_dirs):\n return ''\n\n def create_static_lib(self, object_files, library_name,\n output_dir='', debug=None):\n lib_file = os.path.join(output_dir,'lib'+library_name+'.a')\n newer = distutils.dep_util.newer\n # This doesn't work -- no way to know if the file is in the archive\n #object_files = filter(lambda o,lib=lib_file:\\\n # distutils.dep_util.newer(o,lib),object_files)\n objects = string.join(object_files)\n if objects:\n cmd = 'ar -cur %s %s' % (lib_file,objects)\n print cmd\n os.system(cmd)\n cmd = 'ranlib %s ' % lib_file\n print cmd\n os.system(cmd)\n\n def build_library(self,library_name,source_list,module_dirs=None,\n temp_dir = ''):\n #make sure the temp directory exists before trying to build files\n import distutils.dir_util\n distutils.dir_util.mkpath(temp_dir)\n\n #this compiles the files\n object_list = self.to_object(source_list,\n module_dirs,\n temp_dir)\n\n # actually we need to use all the object file names here to\n # make sure the library is always built. It could occur that an\n # object file exists but hasn't been put in the archive. (happens\n # a lot when builds fail once and are restarted).\n object_list = self.source_to_object_names(source_list, temp_dir)\n\n if os.name == 'nt':\n # This is pure bunk...\n # Windows fails for long argument strings on the command line.\n # if objects is real long (> 2048 chars or so on my machine),\n # the command fails (cmd.exe /e:2048 on w2k)\n # for now we'll split linking into to steps which should work for\n objects = object_list[:]\n while objects:\n obj,objects = objects[:20],objects[20:]\n self.create_static_lib(obj,library_name,temp_dir)\n else:\n self.create_static_lib(object_list,library_name,temp_dir)\n\n def dummy_fortran_files(self):\n import tempfile \n d = tempfile.gettempdir()\n dummy_name = os.path.join(d,'__dummy.f')\n dummy = open(dummy_name,'w')\n dummy.write(\" subroutine dummy()\\n end\\n\")\n dummy.close()\n return (os.path.join(d,'__dummy.f'),os.path.join(d,'__dummy.o'))\n \n def is_available(self):\n return self.get_version()\n \n def get_version(self):\n \"\"\"Return the compiler version. If compiler is not available,\n return empty string.\"\"\"\n # XXX: Is there compilers that have no version? If yes,\n # this test will fail even if the compiler is available.\n if self.version is not None:\n # Finding version is expensive, so return previously found\n # version string.\n return self.version\n self.version = ''\n # works I think only for unix... \n print 'command:', self.ver_cmd\n exit_status, out_text = run_command(self.ver_cmd)\n print exit_status, out_text\n if not exit_status:\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n return self.version\n\n def get_libraries(self):\n return self.libraries\n def get_library_dirs(self):\n return self.library_dirs\n def get_extra_link_args(self):\n return []\n def get_runtime_library_dirs(self):\n return []\n def get_linker_so(self):\n \"\"\"\n If a compiler requires specific linker then return a list\n containing a linker executable name and linker options.\n Otherwise, return None.\n \"\"\"\n\n def __str__(self):\n return \"%s %s\" % (self.vendor, self.get_version())\n\n\nclass absoft_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Absoft'\n ver_match = r'FORTRAN 77 Compiler (?P[^\\s*,]*).*?Absoft Corp'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n # got rid of -B108 cause it was generating 2 underscores instead\n # of one on the newest version. Now we use -YEXT_SFX=_ to \n # specify the output format\n if os.name == 'nt':\n self.f90_switches = '-f fixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -Q100'\n self.f77_switches = '-N22 -N90 -N110'\n self.f77_opt = '-O -Q100'\n self.libraries = ['fio', 'fmath', 'f90math', 'COMDLG32']\n else:\n self.f90_switches = '-ffixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -B101' \n self.f77_switches = '-N22 -N90 -N110 -B108'\n self.f77_opt = '-O -B101'\n\n self.libraries = ['fio', 'f77math', 'f90math']\n \n try:\n dir = os.environ['ABSOFT'] \n self.library_dirs = [os.path.join(dir,'lib')]\n except KeyError:\n self.library_dirs = []\n\n self.ver_cmd = self.f77_compiler + ' -V -c %s -o %s' % \\\n self.dummy_fortran_files()\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -p' + mod\n return res\n\n def get_extra_link_args(self):\n return []\n # Couldn't get this to link for anything using gcc.\n #dr = \"c:\\\\Absoft62\\\\lib\"\n #libs = ['fio.lib', 'COMDLG32.lib','fmath.lib', 'f90math.lib','libcomdlg32.a' ] \n #libs = map(lambda x,dr=dr:os.path.join(dr,x),libs)\n #return libs\n\n\nclass sun_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Sun'\n #ver_match = r'f77: (?P[^\\s*,]*)'\n ver_match = r'f90: Sun (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -pic '\n self.f77_opt = ' -fast -dalign '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -fixed ' # ??? why fixed?\n self.f90_opt = ' -fast -dalign '\n\n self.ver_cmd = self.f90_compiler + ' -V'\n\n #self.libraries = ['f90', 'F77', 'M77', 'sunmath', 'm']\n self.libraries = ['fsu', 'F77', 'M77', 'sunmath', 'm']\n \n #threaded\n #self.libraries = ['f90', 'F77_mt', 'sunmath_mt', 'm', 'thread']\n #self.libraries = []\n self.library_dirs = self.find_lib_dir()\n #print 'sun:',self.library_dirs\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -M' + mod\n return res\n\n def find_lib_dir(self):\n library_dirs = []\n lib_match = r'### f90: Note: LD_RUN_PATH\\s*= '\\\n '(?P[^\\s.]*).*'\n cmd = self.f90_compiler + ' -dryrun dummy.f'\n exit_status, output = run_command(cmd)\n if not exit_status:\n libs = re.findall(lib_match,output)\n if libs:\n library_dirs = string.split(libs[0],':')\n self.get_version() # force version calculation\n compiler_home = os.path.dirname(library_dirs[0])\n library_dirs.append(os.path.join(compiler_home,\n self.version,'lib'))\n return library_dirs\n def get_runtime_library_dirs(self):\n return self.find_lib_dir()\n def get_extra_link_args(self):\n return ['-mimpure-text']\n\n\nclass mips_fortran_compiler(fortran_compiler_base):\n\n vendor = 'SGI'\n ver_match = r'MIPSpro Compilers: Version (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -n32 -KPIC '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -n32 -KPIC -fixedform ' # why fixed ???\n self.f90_opt = ' ' \n\n self.ver_cmd = self.f77_compiler + ' -version'\n \n self.libraries = ['fortran', 'ftn', 'm']\n self.library_dirs = self.find_lib_dir()\n\n\n\n def build_module_switch(self,module_dirs):\n res = ''\n return res \n def find_lib_dir(self):\n library_dirs = []\n return library_dirs\n def get_runtime_library_dirs(self):\n\treturn self.find_lib_dir() \n def get_extra_link_args(self):\n\treturn []\n\n\nclass gnu_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Gnu'\n #ver_match = r'g77 version (?P[^\\s*]*)'\n ver_match = r'GNU Fortran (?P[^\\s*]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if sys.platform == 'win32':\n self.libraries = ['gcc','g2c']\n self.library_dirs = self.find_lib_directories()\n else:\n # On linux g77 does not need lib_directories to be specified.\n self.libraries = ['g2c']\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n\n switches = ' -Wall -fno-second-underscore '\n\n if os.name != 'nt':\n switches = switches + ' -fpic '\n\n self.f77_switches = switches\n #self.ver_cmd = self.f77_compiler + ' -v '\n self.ver_cmd = self.f77_compiler + ' --version'\n\n self.f77_opt = self.get_opt()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 -funroll-loops '\n \n # only check for more optimization if g77 can handle\n # it.\n if self.get_version():\n if self.version[0]=='3': # is g77 3.x.x\n if cpu.is_AthlonK6():\n opt = opt + ' -march=k6 '\n elif cpu.is_AthlonK7():\n opt = opt + ' -march=athlon '\n if cpu.is_i686():\n opt = opt + ' -march=i686 '\n elif cpu.is_i586():\n opt = opt + ' -march=i586 '\n elif cpu.is_i486():\n opt = opt + ' -march=i486 '\n elif cpu.is_i386():\n opt = opt + ' -march=i386 '\n if cpu.is_Intel():\n opt = opt + ' -malign-double ' \n return opt\n \n def find_lib_directories(self):\n lib_dir = []\n match = r'Reading specs from (.*)/specs'\n\n # works I think only for unix... \n exit_status, out_text = run_command('g77 -v')\n if not exit_status:\n m = re.findall(match,out_text)\n if m:\n lib_dir= m #m[0] \n return lib_dir\n\n def get_linker_so(self):\n # win32 linking should be handled by standard linker\n if sys.platform != 'win32' and os.uname()[0] != 'Darwin':\n return [self.f77_compiler,'-shared']\n \n def f90_compile(self,source_files,module_files,temp_dir=''):\n raise DistutilsExecError, 'f90 not supported by Gnu'\n\n\n#http://developer.intel.com/software/products/compilers/f50/linux/\nclass intel_ia32_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Intel' # Intel(R) Corporation \n ver_match = r'Intel\\(R\\) Fortran Compiler for 32-bit applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'ifc'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -KPIC '\n\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n if cpu.has_fdiv_bug():\n switches = switches + ' -fdiv_check '\n if cpu.has_f00f_bug():\n switches = switches + ' -0f_check '\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -FI -w90 -w95 '\n\n self.f77_opt = self.f90_opt = self.get_opt()\n \n debug = ' -g -C '\n self.f77_debug = self.f90_debug = debug\n\n self.ver_cmd = self.f77_compiler+' -FI -V -c %s -o %s' %\\\n self.dummy_fortran_files()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 '\n if cpu.is_PentiumPro() or cpu.is_PentiumII():\n opt = opt + ' -tpp6 -xi '\n elif cpu.is_PentiumIII():\n opt = opt + ' -tpp6 '\n elif cpu.is_Pentium():\n opt = opt + ' -tpp5 '\n elif cpu.is_PentiumIV():\n opt = opt + ' -tpp7 -xW '\n elif cpu.has_mmx():\n opt = opt + ' -xM '\n return opt\n \n\n def get_linker_so(self):\n return [self.f77_compiler,'-shared']\n\n\nclass intel_itanium_fortran_compiler(intel_ia32_fortran_compiler):\n\n vendor = 'Itanium'\n ver_match = r'Intel\\(R\\) Fortran 90 Compiler Itanium\\(TM\\) Compiler for the Itanium\\(TM\\)-based applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n if fc is None:\n fc = 'efc'\n intel_ia32_fortran_compiler.__init__(self, fc, f90c)\n\n\nclass nag_fortran_compiler(fortran_compiler_base):\n\n vendor = 'NAG'\n ver_match = r'NAGWare Fortran 95 compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'f95'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ''\n debug = ' -g -gline -g90 -nan -C '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -fixed '\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -target=native '\n return opt\n\n def get_linker_so(self):\n return [self.f77_compiler,'-Wl,-shared']\n\n\nclass vast_fortran_compiler(fortran_compiler_base):\n\n vendor = 'VAST'\n ver_match = r'\\s*Pacific-Sierra Research vf90 (Personal|Professional)\\s+(?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n d,b = os.path.split(f90c)\n vf90 = os.path.join(d,'v'+b)\n self.ver_cmd = vf90+' -v '\n\n gnu = gnu_fortran_compiler(fc)\n if not gnu.is_available(): # VAST compiler requires g77.\n self.version = ''\n return\n if not self.is_available():\n return\n\n self.f77_switches = gnu.f77_switches\n self.f77_debug = gnu.f77_debug\n self.f77_opt = gnu.f77_opt \n\n # XXX: need f90 switches, debug, opt\n\n def get_linker_so(self):\n return [self.f90_compiler,'-shared']\n\nclass compaq_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Compaq'\n ver_match = r'Compaq Fortran (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'fort'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -assume no2underscore -nomixed_str_len_arg '\n debug = ' -g -check_bounds '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n # XXX: uncomment if required\n #self.libraries = ' -lUfor -lfor -lFutil -lcpml -lots -lc '\n\n # XXX: fix the version showing flag\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -align dcommons -arch host -assume bigarrays -assume nozsize -math_library fast -tune host '\n return opt\n\n def get_linker_so(self):\n # XXX: is -shared needed?\n return [self.f77_compiler,'-shared']\n\n\ndef match_extension(files,ext):\n match = re.compile(r'.*[.]('+ext+r')\\Z',re.I).match\n return filter(lambda x,match = match: match(x),files)\n\ndef get_f77_files(files):\n return match_extension(files,'for|f77|ftn|f')\n\ndef get_f90_files(files):\n return match_extension(files,'f90|f95')\n\ndef get_fortran_files(files):\n return match_extension(files,'f90|f95|for|f77|ftn|f')\n\ndef find_fortran_compiler(vendor = None, fc = None, f90c = None):\n fcompiler = None\n for compiler_class in all_compilers:\n if vendor is not None and vendor != compiler_class.vendor:\n continue\n print compiler_class\n compiler = compiler_class(fc,f90c)\n if compiler.is_available():\n fcompiler = compiler\n break\n return fcompiler\n\nall_compilers = [absoft_fortran_compiler,\n mips_fortran_compiler,\n sun_fortran_compiler,\n intel_ia32_fortran_compiler,\n intel_itanium_fortran_compiler,\n nag_fortran_compiler,\n compaq_fortran_compiler,\n vast_fortran_compiler,\n gnu_fortran_compiler,\n ]\n\nif __name__ == \"__main__\":\n show_compilers()\n", + "methods": [ + { + "name": "run_command", + "long_name": "run_command( command )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 1, + "token_count": 32, + "parameters": [ + "command" + ], + "start_line": 67, + "end_line": 72, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "show_compilers", + "long_name": "show_compilers( )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 3, + "token_count": 26, + "parameters": [], + "start_line": 93, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "initialize_options", + "long_name": "initialize_options( self )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 1, + "token_count": 55, + "parameters": [ + "self" + ], + "start_line": 127, + "end_line": 139, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "finalize_options", + "long_name": "finalize_options( self )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 3, + "token_count": 107, + "parameters": [ + "self" + ], + "start_line": 143, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "has_f_libraries", + "long_name": "has_f_libraries( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 163, + "end_line": 165, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "run", + "long_name": "run( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 167, + "end_line": 170, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "has_f_library", + "long_name": "has_f_library( self , name )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 32, + "parameters": [ + "self", + "name" + ], + "start_line": 174, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "get_library_names", + "long_name": "get_library_names( self , name = None )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 8, + "token_count": 117, + "parameters": [ + "self", + "name" + ], + "start_line": 183, + "end_line": 203, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_names", + "long_name": "get_fcompiler_library_names( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 205, + "end_line": 210, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_dirs", + "long_name": "get_fcompiler_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 212, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self , name = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 109, + "parameters": [ + "self", + "name" + ], + "start_line": 221, + "end_line": 238, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 242, + "end_line": 251, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "get_source_files", + "long_name": "get_source_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 266, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "build_libraries", + "long_name": "build_libraries( self , fortran_libraries )", + "filename": "build_flib.py", + "nloc": 25, + "complexity": 10, + "token_count": 181, + "parameters": [ + "self", + "fortran_libraries" + ], + "start_line": 268, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 33, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , verbose = 0 , dry_run = 0 , force = 0 )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "verbose", + "dry_run", + "force" + ], + "start_line": 314, + "end_line": 337, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "to_object", + "long_name": "to_object( self , dirty_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 16, + "complexity": 3, + "token_count": 89, + "parameters": [ + "self", + "dirty_files", + "module_dirs", + "temp_dir" + ], + "start_line": 339, + "end_line": 354, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "source_to_object_names", + "long_name": "source_to_object_names( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 1, + "token_count": 89, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 356, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "source_and_object_pairs", + "long_name": "source_and_object_pairs( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 363, + "end_line": 366, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f_compile", + "long_name": "f_compile( self , compiler , switches , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 4, + "token_count": 135, + "parameters": [ + "self", + "compiler", + "switches", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 368, + "end_line": 388, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 392, + "end_line": 395, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f77_compile", + "long_name": "f77_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 397, + "end_line": 400, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 403, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "create_static_lib", + "long_name": "create_static_lib( self , object_files , library_name , output_dir = '' , debug = None )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 2, + "token_count": 87, + "parameters": [ + "self", + "object_files", + "library_name", + "output_dir", + "debug" + ], + "start_line": 406, + "end_line": 420, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "build_library", + "long_name": "build_library( self , library_name , source_list , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self", + "library_name", + "source_list", + "module_dirs", + "temp_dir" + ], + "start_line": 422, + "end_line": 450, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "dummy_fortran_files", + "long_name": "dummy_fortran_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 1, + "token_count": 69, + "parameters": [ + "self" + ], + "start_line": 452, + "end_line": 459, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "is_available", + "long_name": "is_available( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 461, + "end_line": 462, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 4, + "token_count": 90, + "parameters": [ + "self" + ], + "start_line": 464, + "end_line": 485, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 1 + }, + { + "name": "get_libraries", + "long_name": "get_libraries( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 487, + "end_line": 488, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 489, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 491, + "end_line": 492, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 493, + "end_line": 494, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 1, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 495, + "end_line": 500, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 502, + "end_line": 503, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 31, + "complexity": 5, + "token_count": 177, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 511, + "end_line": 549, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 39, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 551, + "end_line": 556, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 558, + "end_line": 559, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 98, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 573, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 599, + "end_line": 604, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 99, + "parameters": [ + "self" + ], + "start_line": 606, + "end_line": 620, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 621, + "end_line": 622, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 623, + "end_line": 624, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 94, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 632, + "end_line": 650, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 654, + "end_line": 656, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 657, + "end_line": 659, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 660, + "end_line": 661, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 662, + "end_line": 663, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 672, + "end_line": 697, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 21, + "complexity": 10, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 699, + "end_line": 722, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "find_lib_directories", + "long_name": "find_lib_directories( self )", + "filename": "build_flib.py", + "nloc": 9, + "complexity": 3, + "token_count": 43, + "parameters": [ + "self" + ], + "start_line": 724, + "end_line": 734, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 3, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 736, + "end_line": 739, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "source_files", + "module_files", + "temp_dir" + ], + "start_line": 741, + "end_line": 742, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 22, + "complexity": 5, + "token_count": 140, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 751, + "end_line": 779, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 85, + "parameters": [ + "self" + ], + "start_line": 781, + "end_line": 795, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 798, + "end_line": 799, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 807, + "end_line": 810, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 818, + "end_line": 837, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 839, + "end_line": 841, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 843, + "end_line": 844, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 24, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 857, + "end_line": 885, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 891, + "end_line": 892, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 20, + "complexity": 5, + "token_count": 128, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 899, + "end_line": 923, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 927, + "end_line": 928, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 14, + "complexity": 3, + "token_count": 91, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 935, + "end_line": 957, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 959, + "end_line": 961, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 963, + "end_line": 965, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "match_extension", + "long_name": "match_extension( files , ext )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 44, + "parameters": [ + "files", + "ext" + ], + "start_line": 968, + "end_line": 970, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "get_f77_files", + "long_name": "get_f77_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 972, + "end_line": 973, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_f90_files", + "long_name": "get_f90_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 975, + "end_line": 976, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_fortran_files", + "long_name": "get_fortran_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 978, + "end_line": 979, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "find_fortran_compiler", + "long_name": "find_fortran_compiler( vendor = None , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 5, + "token_count": 59, + "parameters": [ + "vendor", + "fc", + "f90c" + ], + "start_line": 981, + "end_line": 991, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "run_command", + "long_name": "run_command( command )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 1, + "token_count": 32, + "parameters": [ + "command" + ], + "start_line": 59, + "end_line": 64, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "show_compilers", + "long_name": "show_compilers( )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 3, + "token_count": 23, + "parameters": [], + "start_line": 68, + "end_line": 72, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "initialize_options", + "long_name": "initialize_options( self )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 1, + "token_count": 55, + "parameters": [ + "self" + ], + "start_line": 102, + "end_line": 114, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "finalize_options", + "long_name": "finalize_options( self )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self" + ], + "start_line": 118, + "end_line": 134, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "has_f_libraries", + "long_name": "has_f_libraries( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 138, + "end_line": 140, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "run", + "long_name": "run( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 142, + "end_line": 145, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "has_f_library", + "long_name": "has_f_library( self , name )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 32, + "parameters": [ + "self", + "name" + ], + "start_line": 149, + "end_line": 153, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "get_library_names", + "long_name": "get_library_names( self , name = None )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 8, + "token_count": 117, + "parameters": [ + "self", + "name" + ], + "start_line": 155, + "end_line": 175, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_names", + "long_name": "get_fcompiler_library_names( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 177, + "end_line": 182, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_dirs", + "long_name": "get_fcompiler_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 184, + "end_line": 189, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self , name = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 109, + "parameters": [ + "self", + "name" + ], + "start_line": 193, + "end_line": 210, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 214, + "end_line": 223, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "get_source_files", + "long_name": "get_source_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self" + ], + "start_line": 227, + "end_line": 238, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "build_libraries", + "long_name": "build_libraries( self , fortran_libraries )", + "filename": "build_flib.py", + "nloc": 25, + "complexity": 10, + "token_count": 181, + "parameters": [ + "self", + "fortran_libraries" + ], + "start_line": 240, + "end_line": 272, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 33, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , verbose = 0 , dry_run = 0 , force = 0 )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "verbose", + "dry_run", + "force" + ], + "start_line": 287, + "end_line": 310, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "to_object", + "long_name": "to_object( self , dirty_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 16, + "complexity": 3, + "token_count": 89, + "parameters": [ + "self", + "dirty_files", + "module_dirs", + "temp_dir" + ], + "start_line": 312, + "end_line": 327, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "source_to_object_names", + "long_name": "source_to_object_names( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 1, + "token_count": 89, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 329, + "end_line": 334, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "source_and_object_pairs", + "long_name": "source_and_object_pairs( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 336, + "end_line": 339, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f_compile", + "long_name": "f_compile( self , compiler , switches , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 4, + "token_count": 132, + "parameters": [ + "self", + "compiler", + "switches", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 341, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 365, + "end_line": 368, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f77_compile", + "long_name": "f77_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 370, + "end_line": 373, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 376, + "end_line": 377, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "create_static_lib", + "long_name": "create_static_lib( self , object_files , library_name , output_dir = '' , debug = None )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 2, + "token_count": 81, + "parameters": [ + "self", + "object_files", + "library_name", + "output_dir", + "debug" + ], + "start_line": 379, + "end_line": 393, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "build_library", + "long_name": "build_library( self , library_name , source_list , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self", + "library_name", + "source_list", + "module_dirs", + "temp_dir" + ], + "start_line": 395, + "end_line": 423, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "dummy_fortran_files", + "long_name": "dummy_fortran_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 1, + "token_count": 69, + "parameters": [ + "self" + ], + "start_line": 425, + "end_line": 432, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "is_available", + "long_name": "is_available( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 434, + "end_line": 435, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 4, + "token_count": 76, + "parameters": [ + "self" + ], + "start_line": 437, + "end_line": 455, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "get_libraries", + "long_name": "get_libraries( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 457, + "end_line": 458, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 459, + "end_line": 460, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 461, + "end_line": 462, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 463, + "end_line": 464, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 1, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 465, + "end_line": 470, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 472, + "end_line": 473, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 31, + "complexity": 5, + "token_count": 177, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 481, + "end_line": 519, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 39, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 521, + "end_line": 526, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 528, + "end_line": 529, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 98, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 543, + "end_line": 566, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 569, + "end_line": 574, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 99, + "parameters": [ + "self" + ], + "start_line": 576, + "end_line": 590, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 591, + "end_line": 592, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 593, + "end_line": 594, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 94, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 602, + "end_line": 620, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 624, + "end_line": 626, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 627, + "end_line": 629, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 630, + "end_line": 631, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 632, + "end_line": 633, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 642, + "end_line": 667, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 21, + "complexity": 10, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 669, + "end_line": 692, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "find_lib_directories", + "long_name": "find_lib_directories( self )", + "filename": "build_flib.py", + "nloc": 9, + "complexity": 3, + "token_count": 43, + "parameters": [ + "self" + ], + "start_line": 694, + "end_line": 704, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 3, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 706, + "end_line": 709, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "source_files", + "module_files", + "temp_dir" + ], + "start_line": 711, + "end_line": 712, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 22, + "complexity": 5, + "token_count": 140, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 721, + "end_line": 749, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 85, + "parameters": [ + "self" + ], + "start_line": 751, + "end_line": 765, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 768, + "end_line": 769, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 777, + "end_line": 780, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 788, + "end_line": 807, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 809, + "end_line": 811, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 813, + "end_line": 814, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 20, + "complexity": 5, + "token_count": 128, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 822, + "end_line": 846, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 850, + "end_line": 851, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 14, + "complexity": 3, + "token_count": 91, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 858, + "end_line": 880, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 882, + "end_line": 884, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 886, + "end_line": 888, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "match_extension", + "long_name": "match_extension( files , ext )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 44, + "parameters": [ + "files", + "ext" + ], + "start_line": 891, + "end_line": 893, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "get_f77_files", + "long_name": "get_f77_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 895, + "end_line": 896, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_f90_files", + "long_name": "get_f90_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 898, + "end_line": 899, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_fortran_files", + "long_name": "get_fortran_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 901, + "end_line": 902, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "find_fortran_compiler", + "long_name": "find_fortran_compiler( vendor = None , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 5, + "token_count": 59, + "parameters": [ + "vendor", + "fc", + "f90c" + ], + "start_line": 904, + "end_line": 914, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + } + ], + "changed_methods": [ + { + "name": "show_compilers", + "long_name": "show_compilers( )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 3, + "token_count": 26, + "parameters": [], + "start_line": 93, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 891, + "end_line": 892, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 4, + "token_count": 90, + "parameters": [ + "self" + ], + "start_line": 464, + "end_line": 485, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 1 + }, + { + "name": "has_f_library", + "long_name": "has_f_library( self , name )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 32, + "parameters": [ + "self", + "name" + ], + "start_line": 174, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 24, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 857, + "end_line": 885, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "f_compile", + "long_name": "f_compile( self , compiler , switches , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 4, + "token_count": 135, + "parameters": [ + "self", + "compiler", + "switches", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 368, + "end_line": 388, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "finalize_options", + "long_name": "finalize_options( self )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 3, + "token_count": 107, + "parameters": [ + "self" + ], + "start_line": 143, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "create_static_lib", + "long_name": "create_static_lib( self , object_files , library_name , output_dir = '' , debug = None )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 2, + "token_count": 87, + "parameters": [ + "self", + "object_files", + "library_name", + "output_dir", + "debug" + ], + "start_line": 406, + "end_line": 420, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + } + ], + "nloc": 715, + "complexity": 177, + "token_count": 4142, + "diff_parsed": { + "added": [ + " *** F compiler from Fortran Compiler is _not_ supported, though it", + " is defined below. The reasons is that this F95 compiler is", + " incomplete: it does not compile fixed format sources and", + " that is needed by f2py generated wrappers for F90 modules.", + " To support F as it is, some effort is needed to re-code", + " f2py but it is not clear if this effort is worth.", + " May be in future...", + " F [unsupported]", + "", + "# Hooks for colored terminal output. Could be in a more general use.", + "# See also http://www.livinglogic.de/Python/ansistyle", + "if os.environ.get('TERM',None) in ['rxvt','xterm']:", + " # Need a better way to determine whether a terminal supports colors", + " def red_text(s): return '\\x1b[31m%s\\x1b[0m'%s", + " def green_text(s): return '\\x1b[32m%s\\x1b[0m'%s", + " def yellow_text(s): return '\\x1b[33m%s\\x1b[0m'%s", + " def blue_text(s): return '\\x1b[34m%s\\x1b[0m'%s", + " def cyan_text(s): return '\\x1b[35m%s\\x1b[0m'%s", + "else:", + " def red_text(s): return s", + " def green_text(s): return s", + " def yellow_text(s): return s", + " def cyan_text(s): return s", + " def blue_text(s): return s", + "", + "", + " print cyan_text(compiler)", + " self.announce(cyan_text(' using %s Fortran compiler' % fc))", + " # If self.fortran_libraries is None at this point", + " # then it means that build_flib was called before", + " # build. Always call build before build_flib.", + " print yellow_text(cmd)", + " print yellow_text(cmd)", + " print yellow_text(cmd)", + " print 'command:', yellow_text(self.ver_cmd)", + " print exit_status,", + " print green_text(out_text)", + " else:", + " print red_text(out_text)", + "# http://www.fortran.com/F/compilers.html", + "#", + "# We define F compiler here but it is quite useless", + "# because it does not support for fixed format sources", + "# which makes it impossible to use with f2py generated", + "# fixed format wrappers to F90 modules.", + "class f_fortran_compiler(fortran_compiler_base):", + "", + " vendor = 'F'", + " ver_match = r'Fortran Company/NAG F compiler Release (?P[^\\s]*)'", + "", + " def __init__(self, fc = None, f90c = None):", + " fortran_compiler_base.__init__(self)", + "", + " if fc is None:", + " fc = 'F'", + " if f90c is None:", + " f90c = 'F'", + "", + " self.f77_compiler = fc", + " self.f90_compiler = f90c", + " self.ver_cmd = self.f90_compiler+' -V '", + "", + " gnu = gnu_fortran_compiler('g77')", + " if not gnu.is_available(): # F compiler requires gcc.", + " self.version = ''", + " return", + " if not self.is_available():", + " return", + "", + " print red_text(\"\"\"", + "WARNING: F compiler is unsupported due to its incompleteness.", + " Send complaints to its vendor. For adding its support", + " to scipy_distutils, it must be able to compile", + " fixed format Fortran 90.", + "\"\"\")", + "", + " self.f90_switches = ''", + " self.f90_debug = ' -g -gline -g90 -C '", + " self.f90_opt = ' -O '", + "", + " #self.f77_switches = gnu.f77_switches", + " #self.f77_debug = gnu.f77_debug", + " #self.f77_opt = gnu.f77_opt", + "", + " def get_linker_so(self):", + " return ['gcc','-shared']", + " f_fortran_compiler," + ], + "deleted": [ + "", + " print compiler", + " self.announce(' using %s Fortran compiler' % fc)", + "", + " print cmd", + " print cmd", + " print cmd", + " print 'command:', self.ver_cmd", + " print exit_status, out_text" + ] + } + } + ] + }, + { + "hash": "37af376df435e6a045a4c92550ca246cf1641d24", + "msg": "Fixed missing math import", + "author": { + "name": "Pearu Peterson", + "email": "pearu.peterson@gmail.com" + }, + "committer": { + "name": "Pearu Peterson", + "email": "pearu.peterson@gmail.com" + }, + "author_date": "2002-05-06T20:25:25+00:00", + "author_timezone": 0, + "committer_date": "2002-05-06T20:25:25+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "40006b76c878853d4b2ed3be9c264071e6cea220" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 1, + "insertions": 1, + "lines": 2, + "files": 1, + "dmm_unit_size": null, + "dmm_unit_complexity": null, + "dmm_unit_interfacing": null, + "modified_files": [ + { + "old_path": "scipy_base/testing.py", + "new_path": "scipy_base/testing.py", + "filename": "testing.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -1,7 +1,7 @@\n \n __all__ = []\n \n-import os,sys,time,glob,string,traceback,unittest\n+import os,sys,time,glob,string,traceback,unittest,math\n \n try:\n # These are used by Numeric tests.\n", + "added_lines": 1, + "deleted_lines": 1, + "source_code": "\n__all__ = []\n\nimport os,sys,time,glob,string,traceback,unittest,math\n\ntry:\n # These are used by Numeric tests.\n # If Numeric and scipy_base are not available, then some of the\n # functions below will not be available.\n from Numeric import alltrue,equal,shape,ravel,around,zeros,Float64\n import scipy_base.fastumath\nexcept ImportError:\n pass\n \n__all__.append('ScipyTestCase')\nclass ScipyTestCase (unittest.TestCase):\n\n def measure(self,code_str,times=1):\n \"\"\" Return elapsed time for executing code_str in the\n namespace of the caller for given times.\n \"\"\"\n frame = sys._getframe(1)\n locs,globs = frame.f_locals,frame.f_globals\n code = compile(code_str,\n 'ScipyTestCase runner for '+self.__class__.__name__,\n 'exec')\n i = 0\n elapsed = time.time()\n while i 0\n\n def run (self):\n if not self.has_f_libraries():\n return\n self.build_libraries(self.fortran_libraries)\n\n # run ()\n\n def has_f_library(self,name):\n if self.has_f_libraries():\n # If self.fortran_libraries is None at this point\n # then it means that build_flib was called before\n # build. Always call build before build_flib.\n for (lib_name, build_info) in self.fortran_libraries:\n if lib_name == name:\n return 1\n \n def get_library_names(self, name=None):\n if not self.has_f_libraries():\n return None\n\n lib_names = []\n\n if name is None:\n for (lib_name, build_info) in self.fortran_libraries:\n lib_names.append(lib_name)\n\n if self.fcompiler is not None:\n lib_names.extend(self.fcompiler.get_libraries())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n for n in build_info.get('libraries',[]):\n lib_names.append(n)\n #XXX: how to catch recursive calls here?\n lib_names.extend(self.get_library_names(n))\n break\n return lib_names\n\n def get_fcompiler_library_names(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_libraries()\n return []\n\n def get_fcompiler_library_dirs(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_library_dirs()\n return []\n\n # get_library_names ()\n\n def get_library_dirs(self, name=None):\n if not self.has_f_libraries():\n return []\n\n lib_dirs = [] \n\n if name is None:\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_library_dirs())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n lib_dirs.extend(build_info.get('library_dirs',[]))\n for n in build_info.get('libraries',[]):\n lib_dirs.extend(self.get_library_dirs(n))\n break\n\n return lib_dirs\n\n # get_library_dirs ()\n\n def get_runtime_library_dirs(self):\n #if not self.has_f_libraries():\n # return []\n\n lib_dirs = []\n\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_runtime_library_dirs())\n \n return lib_dirs\n\n # get_library_dirs ()\n\n def get_source_files (self):\n if not self.has_f_libraries():\n return []\n\n self.check_library_list(self.fortran_libraries)\n filenames = []\n\n # Gets source files specified \n for ext in self.fortran_libraries:\n filenames.extend(ext[1]['sources'])\n\n return filenames \n \n def build_libraries (self, fortran_libraries):\n \n fcompiler = self.fcompiler\n \n for (lib_name, build_info) in fortran_libraries:\n self.announce(\" building '%s' library\" % lib_name)\n\n sources = build_info.get('sources')\n if sources is None or type(sources) not in (ListType, TupleType):\n raise DistutilsSetupError, \\\n (\"in 'fortran_libraries' option (library '%s'), \" +\n \"'sources' must be present and must be \" +\n \"a list of source filenames\") % lib_name\n sources = list(sources)\n module_dirs = build_info.get('module_dirs')\n module_files = build_info.get('module_files')\n\n\n include_dirs = build_info.get('include_dirs')\n\n if include_dirs:\n fcompiler.set_include_dirs(include_dirs)\n for n,v in build_info.get('define_macros') or []:\n fcompiler.define_macro(n,v)\n for n in build_info.get('undef_macros') or []:\n fcompiler.undefine_macro(n)\n\n if module_files:\n fcompiler.build_library(lib_name, module_files,\n temp_dir=self.build_temp)\n \n fcompiler.build_library(lib_name, sources,\n module_dirs, temp_dir=self.build_temp)\n\n # for loop\n\n # build_libraries ()\n\nclass fortran_compiler_base(CCompiler):\n\n vendor = None\n ver_match = None\n\n compiler_type = 'fortran'\n executables = {}\n \n def __init__(self,verbose=0,dry_run=0,force=0):\n # Default initialization. Constructors of derived classes MUST\n # call this function.\n CCompiler.__init__(self,verbose,dry_run,force)\n\n self.version = None\n \n self.f77_switches = ''\n self.f77_opt = ''\n self.f77_debug = ''\n \n self.f90_switches = ''\n self.f90_opt = ''\n self.f90_debug = ''\n \n #self.libraries = []\n #self.library_dirs = []\n\n if self.vendor is None:\n raise DistutilsInternalError,\\\n '%s must define vendor attribute'%(self.__class__)\n if self.ver_match is None:\n raise DistutilsInternalError,\\\n '%s must define ver_match attribute'%(self.__class__)\n\n def to_object(self,\n dirty_files,\n module_dirs=None,\n temp_dir=''):\n files = string.join(dirty_files)\n f90_files = get_f90_files(dirty_files)\n f77_files = get_f77_files(dirty_files)\n if f90_files != []:\n obj1 = self.f90_compile(f90_files,module_dirs,temp_dir = temp_dir)\n else:\n obj1 = []\n if f77_files != []:\n obj2 = self.f77_compile(f77_files, temp_dir = temp_dir)\n else:\n obj2 = []\n return obj1 + obj2\n\n def source_to_object_names(self,source_files, temp_dir=''):\n file_list = map(lambda x: os.path.basename(x),source_files)\n file_base_ext = map(lambda x: os.path.splitext(x),file_list)\n object_list = map(lambda x: x[0] +'.o',file_base_ext)\n object_files = map(lambda x,td=temp_dir: os.path.join(td,x),object_list)\n return object_files\n \n def source_and_object_pairs(self,source_files, temp_dir=''):\n object_files = self.source_to_object_names(source_files,temp_dir)\n file_pairs = zip(source_files,object_files)\n return file_pairs\n \n def f_compile(self,compiler,switches, source_files,\n module_dirs=None, temp_dir=''):\n\n pp_opts = gen_preprocess_options(self.macros,self.include_dirs)\n\n switches = switches + ' ' + string.join(pp_opts,' ')\n\n module_switch = self.build_module_switch(module_dirs)\n file_pairs = self.source_and_object_pairs(source_files,temp_dir)\n object_files = []\n for source,object in file_pairs:\n if distutils.dep_util.newer(source,object):\n cmd = compiler + ' ' + switches + ' '+\\\n module_switch + \\\n ' -c ' + source + ' -o ' + object \n print yellow_text(cmd)\n failure = os.system(cmd)\n if failure:\n raise FortranCompileError, 'failure during compile' \n object_files.append(object)\n return object_files\n #return all object files to make sure everything is archived \n #return map(lambda x: x[1], file_pairs)\n\n def f90_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f90_switches, self.f90_opt))\n return self.f_compile(self.f90_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n def f77_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f77_switches, self.f77_opt))\n return self.f_compile(self.f77_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n\n def build_module_switch(self, module_dirs):\n return ''\n\n def create_static_lib(self, object_files, library_name,\n output_dir='', debug=None):\n lib_file = os.path.join(output_dir,'lib'+library_name+'.a')\n newer = distutils.dep_util.newer\n # This doesn't work -- no way to know if the file is in the archive\n #object_files = filter(lambda o,lib=lib_file:\\\n # distutils.dep_util.newer(o,lib),object_files)\n objects = string.join(object_files)\n if objects:\n cmd = 'ar -cur %s %s' % (lib_file,objects)\n print yellow_text(cmd)\n os.system(cmd)\n cmd = 'ranlib %s ' % lib_file\n print yellow_text(cmd)\n os.system(cmd)\n\n def build_library(self,library_name,source_list,module_dirs=None,\n temp_dir = ''):\n #make sure the temp directory exists before trying to build files\n import distutils.dir_util\n distutils.dir_util.mkpath(temp_dir)\n\n #this compiles the files\n object_list = self.to_object(source_list,\n module_dirs,\n temp_dir)\n\n # actually we need to use all the object file names here to\n # make sure the library is always built. It could occur that an\n # object file exists but hasn't been put in the archive. (happens\n # a lot when builds fail once and are restarted).\n object_list = self.source_to_object_names(source_list, temp_dir)\n\n if os.name == 'nt':\n # This is pure bunk...\n # Windows fails for long argument strings on the command line.\n # if objects is real long (> 2048 chars or so on my machine),\n # the command fails (cmd.exe /e:2048 on w2k)\n # for now we'll split linking into to steps which should work for\n objects = object_list[:]\n while objects:\n obj,objects = objects[:20],objects[20:]\n self.create_static_lib(obj,library_name,temp_dir)\n else:\n self.create_static_lib(object_list,library_name,temp_dir)\n\n def dummy_fortran_files(self):\n import tempfile \n d = tempfile.gettempdir()\n dummy_name = os.path.join(d,'__dummy.f')\n dummy = open(dummy_name,'w')\n dummy.write(\" subroutine dummy()\\n end\\n\")\n dummy.close()\n return (os.path.join(d,'__dummy.f'),os.path.join(d,'__dummy.o'))\n \n def is_available(self):\n return self.get_version()\n \n def get_version(self):\n \"\"\"Return the compiler version. If compiler is not available,\n return empty string.\"\"\"\n # XXX: Is there compilers that have no version? If yes,\n # this test will fail even if the compiler is available.\n if self.version is not None:\n # Finding version is expensive, so return previously found\n # version string.\n return self.version\n self.version = ''\n # works I think only for unix... \n print 'command:', yellow_text(self.ver_cmd)\n exit_status, out_text = run_command(self.ver_cmd)\n print exit_status,\n if not exit_status:\n print green_text(out_text)\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n else:\n print red_text(out_text)\n return self.version\n\n def get_libraries(self):\n return self.libraries\n def get_library_dirs(self):\n return self.library_dirs\n def get_extra_link_args(self):\n return []\n def get_runtime_library_dirs(self):\n return []\n def get_linker_so(self):\n \"\"\"\n If a compiler requires specific linker then return a list\n containing a linker executable name and linker options.\n Otherwise, return None.\n \"\"\"\n\n def __str__(self):\n return \"%s %s\" % (self.vendor, self.get_version())\n\n\nclass absoft_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Absoft'\n ver_match = r'FORTRAN 77 Compiler (?P[^\\s*,]*).*?Absoft Corp'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n # got rid of -B108 cause it was generating 2 underscores instead\n # of one on the newest version. Now we use -YEXT_SFX=_ to \n # specify the output format\n if os.name == 'nt':\n self.f90_switches = '-f fixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -Q100'\n self.f77_switches = '-N22 -N90 -N110'\n self.f77_opt = '-O -Q100'\n self.libraries = ['fio', 'fmath', 'f90math', 'COMDLG32']\n else:\n self.f90_switches = '-ffixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -B101' \n self.f77_switches = '-N22 -N90 -N110 -B108'\n self.f77_opt = '-O -B101'\n\n self.libraries = ['fio', 'f77math', 'f90math']\n \n try:\n dir = os.environ['ABSOFT'] \n self.library_dirs = [os.path.join(dir,'lib')]\n except KeyError:\n self.library_dirs = []\n\n self.ver_cmd = self.f77_compiler + ' -V -c %s -o %s' % \\\n self.dummy_fortran_files()\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -p' + mod\n return res\n\n def get_extra_link_args(self):\n return []\n # Couldn't get this to link for anything using gcc.\n #dr = \"c:\\\\Absoft62\\\\lib\"\n #libs = ['fio.lib', 'COMDLG32.lib','fmath.lib', 'f90math.lib','libcomdlg32.a' ] \n #libs = map(lambda x,dr=dr:os.path.join(dr,x),libs)\n #return libs\n\n\nclass sun_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Sun'\n #ver_match = r'f77: (?P[^\\s*,]*)'\n ver_match = r'f90: Sun (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -pic '\n self.f77_opt = ' -fast -dalign '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -fixed ' # ??? why fixed?\n self.f90_opt = ' -fast -dalign '\n\n self.ver_cmd = self.f90_compiler + ' -V'\n\n #self.libraries = ['f90', 'F77', 'M77', 'sunmath', 'm']\n self.libraries = ['fsu', 'F77', 'M77', 'sunmath', 'm']\n \n #threaded\n #self.libraries = ['f90', 'F77_mt', 'sunmath_mt', 'm', 'thread']\n #self.libraries = []\n self.library_dirs = self.find_lib_dir()\n #print 'sun:',self.library_dirs\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -M' + mod\n return res\n\n def find_lib_dir(self):\n library_dirs = []\n lib_match = r'### f90: Note: LD_RUN_PATH\\s*= '\\\n '(?P[^\\s.]*).*'\n cmd = self.f90_compiler + ' -dryrun dummy.f'\n exit_status, output = run_command(cmd)\n if not exit_status:\n libs = re.findall(lib_match,output)\n if libs:\n library_dirs = string.split(libs[0],':')\n self.get_version() # force version calculation\n compiler_home = os.path.dirname(library_dirs[0])\n library_dirs.append(os.path.join(compiler_home,\n self.version,'lib'))\n return library_dirs\n def get_runtime_library_dirs(self):\n return self.find_lib_dir()\n def get_extra_link_args(self):\n return ['-mimpure-text']\n\n\nclass mips_fortran_compiler(fortran_compiler_base):\n\n vendor = 'SGI'\n ver_match = r'MIPSpro Compilers: Version (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -n32 -KPIC '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -n32 -KPIC -fixedform ' # why fixed ???\n self.f90_opt = ' ' \n\n self.ver_cmd = self.f77_compiler + ' -version'\n \n self.libraries = ['fortran', 'ftn', 'm']\n self.library_dirs = self.find_lib_dir()\n\n\n def build_module_switch(self,module_dirs):\n res = ''\n return res \n def find_lib_dir(self):\n library_dirs = []\n return library_dirs\n def get_runtime_library_dirs(self):\n\treturn self.find_lib_dir() \n def get_extra_link_args(self):\n\treturn []\n\n\nclass gnu_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Gnu'\n #ver_match = r'g77 version (?P[^\\s*]*)'\n ver_match = r'GNU Fortran (?P[^\\s*]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if sys.platform == 'win32':\n self.libraries = ['gcc','g2c']\n self.library_dirs = self.find_lib_directories()\n else:\n # On linux g77 does not need lib_directories to be specified.\n self.libraries = ['g2c']\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n\n switches = ' -Wall -fno-second-underscore '\n\n if os.name != 'nt':\n switches = switches + ' -fpic '\n\n self.f77_switches = switches\n #self.ver_cmd = self.f77_compiler + ' -v '\n self.ver_cmd = self.f77_compiler + ' --version'\n\n self.f77_opt = self.get_opt()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 -funroll-loops '\n \n # only check for more optimization if g77 can handle\n # it.\n if self.get_version():\n if self.version[0]=='3': # is g77 3.x.x\n if cpu.is_AthlonK6():\n opt = opt + ' -march=k6 '\n elif cpu.is_AthlonK7():\n opt = opt + ' -march=athlon '\n if cpu.is_i686():\n opt = opt + ' -march=i686 '\n elif cpu.is_i586():\n opt = opt + ' -march=i586 '\n elif cpu.is_i486():\n opt = opt + ' -march=i486 '\n elif cpu.is_i386():\n opt = opt + ' -march=i386 '\n if cpu.is_Intel():\n opt = opt + ' -malign-double ' \n return opt\n \n def find_lib_directories(self):\n lib_dir = []\n match = r'Reading specs from (.*)/specs'\n\n # works I think only for unix... \n exit_status, out_text = run_command('g77 -v')\n if not exit_status:\n m = re.findall(match,out_text)\n if m:\n lib_dir= m #m[0] \n return lib_dir\n\n def get_linker_so(self):\n # win32 linking should be handled by standard linker\n if sys.platform != 'win32' and os.uname()[0] != 'Darwin':\n return [self.f77_compiler,'-shared']\n \n def f90_compile(self,source_files,module_files,temp_dir=''):\n raise DistutilsExecError, 'f90 not supported by Gnu'\n\n\n#http://developer.intel.com/software/products/compilers/f50/linux/\nclass intel_ia32_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Intel' # Intel(R) Corporation \n ver_match = r'Intel\\(R\\) Fortran Compiler for 32-bit applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'ifc'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -KPIC '\n\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n if cpu.has_fdiv_bug():\n switches = switches + ' -fdiv_check '\n if cpu.has_f00f_bug():\n switches = switches + ' -0f_check '\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -FI -w90 -w95 '\n\n self.f77_opt = self.f90_opt = self.get_opt()\n \n debug = ' -g -C '\n self.f77_debug = self.f90_debug = debug\n\n self.ver_cmd = self.f77_compiler+' -FI -V -c %s -o %s' %\\\n self.dummy_fortran_files()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 '\n if cpu.is_PentiumPro() or cpu.is_PentiumII():\n opt = opt + ' -tpp6 -xi '\n elif cpu.is_PentiumIII():\n opt = opt + ' -tpp6 '\n elif cpu.is_Pentium():\n opt = opt + ' -tpp5 '\n elif cpu.is_PentiumIV():\n opt = opt + ' -tpp7 -xW '\n elif cpu.has_mmx():\n opt = opt + ' -xM '\n return opt\n \n\n def get_linker_so(self):\n return [self.f77_compiler,'-shared']\n\n\nclass intel_itanium_fortran_compiler(intel_ia32_fortran_compiler):\n\n vendor = 'Itanium'\n ver_match = r'Intel\\(R\\) Fortran 90 Compiler Itanium\\(TM\\) Compiler for the Itanium\\(TM\\)-based applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n if fc is None:\n fc = 'efc'\n intel_ia32_fortran_compiler.__init__(self, fc, f90c)\n\n\nclass nag_fortran_compiler(fortran_compiler_base):\n\n vendor = 'NAG'\n ver_match = r'NAGWare Fortran 95 compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'f95'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ''\n debug = ' -g -gline -g90 -nan -C '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -fixed '\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -target=native '\n return opt\n\n def get_linker_so(self):\n return [self.f77_compiler,'-Wl,-shared']\n\n# http://www.fortran.com/F/compilers.html\n#\n# We define F compiler here but it is quite useless\n# because it does not support for fixed format sources\n# which makes it impossible to use with f2py generated\n# fixed format wrappers to F90 modules.\nclass f_fortran_compiler(fortran_compiler_base):\n\n vendor = 'F'\n ver_match = r'Fortran Company/NAG F compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'F'\n if f90c is None:\n f90c = 'F'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n self.ver_cmd = self.f90_compiler+' -V '\n\n gnu = gnu_fortran_compiler('g77')\n if not gnu.is_available(): # F compiler requires gcc.\n self.version = ''\n return\n if not self.is_available():\n return\n\n print red_text(\"\"\"\nWARNING: F compiler is unsupported due to its incompleteness.\n Send complaints to its vendor. For adding its support\n to scipy_distutils, it must be able to compile\n fixed format Fortran 90.\n\"\"\")\n\n self.f90_switches = ''\n self.f90_debug = ' -g -gline -g90 -C '\n self.f90_opt = ' -O '\n\n #self.f77_switches = gnu.f77_switches\n #self.f77_debug = gnu.f77_debug\n #self.f77_opt = gnu.f77_opt\n\n def get_linker_so(self):\n return ['gcc','-shared']\n\nclass vast_fortran_compiler(fortran_compiler_base):\n\n vendor = 'VAST'\n ver_match = r'\\s*Pacific-Sierra Research vf90 (Personal|Professional)\\s+(?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n d,b = os.path.split(f90c)\n vf90 = os.path.join(d,'v'+b)\n self.ver_cmd = vf90+' -v '\n\n gnu = gnu_fortran_compiler(fc)\n if not gnu.is_available(): # VAST compiler requires g77.\n self.version = ''\n return\n if not self.is_available():\n return\n\n self.f77_switches = gnu.f77_switches\n self.f77_debug = gnu.f77_debug\n self.f77_opt = gnu.f77_opt \n\n # XXX: need f90 switches, debug, opt\n\n def get_linker_so(self):\n return [self.f90_compiler,'-shared']\n\nclass compaq_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Compaq'\n ver_match = r'Compaq Fortran (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'fort'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -assume no2underscore -nomixed_str_len_arg '\n debug = ' -g -check_bounds '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n # XXX: uncomment if required\n #self.libraries = ' -lUfor -lfor -lFutil -lcpml -lots -lc '\n\n # XXX: fix the version showing flag\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -align dcommons -arch host -assume bigarrays -assume nozsize -math_library fast -tune host '\n return opt\n\n def get_linker_so(self):\n # XXX: is -shared needed?\n return [self.f77_compiler,'-shared']\n\n\ndef match_extension(files,ext):\n match = re.compile(r'.*[.]('+ext+r')\\Z',re.I).match\n return filter(lambda x,match = match: match(x),files)\n\ndef get_f77_files(files):\n return match_extension(files,'for|f77|ftn|f')\n\ndef get_f90_files(files):\n return match_extension(files,'f90|f95')\n\ndef get_fortran_files(files):\n return match_extension(files,'f90|f95|for|f77|ftn|f')\n\ndef find_fortran_compiler(vendor = None, fc = None, f90c = None):\n fcompiler = None\n for compiler_class in all_compilers:\n if vendor is not None and vendor != compiler_class.vendor:\n continue\n print compiler_class\n compiler = compiler_class(fc,f90c)\n if compiler.is_available():\n fcompiler = compiler\n break\n return fcompiler\n\nall_compilers = [absoft_fortran_compiler,\n mips_fortran_compiler,\n sun_fortran_compiler,\n intel_ia32_fortran_compiler,\n intel_itanium_fortran_compiler,\n nag_fortran_compiler,\n compaq_fortran_compiler,\n vast_fortran_compiler,\n f_fortran_compiler,\n gnu_fortran_compiler,\n ]\n\nif __name__ == \"__main__\":\n show_compilers()\n", + "source_code_before": "\"\"\" Implements the build_flib command which should go into Distutils\n at some point.\n \n Note:\n Right now, we're dynamically linking to the Fortran libraries on \n some platforms (Sun for sure). This is fine for local installations\n but a bad thing for redistribution because these libraries won't\n live on any machine that doesn't have a fortran compiler installed.\n It is pretty hard (impossible?) to get gcc to pass the right compiler\n flags on Sun to get the linker to use static libs for the fortran\n stuff. Investigate further...\n\nBugs:\n *** Options -e and -x have no effect when used with --help-compiler\n options. E.g. \n ./setup.py build_flib --help-compiler -e g77-3.0\n finds g77-2.95.\n How to extract these options inside the show_compilers function?\n *** compiler.is_available() method may not work correctly on nt\n because of lack of knowledge how to get exit status in\n run_command function. However, it may give reasonable results\n based on a version string.\n *** Some vendors provide different compilers for F77 and F90\n compilations. Currently, checking the availability of these\n compilers is based on only checking the availability of the\n corresponding F77 compiler. If it exists, then F90 is assumed\n to exist also.\n *** F compiler from Fortran Compiler is _not_ supported, though it\n is defined below. The reasons is that this F95 compiler is\n incomplete: it does not compile fixed format sources and\n that is needed by f2py generated wrappers for F90 modules.\n To support F as it is, some effort is needed to re-code\n f2py but it is not clear if this effort is worth.\n May be in future...\n\nOpen issues:\n *** User-defined compiler flags. Do we need --fflags?\n\nFortran compilers (as to be used with --fcompiler= option):\n Absoft\n Sun\n SGI\n Intel\n Itanium\n NAG\n Compaq\n Gnu\n VAST\n F [unsupported]\n\"\"\"\n\nimport distutils\nimport distutils.dep_util, distutils.dir_util\nimport os,sys,string\nimport commands,re\nfrom types import *\nfrom distutils.ccompiler import CCompiler,gen_preprocess_options\nfrom distutils.command.build_clib import build_clib\nfrom distutils.errors import *\n\nclass FortranCompilerError (CCompilerError):\n \"\"\"Some compile/link operation failed.\"\"\"\nclass FortranCompileError (FortranCompilerError):\n \"\"\"Failure to compile one or more Fortran source files.\"\"\"\n\nif os.name == 'nt':\n def run_command(command):\n \"\"\" not sure how to get exit status on nt. \"\"\"\n in_pipe,out_pipe = os.popen4(command)\n in_pipe.close()\n text = out_pipe.read()\n return 0, text\nelse:\n run_command = commands.getstatusoutput\n\n# Hooks for colored terminal output. Could be in a more general use.\n# See also http://www.livinglogic.de/Python/ansistyle\nif os.environ.get('TERM',None) in ['rxvt','xterm']:\n # Need a better way to determine whether a terminal supports colors\n def red_text(s): return '\\x1b[31m%s\\x1b[0m'%s\n def green_text(s): return '\\x1b[32m%s\\x1b[0m'%s\n def yellow_text(s): return '\\x1b[33m%s\\x1b[0m'%s\n def blue_text(s): return '\\x1b[34m%s\\x1b[0m'%s\n def cyan_text(s): return '\\x1b[35m%s\\x1b[0m'%s\nelse:\n def red_text(s): return s\n def green_text(s): return s\n def yellow_text(s): return s\n def cyan_text(s): return s\n def blue_text(s): return s\n\n\ndef show_compilers():\n for compiler_class in all_compilers:\n compiler = compiler_class()\n if compiler.is_available():\n print cyan_text(compiler)\n\nclass build_flib (build_clib):\n\n description = \"build f77/f90 libraries used by Python extensions\"\n\n user_options = [\n ('build-flib', 'b',\n \"directory to build f77/f90 libraries to\"),\n ('build-temp', 't',\n \"directory to put temporary build by-products\"),\n ('debug', 'g',\n \"compile with debugging information\"),\n ('force', 'f',\n \"forcibly build everything (ignore file timestamps)\"),\n ('fcompiler=', 'c',\n \"specify the compiler type\"),\n ('fcompiler-exec=', 'e',\n \"specify the path to F77 compiler\"),\n ('f90compiler-exec=', 'x',\n \"specify the path to F90 compiler\"),\n ]\n\n boolean_options = ['debug', 'force']\n\n help_options = [\n ('help-compiler', None,\n \"list available compilers\", show_compilers),\n ]\n\n def initialize_options (self):\n\n self.build_flib = None\n self.build_temp = None\n\n self.fortran_libraries = None\n self.define = None\n self.undef = None\n self.debug = None\n self.force = 0\n self.fcompiler = None\n self.fcompiler_exec = None\n self.f90compiler_exec = None\n\n # initialize_options()\n\n def finalize_options (self):\n self.set_undefined_options('build',\n ('build_temp', 'build_flib'),\n ('build_temp', 'build_temp'),\n ('debug', 'debug'),\n ('force', 'force'))\n fc = find_fortran_compiler(self.fcompiler,\n self.fcompiler_exec,\n self.f90compiler_exec)\n if not fc:\n raise DistutilsOptionError, 'Fortran compiler not available: %s'%(self.fcompiler)\n else:\n self.announce(cyan_text(' using %s Fortran compiler' % fc))\n self.fcompiler = fc\n if self.has_f_libraries():\n self.fortran_libraries = self.distribution.fortran_libraries\n self.check_library_list(self.fortran_libraries)\n \n # finalize_options()\n\n def has_f_libraries(self):\n return self.distribution.fortran_libraries \\\n and len(self.distribution.fortran_libraries) > 0\n\n def run (self):\n if not self.has_f_libraries():\n return\n self.build_libraries(self.fortran_libraries)\n\n # run ()\n\n def has_f_library(self,name):\n if self.has_f_libraries():\n # If self.fortran_libraries is None at this point\n # then it means that build_flib was called before\n # build. Always call build before build_flib.\n for (lib_name, build_info) in self.fortran_libraries:\n if lib_name == name:\n return 1\n \n def get_library_names(self, name=None):\n if not self.has_f_libraries():\n return None\n\n lib_names = []\n\n if name is None:\n for (lib_name, build_info) in self.fortran_libraries:\n lib_names.append(lib_name)\n\n if self.fcompiler is not None:\n lib_names.extend(self.fcompiler.get_libraries())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n for n in build_info.get('libraries',[]):\n lib_names.append(n)\n #XXX: how to catch recursive calls here?\n lib_names.extend(self.get_library_names(n))\n break\n return lib_names\n\n def get_fcompiler_library_names(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_libraries()\n return []\n\n def get_fcompiler_library_dirs(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_library_dirs()\n return []\n\n # get_library_names ()\n\n def get_library_dirs(self, name=None):\n if not self.has_f_libraries():\n return []\n\n lib_dirs = [] \n\n if name is None:\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_library_dirs())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n lib_dirs.extend(build_info.get('library_dirs',[]))\n for n in build_info.get('libraries',[]):\n lib_dirs.extend(self.get_library_dirs(n))\n break\n\n return lib_dirs\n\n # get_library_dirs ()\n\n def get_runtime_library_dirs(self):\n #if not self.has_f_libraries():\n # return []\n\n lib_dirs = []\n\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_runtime_library_dirs())\n \n return lib_dirs\n\n # get_library_dirs ()\n\n def get_source_files (self):\n if not self.has_f_libraries():\n return []\n\n self.check_library_list(self.fortran_libraries)\n filenames = []\n\n # Gets source files specified \n for ext in self.fortran_libraries:\n filenames.extend(ext[1]['sources'])\n\n return filenames \n \n def build_libraries (self, fortran_libraries):\n \n fcompiler = self.fcompiler\n \n for (lib_name, build_info) in fortran_libraries:\n self.announce(\" building '%s' library\" % lib_name)\n\n sources = build_info.get('sources')\n if sources is None or type(sources) not in (ListType, TupleType):\n raise DistutilsSetupError, \\\n (\"in 'fortran_libraries' option (library '%s'), \" +\n \"'sources' must be present and must be \" +\n \"a list of source filenames\") % lib_name\n sources = list(sources)\n module_dirs = build_info.get('module_dirs')\n module_files = build_info.get('module_files')\n\n\n include_dirs = build_info.get('include_dirs')\n\n if include_dirs:\n fcompiler.set_include_dirs(include_dirs)\n for n,v in build_info.get('define_macros') or []:\n fcompiler.define_macro(n,v)\n for n in build_info.get('undef_macros') or []:\n fcompiler.undefine_macro(n)\n\n if module_files:\n fcompiler.build_library(lib_name, module_files,\n temp_dir=self.build_temp)\n \n fcompiler.build_library(lib_name, sources,\n module_dirs, temp_dir=self.build_temp)\n\n # for loop\n\n # build_libraries ()\n\nclass fortran_compiler_base(CCompiler):\n\n vendor = None\n ver_match = None\n\n compiler_type = 'fortran'\n executables = {}\n \n def __init__(self,verbose=0,dry_run=0,force=0):\n # Default initialization. Constructors of derived classes MUST\n # call this function.\n CCompiler.__init__(self,verbose,dry_run,force)\n\n self.version = None\n \n self.f77_switches = ''\n self.f77_opt = ''\n self.f77_debug = ''\n \n self.f90_switches = ''\n self.f90_opt = ''\n self.f90_debug = ''\n \n #self.libraries = []\n #self.library_dirs = []\n\n if self.vendor is None:\n raise DistutilsInternalError,\\\n '%s must define vendor attribute'%(self.__class__)\n if self.ver_match is None:\n raise DistutilsInternalError,\\\n '%s must define ver_match attribute'%(self.__class__)\n\n def to_object(self,\n dirty_files,\n module_dirs=None,\n temp_dir=''):\n files = string.join(dirty_files)\n f90_files = get_f90_files(dirty_files)\n f77_files = get_f77_files(dirty_files)\n if f90_files != []:\n obj1 = self.f90_compile(f90_files,module_dirs,temp_dir = temp_dir)\n else:\n obj1 = []\n if f77_files != []:\n obj2 = self.f77_compile(f77_files, temp_dir = temp_dir)\n else:\n obj2 = []\n return obj1 + obj2\n\n def source_to_object_names(self,source_files, temp_dir=''):\n file_list = map(lambda x: os.path.basename(x),source_files)\n file_base_ext = map(lambda x: os.path.splitext(x),file_list)\n object_list = map(lambda x: x[0] +'.o',file_base_ext)\n object_files = map(lambda x,td=temp_dir: os.path.join(td,x),object_list)\n return object_files\n \n def source_and_object_pairs(self,source_files, temp_dir=''):\n object_files = self.source_to_object_names(source_files,temp_dir)\n file_pairs = zip(source_files,object_files)\n return file_pairs\n \n def f_compile(self,compiler,switches, source_files,\n module_dirs=None, temp_dir=''):\n\n pp_opts = gen_preprocess_options(self.macros,self.include_dirs)\n\n switches = switches + ' ' + string.join(pp_opts,' ')\n\n module_switch = self.build_module_switch(module_dirs)\n file_pairs = self.source_and_object_pairs(source_files,temp_dir)\n object_files = []\n for source,object in file_pairs:\n if distutils.dep_util.newer(source,object):\n cmd = compiler + ' ' + switches + ' '+\\\n module_switch + \\\n ' -c ' + source + ' -o ' + object \n print yellow_text(cmd)\n failure = os.system(cmd)\n if failure:\n raise FortranCompileError, 'failure during compile' \n object_files.append(object)\n return object_files\n #return all object files to make sure everything is archived \n #return map(lambda x: x[1], file_pairs)\n\n def f90_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f90_switches, self.f90_opt))\n return self.f_compile(self.f90_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n def f77_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f77_switches, self.f77_opt))\n return self.f_compile(self.f77_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n\n def build_module_switch(self, module_dirs):\n return ''\n\n def create_static_lib(self, object_files, library_name,\n output_dir='', debug=None):\n lib_file = os.path.join(output_dir,'lib'+library_name+'.a')\n newer = distutils.dep_util.newer\n # This doesn't work -- no way to know if the file is in the archive\n #object_files = filter(lambda o,lib=lib_file:\\\n # distutils.dep_util.newer(o,lib),object_files)\n objects = string.join(object_files)\n if objects:\n cmd = 'ar -cur %s %s' % (lib_file,objects)\n print yellow_text(cmd)\n os.system(cmd)\n cmd = 'ranlib %s ' % lib_file\n print yellow_text(cmd)\n os.system(cmd)\n\n def build_library(self,library_name,source_list,module_dirs=None,\n temp_dir = ''):\n #make sure the temp directory exists before trying to build files\n import distutils.dir_util\n distutils.dir_util.mkpath(temp_dir)\n\n #this compiles the files\n object_list = self.to_object(source_list,\n module_dirs,\n temp_dir)\n\n # actually we need to use all the object file names here to\n # make sure the library is always built. It could occur that an\n # object file exists but hasn't been put in the archive. (happens\n # a lot when builds fail once and are restarted).\n object_list = self.source_to_object_names(source_list, temp_dir)\n\n if os.name == 'nt':\n # This is pure bunk...\n # Windows fails for long argument strings on the command line.\n # if objects is real long (> 2048 chars or so on my machine),\n # the command fails (cmd.exe /e:2048 on w2k)\n # for now we'll split linking into to steps which should work for\n objects = object_list[:]\n while objects:\n obj,objects = objects[:20],objects[20:]\n self.create_static_lib(obj,library_name,temp_dir)\n else:\n self.create_static_lib(object_list,library_name,temp_dir)\n\n def dummy_fortran_files(self):\n import tempfile \n d = tempfile.gettempdir()\n dummy_name = os.path.join(d,'__dummy.f')\n dummy = open(dummy_name,'w')\n dummy.write(\" subroutine dummy()\\n end\\n\")\n dummy.close()\n return (os.path.join(d,'__dummy.f'),os.path.join(d,'__dummy.o'))\n \n def is_available(self):\n return self.get_version()\n \n def get_version(self):\n \"\"\"Return the compiler version. If compiler is not available,\n return empty string.\"\"\"\n # XXX: Is there compilers that have no version? If yes,\n # this test will fail even if the compiler is available.\n if self.version is not None:\n # Finding version is expensive, so return previously found\n # version string.\n return self.version\n self.version = ''\n # works I think only for unix... \n print 'command:', yellow_text(self.ver_cmd)\n exit_status, out_text = run_command(self.ver_cmd)\n print exit_status,\n if not exit_status:\n print green_text(out_text)\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n else:\n print red_text(out_text)\n return self.version\n\n def get_libraries(self):\n return self.libraries\n def get_library_dirs(self):\n return self.library_dirs\n def get_extra_link_args(self):\n return []\n def get_runtime_library_dirs(self):\n return []\n def get_linker_so(self):\n \"\"\"\n If a compiler requires specific linker then return a list\n containing a linker executable name and linker options.\n Otherwise, return None.\n \"\"\"\n\n def __str__(self):\n return \"%s %s\" % (self.vendor, self.get_version())\n\n\nclass absoft_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Absoft'\n ver_match = r'FORTRAN 77 Compiler (?P[^\\s*,]*).*?Absoft Corp'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n # got rid of -B108 cause it was generating 2 underscores instead\n # of one on the newest version. Now we use -YEXT_SFX=_ to \n # specify the output format\n if os.name == 'nt':\n self.f90_switches = '-f fixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -Q100'\n self.f77_switches = '-N22 -N90 -N110'\n self.f77_opt = '-O -Q100'\n self.libraries = ['fio', 'fmath', 'f90math', 'COMDLG32']\n else:\n self.f90_switches = '-ffixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -B101' \n self.f77_switches = '-N22 -N90 -N110 -B108'\n self.f77_opt = '-O -B101'\n\n self.libraries = ['fio', 'f77math', 'f90math']\n \n try:\n dir = os.environ['ABSOFT'] \n self.library_dirs = [os.path.join(dir,'lib')]\n except KeyError:\n self.library_dirs = []\n\n self.ver_cmd = self.f77_compiler + ' -V -c %s -o %s' % \\\n self.dummy_fortran_files()\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -p' + mod\n return res\n\n def get_extra_link_args(self):\n return []\n # Couldn't get this to link for anything using gcc.\n #dr = \"c:\\\\Absoft62\\\\lib\"\n #libs = ['fio.lib', 'COMDLG32.lib','fmath.lib', 'f90math.lib','libcomdlg32.a' ] \n #libs = map(lambda x,dr=dr:os.path.join(dr,x),libs)\n #return libs\n\n\nclass sun_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Sun'\n #ver_match = r'f77: (?P[^\\s*,]*)'\n ver_match = r'f90: Sun (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -pic '\n self.f77_opt = ' -fast -dalign '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -fixed ' # ??? why fixed?\n self.f90_opt = ' -fast -dalign '\n\n self.ver_cmd = self.f90_compiler + ' -V'\n\n #self.libraries = ['f90', 'F77', 'M77', 'sunmath', 'm']\n self.libraries = ['fsu', 'F77', 'M77', 'sunmath', 'm']\n \n #threaded\n #self.libraries = ['f90', 'F77_mt', 'sunmath_mt', 'm', 'thread']\n #self.libraries = []\n self.library_dirs = self.find_lib_dir()\n #print 'sun:',self.library_dirs\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -M' + mod\n return res\n\n def find_lib_dir(self):\n library_dirs = []\n lib_match = r'### f90: Note: LD_RUN_PATH\\s*= '\\\n '(?P[^\\s.]*).*'\n cmd = self.f90_compiler + ' -dryrun dummy.f'\n exit_status, output = run_command(cmd)\n if not exit_status:\n libs = re.findall(lib_match,output)\n if libs:\n library_dirs = string.split(libs[0],':')\n self.get_version() # force version calculation\n compiler_home = os.path.dirname(library_dirs[0])\n library_dirs.append(os.path.join(compiler_home,\n self.version,'lib'))\n return library_dirs\n def get_runtime_library_dirs(self):\n return self.find_lib_dir()\n def get_extra_link_args(self):\n return ['-mimpure-text']\n\n\nclass mips_fortran_compiler(fortran_compiler_base):\n\n vendor = 'SGI'\n ver_match = r'MIPSpro Compilers: Version (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -n32 -KPIC '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -n32 -KPIC -fixedform ' # why fixed ???\n self.f90_opt = ' ' \n\n self.ver_cmd = self.f77_compiler + ' -version'\n \n self.libraries = ['fortran', 'ftn', 'm']\n self.library_dirs = self.find_lib_dir()\n\n\n\n def build_module_switch(self,module_dirs):\n res = ''\n return res \n def find_lib_dir(self):\n library_dirs = []\n return library_dirs\n def get_runtime_library_dirs(self):\n\treturn self.find_lib_dir() \n def get_extra_link_args(self):\n\treturn []\n\n\nclass gnu_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Gnu'\n #ver_match = r'g77 version (?P[^\\s*]*)'\n ver_match = r'GNU Fortran (?P[^\\s*]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if sys.platform == 'win32':\n self.libraries = ['gcc','g2c']\n self.library_dirs = self.find_lib_directories()\n else:\n # On linux g77 does not need lib_directories to be specified.\n self.libraries = ['g2c']\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n\n switches = ' -Wall -fno-second-underscore '\n\n if os.name != 'nt':\n switches = switches + ' -fpic '\n\n self.f77_switches = switches\n #self.ver_cmd = self.f77_compiler + ' -v '\n self.ver_cmd = self.f77_compiler + ' --version'\n\n self.f77_opt = self.get_opt()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 -funroll-loops '\n \n # only check for more optimization if g77 can handle\n # it.\n if self.get_version():\n if self.version[0]=='3': # is g77 3.x.x\n if cpu.is_AthlonK6():\n opt = opt + ' -march=k6 '\n elif cpu.is_AthlonK7():\n opt = opt + ' -march=athlon '\n if cpu.is_i686():\n opt = opt + ' -march=i686 '\n elif cpu.is_i586():\n opt = opt + ' -march=i586 '\n elif cpu.is_i486():\n opt = opt + ' -march=i486 '\n elif cpu.is_i386():\n opt = opt + ' -march=i386 '\n if cpu.is_Intel():\n opt = opt + ' -malign-double ' \n return opt\n \n def find_lib_directories(self):\n lib_dir = []\n match = r'Reading specs from (.*)/specs'\n\n # works I think only for unix... \n exit_status, out_text = run_command('g77 -v')\n if not exit_status:\n m = re.findall(match,out_text)\n if m:\n lib_dir= m #m[0] \n return lib_dir\n\n def get_linker_so(self):\n # win32 linking should be handled by standard linker\n if sys.platform != 'win32' and os.uname()[0] != 'Darwin':\n return [self.f77_compiler,'-shared']\n \n def f90_compile(self,source_files,module_files,temp_dir=''):\n raise DistutilsExecError, 'f90 not supported by Gnu'\n\n\n#http://developer.intel.com/software/products/compilers/f50/linux/\nclass intel_ia32_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Intel' # Intel(R) Corporation \n ver_match = r'Intel\\(R\\) Fortran Compiler for 32-bit applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'ifc'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -KPIC '\n\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n if cpu.has_fdiv_bug():\n switches = switches + ' -fdiv_check '\n if cpu.has_f00f_bug():\n switches = switches + ' -0f_check '\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -FI -w90 -w95 '\n\n self.f77_opt = self.f90_opt = self.get_opt()\n \n debug = ' -g -C '\n self.f77_debug = self.f90_debug = debug\n\n self.ver_cmd = self.f77_compiler+' -FI -V -c %s -o %s' %\\\n self.dummy_fortran_files()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 '\n if cpu.is_PentiumPro() or cpu.is_PentiumII():\n opt = opt + ' -tpp6 -xi '\n elif cpu.is_PentiumIII():\n opt = opt + ' -tpp6 '\n elif cpu.is_Pentium():\n opt = opt + ' -tpp5 '\n elif cpu.is_PentiumIV():\n opt = opt + ' -tpp7 -xW '\n elif cpu.has_mmx():\n opt = opt + ' -xM '\n return opt\n \n\n def get_linker_so(self):\n return [self.f77_compiler,'-shared']\n\n\nclass intel_itanium_fortran_compiler(intel_ia32_fortran_compiler):\n\n vendor = 'Itanium'\n ver_match = r'Intel\\(R\\) Fortran 90 Compiler Itanium\\(TM\\) Compiler for the Itanium\\(TM\\)-based applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n if fc is None:\n fc = 'efc'\n intel_ia32_fortran_compiler.__init__(self, fc, f90c)\n\n\nclass nag_fortran_compiler(fortran_compiler_base):\n\n vendor = 'NAG'\n ver_match = r'NAGWare Fortran 95 compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'f95'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ''\n debug = ' -g -gline -g90 -nan -C '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -fixed '\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -target=native '\n return opt\n\n def get_linker_so(self):\n return [self.f77_compiler,'-Wl,-shared']\n\n# http://www.fortran.com/F/compilers.html\n#\n# We define F compiler here but it is quite useless\n# because it does not support for fixed format sources\n# which makes it impossible to use with f2py generated\n# fixed format wrappers to F90 modules.\nclass f_fortran_compiler(fortran_compiler_base):\n\n vendor = 'F'\n ver_match = r'Fortran Company/NAG F compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'F'\n if f90c is None:\n f90c = 'F'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n self.ver_cmd = self.f90_compiler+' -V '\n\n gnu = gnu_fortran_compiler('g77')\n if not gnu.is_available(): # F compiler requires gcc.\n self.version = ''\n return\n if not self.is_available():\n return\n\n print red_text(\"\"\"\nWARNING: F compiler is unsupported due to its incompleteness.\n Send complaints to its vendor. For adding its support\n to scipy_distutils, it must be able to compile\n fixed format Fortran 90.\n\"\"\")\n\n self.f90_switches = ''\n self.f90_debug = ' -g -gline -g90 -C '\n self.f90_opt = ' -O '\n\n #self.f77_switches = gnu.f77_switches\n #self.f77_debug = gnu.f77_debug\n #self.f77_opt = gnu.f77_opt\n\n def get_linker_so(self):\n return ['gcc','-shared']\n\nclass vast_fortran_compiler(fortran_compiler_base):\n\n vendor = 'VAST'\n ver_match = r'\\s*Pacific-Sierra Research vf90 (Personal|Professional)\\s+(?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n d,b = os.path.split(f90c)\n vf90 = os.path.join(d,'v'+b)\n self.ver_cmd = vf90+' -v '\n\n gnu = gnu_fortran_compiler(fc)\n if not gnu.is_available(): # VAST compiler requires g77.\n self.version = ''\n return\n if not self.is_available():\n return\n\n self.f77_switches = gnu.f77_switches\n self.f77_debug = gnu.f77_debug\n self.f77_opt = gnu.f77_opt \n\n # XXX: need f90 switches, debug, opt\n\n def get_linker_so(self):\n return [self.f90_compiler,'-shared']\n\nclass compaq_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Compaq'\n ver_match = r'Compaq Fortran (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'fort'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -assume no2underscore -nomixed_str_len_arg '\n debug = ' -g -check_bounds '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n # XXX: uncomment if required\n #self.libraries = ' -lUfor -lfor -lFutil -lcpml -lots -lc '\n\n # XXX: fix the version showing flag\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -align dcommons -arch host -assume bigarrays -assume nozsize -math_library fast -tune host '\n return opt\n\n def get_linker_so(self):\n # XXX: is -shared needed?\n return [self.f77_compiler,'-shared']\n\n\ndef match_extension(files,ext):\n match = re.compile(r'.*[.]('+ext+r')\\Z',re.I).match\n return filter(lambda x,match = match: match(x),files)\n\ndef get_f77_files(files):\n return match_extension(files,'for|f77|ftn|f')\n\ndef get_f90_files(files):\n return match_extension(files,'f90|f95')\n\ndef get_fortran_files(files):\n return match_extension(files,'f90|f95|for|f77|ftn|f')\n\ndef find_fortran_compiler(vendor = None, fc = None, f90c = None):\n fcompiler = None\n for compiler_class in all_compilers:\n if vendor is not None and vendor != compiler_class.vendor:\n continue\n print compiler_class\n compiler = compiler_class(fc,f90c)\n if compiler.is_available():\n fcompiler = compiler\n break\n return fcompiler\n\nall_compilers = [absoft_fortran_compiler,\n mips_fortran_compiler,\n sun_fortran_compiler,\n intel_ia32_fortran_compiler,\n intel_itanium_fortran_compiler,\n nag_fortran_compiler,\n compaq_fortran_compiler,\n vast_fortran_compiler,\n f_fortran_compiler,\n gnu_fortran_compiler,\n ]\n\nif __name__ == \"__main__\":\n show_compilers()\n", + "methods": [ + { + "name": "run_command", + "long_name": "run_command( command )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 1, + "token_count": 32, + "parameters": [ + "command" + ], + "start_line": 67, + "end_line": 72, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "show_compilers", + "long_name": "show_compilers( )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 3, + "token_count": 26, + "parameters": [], + "start_line": 93, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "initialize_options", + "long_name": "initialize_options( self )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 1, + "token_count": 55, + "parameters": [ + "self" + ], + "start_line": 127, + "end_line": 139, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "finalize_options", + "long_name": "finalize_options( self )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 3, + "token_count": 107, + "parameters": [ + "self" + ], + "start_line": 143, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "has_f_libraries", + "long_name": "has_f_libraries( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 163, + "end_line": 165, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "run", + "long_name": "run( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 167, + "end_line": 170, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "has_f_library", + "long_name": "has_f_library( self , name )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 32, + "parameters": [ + "self", + "name" + ], + "start_line": 174, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "get_library_names", + "long_name": "get_library_names( self , name = None )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 8, + "token_count": 117, + "parameters": [ + "self", + "name" + ], + "start_line": 183, + "end_line": 203, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_names", + "long_name": "get_fcompiler_library_names( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 205, + "end_line": 210, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_dirs", + "long_name": "get_fcompiler_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 212, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self , name = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 109, + "parameters": [ + "self", + "name" + ], + "start_line": 221, + "end_line": 238, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 242, + "end_line": 251, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "get_source_files", + "long_name": "get_source_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 266, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "build_libraries", + "long_name": "build_libraries( self , fortran_libraries )", + "filename": "build_flib.py", + "nloc": 25, + "complexity": 10, + "token_count": 181, + "parameters": [ + "self", + "fortran_libraries" + ], + "start_line": 268, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 33, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , verbose = 0 , dry_run = 0 , force = 0 )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "verbose", + "dry_run", + "force" + ], + "start_line": 314, + "end_line": 337, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "to_object", + "long_name": "to_object( self , dirty_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 16, + "complexity": 3, + "token_count": 89, + "parameters": [ + "self", + "dirty_files", + "module_dirs", + "temp_dir" + ], + "start_line": 339, + "end_line": 354, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "source_to_object_names", + "long_name": "source_to_object_names( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 1, + "token_count": 89, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 356, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "source_and_object_pairs", + "long_name": "source_and_object_pairs( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 363, + "end_line": 366, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f_compile", + "long_name": "f_compile( self , compiler , switches , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 4, + "token_count": 135, + "parameters": [ + "self", + "compiler", + "switches", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 368, + "end_line": 388, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 392, + "end_line": 395, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f77_compile", + "long_name": "f77_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 397, + "end_line": 400, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 403, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "create_static_lib", + "long_name": "create_static_lib( self , object_files , library_name , output_dir = '' , debug = None )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 2, + "token_count": 87, + "parameters": [ + "self", + "object_files", + "library_name", + "output_dir", + "debug" + ], + "start_line": 406, + "end_line": 420, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "build_library", + "long_name": "build_library( self , library_name , source_list , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self", + "library_name", + "source_list", + "module_dirs", + "temp_dir" + ], + "start_line": 422, + "end_line": 450, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "dummy_fortran_files", + "long_name": "dummy_fortran_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 1, + "token_count": 69, + "parameters": [ + "self" + ], + "start_line": 452, + "end_line": 459, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "is_available", + "long_name": "is_available( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 461, + "end_line": 462, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 4, + "token_count": 90, + "parameters": [ + "self" + ], + "start_line": 464, + "end_line": 485, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 1 + }, + { + "name": "get_libraries", + "long_name": "get_libraries( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 487, + "end_line": 488, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 489, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 491, + "end_line": 492, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 493, + "end_line": 494, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 1, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 495, + "end_line": 500, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 502, + "end_line": 503, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 31, + "complexity": 5, + "token_count": 177, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 511, + "end_line": 549, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 39, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 551, + "end_line": 556, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 558, + "end_line": 559, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 98, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 573, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 599, + "end_line": 604, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 99, + "parameters": [ + "self" + ], + "start_line": 606, + "end_line": 620, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 621, + "end_line": 622, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 623, + "end_line": 624, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 94, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 632, + "end_line": 650, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 653, + "end_line": 655, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 656, + "end_line": 658, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 659, + "end_line": 660, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 661, + "end_line": 662, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 671, + "end_line": 696, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 21, + "complexity": 10, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 698, + "end_line": 721, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "find_lib_directories", + "long_name": "find_lib_directories( self )", + "filename": "build_flib.py", + "nloc": 9, + "complexity": 3, + "token_count": 43, + "parameters": [ + "self" + ], + "start_line": 723, + "end_line": 733, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 3, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 735, + "end_line": 738, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "source_files", + "module_files", + "temp_dir" + ], + "start_line": 740, + "end_line": 741, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 22, + "complexity": 5, + "token_count": 140, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 750, + "end_line": 778, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 85, + "parameters": [ + "self" + ], + "start_line": 780, + "end_line": 794, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 797, + "end_line": 798, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 806, + "end_line": 809, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 817, + "end_line": 836, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 838, + "end_line": 840, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 842, + "end_line": 843, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 24, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 856, + "end_line": 884, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 890, + "end_line": 891, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 20, + "complexity": 5, + "token_count": 128, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 898, + "end_line": 922, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 926, + "end_line": 927, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 14, + "complexity": 3, + "token_count": 91, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 934, + "end_line": 956, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 958, + "end_line": 960, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 962, + "end_line": 964, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "match_extension", + "long_name": "match_extension( files , ext )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 44, + "parameters": [ + "files", + "ext" + ], + "start_line": 967, + "end_line": 969, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "get_f77_files", + "long_name": "get_f77_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 971, + "end_line": 972, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_f90_files", + "long_name": "get_f90_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 974, + "end_line": 975, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_fortran_files", + "long_name": "get_fortran_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 977, + "end_line": 978, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "find_fortran_compiler", + "long_name": "find_fortran_compiler( vendor = None , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 5, + "token_count": 59, + "parameters": [ + "vendor", + "fc", + "f90c" + ], + "start_line": 980, + "end_line": 990, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "run_command", + "long_name": "run_command( command )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 1, + "token_count": 32, + "parameters": [ + "command" + ], + "start_line": 67, + "end_line": 72, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "show_compilers", + "long_name": "show_compilers( )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 3, + "token_count": 26, + "parameters": [], + "start_line": 93, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "initialize_options", + "long_name": "initialize_options( self )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 1, + "token_count": 55, + "parameters": [ + "self" + ], + "start_line": 127, + "end_line": 139, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "finalize_options", + "long_name": "finalize_options( self )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 3, + "token_count": 107, + "parameters": [ + "self" + ], + "start_line": 143, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "has_f_libraries", + "long_name": "has_f_libraries( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 163, + "end_line": 165, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "run", + "long_name": "run( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 167, + "end_line": 170, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "has_f_library", + "long_name": "has_f_library( self , name )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 32, + "parameters": [ + "self", + "name" + ], + "start_line": 174, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "get_library_names", + "long_name": "get_library_names( self , name = None )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 8, + "token_count": 117, + "parameters": [ + "self", + "name" + ], + "start_line": 183, + "end_line": 203, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_names", + "long_name": "get_fcompiler_library_names( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 205, + "end_line": 210, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_dirs", + "long_name": "get_fcompiler_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 212, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self , name = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 109, + "parameters": [ + "self", + "name" + ], + "start_line": 221, + "end_line": 238, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 242, + "end_line": 251, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "get_source_files", + "long_name": "get_source_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 266, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "build_libraries", + "long_name": "build_libraries( self , fortran_libraries )", + "filename": "build_flib.py", + "nloc": 25, + "complexity": 10, + "token_count": 181, + "parameters": [ + "self", + "fortran_libraries" + ], + "start_line": 268, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 33, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , verbose = 0 , dry_run = 0 , force = 0 )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "verbose", + "dry_run", + "force" + ], + "start_line": 314, + "end_line": 337, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "to_object", + "long_name": "to_object( self , dirty_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 16, + "complexity": 3, + "token_count": 89, + "parameters": [ + "self", + "dirty_files", + "module_dirs", + "temp_dir" + ], + "start_line": 339, + "end_line": 354, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "source_to_object_names", + "long_name": "source_to_object_names( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 1, + "token_count": 89, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 356, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "source_and_object_pairs", + "long_name": "source_and_object_pairs( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 363, + "end_line": 366, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f_compile", + "long_name": "f_compile( self , compiler , switches , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 4, + "token_count": 135, + "parameters": [ + "self", + "compiler", + "switches", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 368, + "end_line": 388, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 392, + "end_line": 395, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f77_compile", + "long_name": "f77_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 397, + "end_line": 400, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 403, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "create_static_lib", + "long_name": "create_static_lib( self , object_files , library_name , output_dir = '' , debug = None )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 2, + "token_count": 87, + "parameters": [ + "self", + "object_files", + "library_name", + "output_dir", + "debug" + ], + "start_line": 406, + "end_line": 420, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "build_library", + "long_name": "build_library( self , library_name , source_list , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self", + "library_name", + "source_list", + "module_dirs", + "temp_dir" + ], + "start_line": 422, + "end_line": 450, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "dummy_fortran_files", + "long_name": "dummy_fortran_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 1, + "token_count": 69, + "parameters": [ + "self" + ], + "start_line": 452, + "end_line": 459, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "is_available", + "long_name": "is_available( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 461, + "end_line": 462, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 4, + "token_count": 90, + "parameters": [ + "self" + ], + "start_line": 464, + "end_line": 485, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 1 + }, + { + "name": "get_libraries", + "long_name": "get_libraries( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 487, + "end_line": 488, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 489, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 491, + "end_line": 492, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 493, + "end_line": 494, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 1, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 495, + "end_line": 500, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 502, + "end_line": 503, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 31, + "complexity": 5, + "token_count": 177, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 511, + "end_line": 549, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 39, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 551, + "end_line": 556, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 558, + "end_line": 559, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 98, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 573, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 599, + "end_line": 604, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 99, + "parameters": [ + "self" + ], + "start_line": 606, + "end_line": 620, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 621, + "end_line": 622, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 623, + "end_line": 624, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 94, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 632, + "end_line": 650, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 654, + "end_line": 656, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 657, + "end_line": 659, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 660, + "end_line": 661, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 662, + "end_line": 663, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 672, + "end_line": 697, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 21, + "complexity": 10, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 699, + "end_line": 722, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "find_lib_directories", + "long_name": "find_lib_directories( self )", + "filename": "build_flib.py", + "nloc": 9, + "complexity": 3, + "token_count": 43, + "parameters": [ + "self" + ], + "start_line": 724, + "end_line": 734, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 3, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 736, + "end_line": 739, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "source_files", + "module_files", + "temp_dir" + ], + "start_line": 741, + "end_line": 742, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 22, + "complexity": 5, + "token_count": 140, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 751, + "end_line": 779, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 85, + "parameters": [ + "self" + ], + "start_line": 781, + "end_line": 795, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 798, + "end_line": 799, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 807, + "end_line": 810, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 818, + "end_line": 837, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 839, + "end_line": 841, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 843, + "end_line": 844, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 24, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 857, + "end_line": 885, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 891, + "end_line": 892, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 20, + "complexity": 5, + "token_count": 128, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 899, + "end_line": 923, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 927, + "end_line": 928, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 14, + "complexity": 3, + "token_count": 91, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 935, + "end_line": 957, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 959, + "end_line": 961, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 963, + "end_line": 965, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "match_extension", + "long_name": "match_extension( files , ext )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 44, + "parameters": [ + "files", + "ext" + ], + "start_line": 968, + "end_line": 970, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "get_f77_files", + "long_name": "get_f77_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 972, + "end_line": 973, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_f90_files", + "long_name": "get_f90_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 975, + "end_line": 976, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_fortran_files", + "long_name": "get_fortran_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 978, + "end_line": 979, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "find_fortran_compiler", + "long_name": "find_fortran_compiler( vendor = None , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 5, + "token_count": 59, + "parameters": [ + "vendor", + "fc", + "f90c" + ], + "start_line": 981, + "end_line": 991, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + } + ], + "changed_methods": [], + "nloc": 715, + "complexity": 177, + "token_count": 4142, + "diff_parsed": { + "added": [], + "deleted": [ + "" + ] + } + } + ] + }, + { + "hash": "4a7ef6921cea42d182fa29c54a3d71998d407826", + "msg": "Added HP F90 compiler", + "author": { + "name": "Pearu Peterson", + "email": "pearu.peterson@gmail.com" + }, + "committer": { + "name": "Pearu Peterson", + "email": "pearu.peterson@gmail.com" + }, + "author_date": "2002-05-08T16:00:26+00:00", + "author_timezone": 0, + "committer_date": "2002-05-08T16:00:26+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "3316dc62a92b8f06d36d316509755af04490c1b7" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 0, + "insertions": 45, + "lines": 45, + "files": 1, + "dmm_unit_size": 1.0, + "dmm_unit_complexity": 1.0, + "dmm_unit_interfacing": 0.5, + "modified_files": [ + { + "old_path": "scipy_distutils/command/build_flib.py", + "new_path": "scipy_distutils/command/build_flib.py", + "filename": "build_flib.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -661,6 +661,49 @@ def get_runtime_library_dirs(self):\n def get_extra_link_args(self):\n \treturn []\n \n+class hpux_fortran_compiler(fortran_compiler_base):\n+\n+ vendor = 'HP'\n+ ver_match = r'HP F90 (?P[^\\s*,]*)'\n+\n+ def __init__(self, fc = None, f90c = None):\n+ fortran_compiler_base.__init__(self)\n+ if fc is None:\n+ fc = 'f90'\n+ if f90c is None:\n+ f90c = 'f90'\n+\n+ self.f77_compiler = fc\n+ self.f77_switches = ' +pic=long '\n+ self.f77_opt = ' -O3 '\n+\n+ self.f90_compiler = f90c\n+ self.f90_switches = ' +pic=long '\n+ self.f90_opt = ' -O3 '\n+\n+ self.ver_cmd = self.f77_compiler + ' +version '\n+\n+ self.libraries = ['m']\n+ self.library_dirs = []\n+\n+ def get_version(self):\n+ if self.version is not None:\n+ return self.version\n+ self.version = ''\n+ print 'command:', yellow_text(self.ver_cmd)\n+ exit_status, out_text = run_command(self.ver_cmd)\n+ print exit_status,\n+ if exit_status in [0,256]:\n+ # 256 seems to indicate success on HP-UX but keeping\n+ # also 0. Or does 0 exit status mean something different\n+ # in this platform?\n+ print green_text(out_text)\n+ m = re.match(self.ver_match,out_text)\n+ if m:\n+ self.version = m.group('version')\n+ else:\n+ print red_text(out_text)\n+ return self.version\n \n class gnu_fortran_compiler(fortran_compiler_base):\n \n@@ -997,8 +1040,10 @@ def find_fortran_compiler(vendor = None, fc = None, f90c = None):\n nag_fortran_compiler,\n compaq_fortran_compiler,\n vast_fortran_compiler,\n+ hpux_fortran_compiler,\n f_fortran_compiler,\n gnu_fortran_compiler,\n+\n ]\n \n if __name__ == \"__main__\":\n", + "added_lines": 45, + "deleted_lines": 0, + "source_code": "\"\"\" Implements the build_flib command which should go into Distutils\n at some point.\n \n Note:\n Right now, we're dynamically linking to the Fortran libraries on \n some platforms (Sun for sure). This is fine for local installations\n but a bad thing for redistribution because these libraries won't\n live on any machine that doesn't have a fortran compiler installed.\n It is pretty hard (impossible?) to get gcc to pass the right compiler\n flags on Sun to get the linker to use static libs for the fortran\n stuff. Investigate further...\n\nBugs:\n *** Options -e and -x have no effect when used with --help-compiler\n options. E.g. \n ./setup.py build_flib --help-compiler -e g77-3.0\n finds g77-2.95.\n How to extract these options inside the show_compilers function?\n *** compiler.is_available() method may not work correctly on nt\n because of lack of knowledge how to get exit status in\n run_command function. However, it may give reasonable results\n based on a version string.\n *** Some vendors provide different compilers for F77 and F90\n compilations. Currently, checking the availability of these\n compilers is based on only checking the availability of the\n corresponding F77 compiler. If it exists, then F90 is assumed\n to exist also.\n *** F compiler from Fortran Compiler is _not_ supported, though it\n is defined below. The reasons is that this F95 compiler is\n incomplete: it does not compile fixed format sources and\n that is needed by f2py generated wrappers for F90 modules.\n To support F as it is, some effort is needed to re-code\n f2py but it is not clear if this effort is worth.\n May be in future...\n\nOpen issues:\n *** User-defined compiler flags. Do we need --fflags?\n\nFortran compilers (as to be used with --fcompiler= option):\n Absoft\n Sun\n SGI\n Intel\n Itanium\n NAG\n Compaq\n Gnu\n VAST\n F [unsupported]\n\"\"\"\n\nimport distutils\nimport distutils.dep_util, distutils.dir_util\nimport os,sys,string\nimport commands,re\nfrom types import *\nfrom distutils.ccompiler import CCompiler,gen_preprocess_options\nfrom distutils.command.build_clib import build_clib\nfrom distutils.errors import *\n\nclass FortranCompilerError (CCompilerError):\n \"\"\"Some compile/link operation failed.\"\"\"\nclass FortranCompileError (FortranCompilerError):\n \"\"\"Failure to compile one or more Fortran source files.\"\"\"\n\nif os.name == 'nt':\n def run_command(command):\n \"\"\" not sure how to get exit status on nt. \"\"\"\n in_pipe,out_pipe = os.popen4(command)\n in_pipe.close()\n text = out_pipe.read()\n return 0, text\nelse:\n run_command = commands.getstatusoutput\n\n# Hooks for colored terminal output. Could be in a more general use.\n# See also http://www.livinglogic.de/Python/ansistyle\nif os.environ.get('TERM',None) in ['rxvt','xterm']:\n # Need a better way to determine whether a terminal supports colors\n def red_text(s): return '\\x1b[31m%s\\x1b[0m'%s\n def green_text(s): return '\\x1b[32m%s\\x1b[0m'%s\n def yellow_text(s): return '\\x1b[33m%s\\x1b[0m'%s\n def blue_text(s): return '\\x1b[34m%s\\x1b[0m'%s\n def cyan_text(s): return '\\x1b[35m%s\\x1b[0m'%s\nelse:\n def red_text(s): return s\n def green_text(s): return s\n def yellow_text(s): return s\n def cyan_text(s): return s\n def blue_text(s): return s\n\n\ndef show_compilers():\n for compiler_class in all_compilers:\n compiler = compiler_class()\n if compiler.is_available():\n print cyan_text(compiler)\n\nclass build_flib (build_clib):\n\n description = \"build f77/f90 libraries used by Python extensions\"\n\n user_options = [\n ('build-flib', 'b',\n \"directory to build f77/f90 libraries to\"),\n ('build-temp', 't',\n \"directory to put temporary build by-products\"),\n ('debug', 'g',\n \"compile with debugging information\"),\n ('force', 'f',\n \"forcibly build everything (ignore file timestamps)\"),\n ('fcompiler=', 'c',\n \"specify the compiler type\"),\n ('fcompiler-exec=', 'e',\n \"specify the path to F77 compiler\"),\n ('f90compiler-exec=', 'x',\n \"specify the path to F90 compiler\"),\n ]\n\n boolean_options = ['debug', 'force']\n\n help_options = [\n ('help-compiler', None,\n \"list available compilers\", show_compilers),\n ]\n\n def initialize_options (self):\n\n self.build_flib = None\n self.build_temp = None\n\n self.fortran_libraries = None\n self.define = None\n self.undef = None\n self.debug = None\n self.force = 0\n self.fcompiler = None\n self.fcompiler_exec = None\n self.f90compiler_exec = None\n\n # initialize_options()\n\n def finalize_options (self):\n self.set_undefined_options('build',\n ('build_temp', 'build_flib'),\n ('build_temp', 'build_temp'),\n ('debug', 'debug'),\n ('force', 'force'))\n fc = find_fortran_compiler(self.fcompiler,\n self.fcompiler_exec,\n self.f90compiler_exec)\n if not fc:\n raise DistutilsOptionError, 'Fortran compiler not available: %s'%(self.fcompiler)\n else:\n self.announce(cyan_text(' using %s Fortran compiler' % fc))\n self.fcompiler = fc\n if self.has_f_libraries():\n self.fortran_libraries = self.distribution.fortran_libraries\n self.check_library_list(self.fortran_libraries)\n \n # finalize_options()\n\n def has_f_libraries(self):\n return self.distribution.fortran_libraries \\\n and len(self.distribution.fortran_libraries) > 0\n\n def run (self):\n if not self.has_f_libraries():\n return\n self.build_libraries(self.fortran_libraries)\n\n # run ()\n\n def has_f_library(self,name):\n if self.has_f_libraries():\n # If self.fortran_libraries is None at this point\n # then it means that build_flib was called before\n # build. Always call build before build_flib.\n for (lib_name, build_info) in self.fortran_libraries:\n if lib_name == name:\n return 1\n \n def get_library_names(self, name=None):\n if not self.has_f_libraries():\n return None\n\n lib_names = []\n\n if name is None:\n for (lib_name, build_info) in self.fortran_libraries:\n lib_names.append(lib_name)\n\n if self.fcompiler is not None:\n lib_names.extend(self.fcompiler.get_libraries())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n for n in build_info.get('libraries',[]):\n lib_names.append(n)\n #XXX: how to catch recursive calls here?\n lib_names.extend(self.get_library_names(n))\n break\n return lib_names\n\n def get_fcompiler_library_names(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_libraries()\n return []\n\n def get_fcompiler_library_dirs(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_library_dirs()\n return []\n\n # get_library_names ()\n\n def get_library_dirs(self, name=None):\n if not self.has_f_libraries():\n return []\n\n lib_dirs = [] \n\n if name is None:\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_library_dirs())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n lib_dirs.extend(build_info.get('library_dirs',[]))\n for n in build_info.get('libraries',[]):\n lib_dirs.extend(self.get_library_dirs(n))\n break\n\n return lib_dirs\n\n # get_library_dirs ()\n\n def get_runtime_library_dirs(self):\n #if not self.has_f_libraries():\n # return []\n\n lib_dirs = []\n\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_runtime_library_dirs())\n \n return lib_dirs\n\n # get_library_dirs ()\n\n def get_source_files (self):\n if not self.has_f_libraries():\n return []\n\n self.check_library_list(self.fortran_libraries)\n filenames = []\n\n # Gets source files specified \n for ext in self.fortran_libraries:\n filenames.extend(ext[1]['sources'])\n\n return filenames \n \n def build_libraries (self, fortran_libraries):\n \n fcompiler = self.fcompiler\n \n for (lib_name, build_info) in fortran_libraries:\n self.announce(\" building '%s' library\" % lib_name)\n\n sources = build_info.get('sources')\n if sources is None or type(sources) not in (ListType, TupleType):\n raise DistutilsSetupError, \\\n (\"in 'fortran_libraries' option (library '%s'), \" +\n \"'sources' must be present and must be \" +\n \"a list of source filenames\") % lib_name\n sources = list(sources)\n module_dirs = build_info.get('module_dirs')\n module_files = build_info.get('module_files')\n\n\n include_dirs = build_info.get('include_dirs')\n\n if include_dirs:\n fcompiler.set_include_dirs(include_dirs)\n for n,v in build_info.get('define_macros') or []:\n fcompiler.define_macro(n,v)\n for n in build_info.get('undef_macros') or []:\n fcompiler.undefine_macro(n)\n\n if module_files:\n fcompiler.build_library(lib_name, module_files,\n temp_dir=self.build_temp)\n \n fcompiler.build_library(lib_name, sources,\n module_dirs, temp_dir=self.build_temp)\n\n # for loop\n\n # build_libraries ()\n\nclass fortran_compiler_base(CCompiler):\n\n vendor = None\n ver_match = None\n\n compiler_type = 'fortran'\n executables = {}\n \n def __init__(self,verbose=0,dry_run=0,force=0):\n # Default initialization. Constructors of derived classes MUST\n # call this function.\n CCompiler.__init__(self,verbose,dry_run,force)\n\n self.version = None\n \n self.f77_switches = ''\n self.f77_opt = ''\n self.f77_debug = ''\n \n self.f90_switches = ''\n self.f90_opt = ''\n self.f90_debug = ''\n \n #self.libraries = []\n #self.library_dirs = []\n\n if self.vendor is None:\n raise DistutilsInternalError,\\\n '%s must define vendor attribute'%(self.__class__)\n if self.ver_match is None:\n raise DistutilsInternalError,\\\n '%s must define ver_match attribute'%(self.__class__)\n\n def to_object(self,\n dirty_files,\n module_dirs=None,\n temp_dir=''):\n files = string.join(dirty_files)\n f90_files = get_f90_files(dirty_files)\n f77_files = get_f77_files(dirty_files)\n if f90_files != []:\n obj1 = self.f90_compile(f90_files,module_dirs,temp_dir = temp_dir)\n else:\n obj1 = []\n if f77_files != []:\n obj2 = self.f77_compile(f77_files, temp_dir = temp_dir)\n else:\n obj2 = []\n return obj1 + obj2\n\n def source_to_object_names(self,source_files, temp_dir=''):\n file_list = map(lambda x: os.path.basename(x),source_files)\n file_base_ext = map(lambda x: os.path.splitext(x),file_list)\n object_list = map(lambda x: x[0] +'.o',file_base_ext)\n object_files = map(lambda x,td=temp_dir: os.path.join(td,x),object_list)\n return object_files\n \n def source_and_object_pairs(self,source_files, temp_dir=''):\n object_files = self.source_to_object_names(source_files,temp_dir)\n file_pairs = zip(source_files,object_files)\n return file_pairs\n \n def f_compile(self,compiler,switches, source_files,\n module_dirs=None, temp_dir=''):\n\n pp_opts = gen_preprocess_options(self.macros,self.include_dirs)\n\n switches = switches + ' ' + string.join(pp_opts,' ')\n\n module_switch = self.build_module_switch(module_dirs)\n file_pairs = self.source_and_object_pairs(source_files,temp_dir)\n object_files = []\n for source,object in file_pairs:\n if distutils.dep_util.newer(source,object):\n cmd = compiler + ' ' + switches + ' '+\\\n module_switch + \\\n ' -c ' + source + ' -o ' + object \n print yellow_text(cmd)\n failure = os.system(cmd)\n if failure:\n raise FortranCompileError, 'failure during compile' \n object_files.append(object)\n return object_files\n #return all object files to make sure everything is archived \n #return map(lambda x: x[1], file_pairs)\n\n def f90_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f90_switches, self.f90_opt))\n return self.f_compile(self.f90_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n def f77_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f77_switches, self.f77_opt))\n return self.f_compile(self.f77_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n\n def build_module_switch(self, module_dirs):\n return ''\n\n def create_static_lib(self, object_files, library_name,\n output_dir='', debug=None):\n lib_file = os.path.join(output_dir,'lib'+library_name+'.a')\n newer = distutils.dep_util.newer\n # This doesn't work -- no way to know if the file is in the archive\n #object_files = filter(lambda o,lib=lib_file:\\\n # distutils.dep_util.newer(o,lib),object_files)\n objects = string.join(object_files)\n if objects:\n cmd = 'ar -cur %s %s' % (lib_file,objects)\n print yellow_text(cmd)\n os.system(cmd)\n cmd = 'ranlib %s ' % lib_file\n print yellow_text(cmd)\n os.system(cmd)\n\n def build_library(self,library_name,source_list,module_dirs=None,\n temp_dir = ''):\n #make sure the temp directory exists before trying to build files\n import distutils.dir_util\n distutils.dir_util.mkpath(temp_dir)\n\n #this compiles the files\n object_list = self.to_object(source_list,\n module_dirs,\n temp_dir)\n\n # actually we need to use all the object file names here to\n # make sure the library is always built. It could occur that an\n # object file exists but hasn't been put in the archive. (happens\n # a lot when builds fail once and are restarted).\n object_list = self.source_to_object_names(source_list, temp_dir)\n\n if os.name == 'nt':\n # This is pure bunk...\n # Windows fails for long argument strings on the command line.\n # if objects is real long (> 2048 chars or so on my machine),\n # the command fails (cmd.exe /e:2048 on w2k)\n # for now we'll split linking into to steps which should work for\n objects = object_list[:]\n while objects:\n obj,objects = objects[:20],objects[20:]\n self.create_static_lib(obj,library_name,temp_dir)\n else:\n self.create_static_lib(object_list,library_name,temp_dir)\n\n def dummy_fortran_files(self):\n import tempfile \n d = tempfile.gettempdir()\n dummy_name = os.path.join(d,'__dummy.f')\n dummy = open(dummy_name,'w')\n dummy.write(\" subroutine dummy()\\n end\\n\")\n dummy.close()\n return (os.path.join(d,'__dummy.f'),os.path.join(d,'__dummy.o'))\n \n def is_available(self):\n return self.get_version()\n \n def get_version(self):\n \"\"\"Return the compiler version. If compiler is not available,\n return empty string.\"\"\"\n # XXX: Is there compilers that have no version? If yes,\n # this test will fail even if the compiler is available.\n if self.version is not None:\n # Finding version is expensive, so return previously found\n # version string.\n return self.version\n self.version = ''\n # works I think only for unix... \n print 'command:', yellow_text(self.ver_cmd)\n exit_status, out_text = run_command(self.ver_cmd)\n print exit_status,\n if not exit_status:\n print green_text(out_text)\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n else:\n print red_text(out_text)\n return self.version\n\n def get_libraries(self):\n return self.libraries\n def get_library_dirs(self):\n return self.library_dirs\n def get_extra_link_args(self):\n return []\n def get_runtime_library_dirs(self):\n return []\n def get_linker_so(self):\n \"\"\"\n If a compiler requires specific linker then return a list\n containing a linker executable name and linker options.\n Otherwise, return None.\n \"\"\"\n\n def __str__(self):\n return \"%s %s\" % (self.vendor, self.get_version())\n\n\nclass absoft_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Absoft'\n ver_match = r'FORTRAN 77 Compiler (?P[^\\s*,]*).*?Absoft Corp'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n # got rid of -B108 cause it was generating 2 underscores instead\n # of one on the newest version. Now we use -YEXT_SFX=_ to \n # specify the output format\n if os.name == 'nt':\n self.f90_switches = '-f fixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -Q100'\n self.f77_switches = '-N22 -N90 -N110'\n self.f77_opt = '-O -Q100'\n self.libraries = ['fio', 'fmath', 'f90math', 'COMDLG32']\n else:\n self.f90_switches = '-ffixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -B101' \n self.f77_switches = '-N22 -N90 -N110 -B108'\n self.f77_opt = '-O -B101'\n\n self.libraries = ['fio', 'f77math', 'f90math']\n \n try:\n dir = os.environ['ABSOFT'] \n self.library_dirs = [os.path.join(dir,'lib')]\n except KeyError:\n self.library_dirs = []\n\n self.ver_cmd = self.f77_compiler + ' -V -c %s -o %s' % \\\n self.dummy_fortran_files()\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -p' + mod\n return res\n\n def get_extra_link_args(self):\n return []\n # Couldn't get this to link for anything using gcc.\n #dr = \"c:\\\\Absoft62\\\\lib\"\n #libs = ['fio.lib', 'COMDLG32.lib','fmath.lib', 'f90math.lib','libcomdlg32.a' ] \n #libs = map(lambda x,dr=dr:os.path.join(dr,x),libs)\n #return libs\n\n\nclass sun_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Sun'\n #ver_match = r'f77: (?P[^\\s*,]*)'\n ver_match = r'f90: Sun (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -pic '\n self.f77_opt = ' -fast -dalign '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -fixed ' # ??? why fixed?\n self.f90_opt = ' -fast -dalign '\n\n self.ver_cmd = self.f90_compiler + ' -V'\n\n #self.libraries = ['f90', 'F77', 'M77', 'sunmath', 'm']\n self.libraries = ['fsu', 'F77', 'M77', 'sunmath', 'm']\n \n #threaded\n #self.libraries = ['f90', 'F77_mt', 'sunmath_mt', 'm', 'thread']\n #self.libraries = []\n self.library_dirs = self.find_lib_dir()\n #print 'sun:',self.library_dirs\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -M' + mod\n return res\n\n def find_lib_dir(self):\n library_dirs = []\n lib_match = r'### f90: Note: LD_RUN_PATH\\s*= '\\\n '(?P[^\\s.]*).*'\n cmd = self.f90_compiler + ' -dryrun dummy.f'\n exit_status, output = run_command(cmd)\n if not exit_status:\n libs = re.findall(lib_match,output)\n if libs:\n library_dirs = string.split(libs[0],':')\n self.get_version() # force version calculation\n compiler_home = os.path.dirname(library_dirs[0])\n library_dirs.append(os.path.join(compiler_home,\n self.version,'lib'))\n return library_dirs\n def get_runtime_library_dirs(self):\n return self.find_lib_dir()\n def get_extra_link_args(self):\n return ['-mimpure-text']\n\n\nclass mips_fortran_compiler(fortran_compiler_base):\n\n vendor = 'SGI'\n ver_match = r'MIPSpro Compilers: Version (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -n32 -KPIC '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -n32 -KPIC -fixedform ' # why fixed ???\n self.f90_opt = ' ' \n\n self.ver_cmd = self.f77_compiler + ' -version'\n \n self.libraries = ['fortran', 'ftn', 'm']\n self.library_dirs = self.find_lib_dir()\n\n\n def build_module_switch(self,module_dirs):\n res = ''\n return res \n def find_lib_dir(self):\n library_dirs = []\n return library_dirs\n def get_runtime_library_dirs(self):\n\treturn self.find_lib_dir() \n def get_extra_link_args(self):\n\treturn []\n\nclass hpux_fortran_compiler(fortran_compiler_base):\n\n vendor = 'HP'\n ver_match = r'HP F90 (?P[^\\s*,]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f90'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f77_switches = ' +pic=long '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' +pic=long '\n self.f90_opt = ' -O3 '\n\n self.ver_cmd = self.f77_compiler + ' +version '\n\n self.libraries = ['m']\n self.library_dirs = []\n\n def get_version(self):\n if self.version is not None:\n return self.version\n self.version = ''\n print 'command:', yellow_text(self.ver_cmd)\n exit_status, out_text = run_command(self.ver_cmd)\n print exit_status,\n if exit_status in [0,256]:\n # 256 seems to indicate success on HP-UX but keeping\n # also 0. Or does 0 exit status mean something different\n # in this platform?\n print green_text(out_text)\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n else:\n print red_text(out_text)\n return self.version\n\nclass gnu_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Gnu'\n #ver_match = r'g77 version (?P[^\\s*]*)'\n ver_match = r'GNU Fortran (?P[^\\s*]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if sys.platform == 'win32':\n self.libraries = ['gcc','g2c']\n self.library_dirs = self.find_lib_directories()\n else:\n # On linux g77 does not need lib_directories to be specified.\n self.libraries = ['g2c']\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n\n switches = ' -Wall -fno-second-underscore '\n\n if os.name != 'nt':\n switches = switches + ' -fpic '\n\n self.f77_switches = switches\n #self.ver_cmd = self.f77_compiler + ' -v '\n self.ver_cmd = self.f77_compiler + ' --version'\n\n self.f77_opt = self.get_opt()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 -funroll-loops '\n \n # only check for more optimization if g77 can handle\n # it.\n if self.get_version():\n if self.version[0]=='3': # is g77 3.x.x\n if cpu.is_AthlonK6():\n opt = opt + ' -march=k6 '\n elif cpu.is_AthlonK7():\n opt = opt + ' -march=athlon '\n if cpu.is_i686():\n opt = opt + ' -march=i686 '\n elif cpu.is_i586():\n opt = opt + ' -march=i586 '\n elif cpu.is_i486():\n opt = opt + ' -march=i486 '\n elif cpu.is_i386():\n opt = opt + ' -march=i386 '\n if cpu.is_Intel():\n opt = opt + ' -malign-double ' \n return opt\n \n def find_lib_directories(self):\n lib_dir = []\n match = r'Reading specs from (.*)/specs'\n\n # works I think only for unix... \n exit_status, out_text = run_command('g77 -v')\n if not exit_status:\n m = re.findall(match,out_text)\n if m:\n lib_dir= m #m[0] \n return lib_dir\n\n def get_linker_so(self):\n # win32 linking should be handled by standard linker\n if sys.platform != 'win32' and os.uname()[0] != 'Darwin':\n return [self.f77_compiler,'-shared']\n \n def f90_compile(self,source_files,module_files,temp_dir=''):\n raise DistutilsExecError, 'f90 not supported by Gnu'\n\n\n#http://developer.intel.com/software/products/compilers/f50/linux/\nclass intel_ia32_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Intel' # Intel(R) Corporation \n ver_match = r'Intel\\(R\\) Fortran Compiler for 32-bit applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'ifc'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -KPIC '\n\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n if cpu.has_fdiv_bug():\n switches = switches + ' -fdiv_check '\n if cpu.has_f00f_bug():\n switches = switches + ' -0f_check '\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -FI -w90 -w95 '\n\n self.f77_opt = self.f90_opt = self.get_opt()\n \n debug = ' -g -C '\n self.f77_debug = self.f90_debug = debug\n\n self.ver_cmd = self.f77_compiler+' -FI -V -c %s -o %s' %\\\n self.dummy_fortran_files()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 '\n if cpu.is_PentiumPro() or cpu.is_PentiumII():\n opt = opt + ' -tpp6 -xi '\n elif cpu.is_PentiumIII():\n opt = opt + ' -tpp6 '\n elif cpu.is_Pentium():\n opt = opt + ' -tpp5 '\n elif cpu.is_PentiumIV():\n opt = opt + ' -tpp7 -xW '\n elif cpu.has_mmx():\n opt = opt + ' -xM '\n return opt\n \n\n def get_linker_so(self):\n return [self.f77_compiler,'-shared']\n\n\nclass intel_itanium_fortran_compiler(intel_ia32_fortran_compiler):\n\n vendor = 'Itanium'\n ver_match = r'Intel\\(R\\) Fortran 90 Compiler Itanium\\(TM\\) Compiler for the Itanium\\(TM\\)-based applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n if fc is None:\n fc = 'efc'\n intel_ia32_fortran_compiler.__init__(self, fc, f90c)\n\n\nclass nag_fortran_compiler(fortran_compiler_base):\n\n vendor = 'NAG'\n ver_match = r'NAGWare Fortran 95 compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'f95'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ''\n debug = ' -g -gline -g90 -nan -C '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -fixed '\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -target=native '\n return opt\n\n def get_linker_so(self):\n return [self.f77_compiler,'-Wl,-shared']\n\n# http://www.fortran.com/F/compilers.html\n#\n# We define F compiler here but it is quite useless\n# because it does not support for fixed format sources\n# which makes it impossible to use with f2py generated\n# fixed format wrappers to F90 modules.\nclass f_fortran_compiler(fortran_compiler_base):\n\n vendor = 'F'\n ver_match = r'Fortran Company/NAG F compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'F'\n if f90c is None:\n f90c = 'F'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n self.ver_cmd = self.f90_compiler+' -V '\n\n gnu = gnu_fortran_compiler('g77')\n if not gnu.is_available(): # F compiler requires gcc.\n self.version = ''\n return\n if not self.is_available():\n return\n\n print red_text(\"\"\"\nWARNING: F compiler is unsupported due to its incompleteness.\n Send complaints to its vendor. For adding its support\n to scipy_distutils, it must be able to compile\n fixed format Fortran 90.\n\"\"\")\n\n self.f90_switches = ''\n self.f90_debug = ' -g -gline -g90 -C '\n self.f90_opt = ' -O '\n\n #self.f77_switches = gnu.f77_switches\n #self.f77_debug = gnu.f77_debug\n #self.f77_opt = gnu.f77_opt\n\n def get_linker_so(self):\n return ['gcc','-shared']\n\nclass vast_fortran_compiler(fortran_compiler_base):\n\n vendor = 'VAST'\n ver_match = r'\\s*Pacific-Sierra Research vf90 (Personal|Professional)\\s+(?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n d,b = os.path.split(f90c)\n vf90 = os.path.join(d,'v'+b)\n self.ver_cmd = vf90+' -v '\n\n gnu = gnu_fortran_compiler(fc)\n if not gnu.is_available(): # VAST compiler requires g77.\n self.version = ''\n return\n if not self.is_available():\n return\n\n self.f77_switches = gnu.f77_switches\n self.f77_debug = gnu.f77_debug\n self.f77_opt = gnu.f77_opt \n\n # XXX: need f90 switches, debug, opt\n\n def get_linker_so(self):\n return [self.f90_compiler,'-shared']\n\nclass compaq_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Compaq'\n ver_match = r'Compaq Fortran (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'fort'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -assume no2underscore -nomixed_str_len_arg '\n debug = ' -g -check_bounds '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n # XXX: uncomment if required\n #self.libraries = ' -lUfor -lfor -lFutil -lcpml -lots -lc '\n\n # XXX: fix the version showing flag\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -align dcommons -arch host -assume bigarrays -assume nozsize -math_library fast -tune host '\n return opt\n\n def get_linker_so(self):\n # XXX: is -shared needed?\n return [self.f77_compiler,'-shared']\n\n\ndef match_extension(files,ext):\n match = re.compile(r'.*[.]('+ext+r')\\Z',re.I).match\n return filter(lambda x,match = match: match(x),files)\n\ndef get_f77_files(files):\n return match_extension(files,'for|f77|ftn|f')\n\ndef get_f90_files(files):\n return match_extension(files,'f90|f95')\n\ndef get_fortran_files(files):\n return match_extension(files,'f90|f95|for|f77|ftn|f')\n\ndef find_fortran_compiler(vendor = None, fc = None, f90c = None):\n fcompiler = None\n for compiler_class in all_compilers:\n if vendor is not None and vendor != compiler_class.vendor:\n continue\n print compiler_class\n compiler = compiler_class(fc,f90c)\n if compiler.is_available():\n fcompiler = compiler\n break\n return fcompiler\n\nall_compilers = [absoft_fortran_compiler,\n mips_fortran_compiler,\n sun_fortran_compiler,\n intel_ia32_fortran_compiler,\n intel_itanium_fortran_compiler,\n nag_fortran_compiler,\n compaq_fortran_compiler,\n vast_fortran_compiler,\n hpux_fortran_compiler,\n f_fortran_compiler,\n gnu_fortran_compiler,\n\n ]\n\nif __name__ == \"__main__\":\n show_compilers()\n", + "source_code_before": "\"\"\" Implements the build_flib command which should go into Distutils\n at some point.\n \n Note:\n Right now, we're dynamically linking to the Fortran libraries on \n some platforms (Sun for sure). This is fine for local installations\n but a bad thing for redistribution because these libraries won't\n live on any machine that doesn't have a fortran compiler installed.\n It is pretty hard (impossible?) to get gcc to pass the right compiler\n flags on Sun to get the linker to use static libs for the fortran\n stuff. Investigate further...\n\nBugs:\n *** Options -e and -x have no effect when used with --help-compiler\n options. E.g. \n ./setup.py build_flib --help-compiler -e g77-3.0\n finds g77-2.95.\n How to extract these options inside the show_compilers function?\n *** compiler.is_available() method may not work correctly on nt\n because of lack of knowledge how to get exit status in\n run_command function. However, it may give reasonable results\n based on a version string.\n *** Some vendors provide different compilers for F77 and F90\n compilations. Currently, checking the availability of these\n compilers is based on only checking the availability of the\n corresponding F77 compiler. If it exists, then F90 is assumed\n to exist also.\n *** F compiler from Fortran Compiler is _not_ supported, though it\n is defined below. The reasons is that this F95 compiler is\n incomplete: it does not compile fixed format sources and\n that is needed by f2py generated wrappers for F90 modules.\n To support F as it is, some effort is needed to re-code\n f2py but it is not clear if this effort is worth.\n May be in future...\n\nOpen issues:\n *** User-defined compiler flags. Do we need --fflags?\n\nFortran compilers (as to be used with --fcompiler= option):\n Absoft\n Sun\n SGI\n Intel\n Itanium\n NAG\n Compaq\n Gnu\n VAST\n F [unsupported]\n\"\"\"\n\nimport distutils\nimport distutils.dep_util, distutils.dir_util\nimport os,sys,string\nimport commands,re\nfrom types import *\nfrom distutils.ccompiler import CCompiler,gen_preprocess_options\nfrom distutils.command.build_clib import build_clib\nfrom distutils.errors import *\n\nclass FortranCompilerError (CCompilerError):\n \"\"\"Some compile/link operation failed.\"\"\"\nclass FortranCompileError (FortranCompilerError):\n \"\"\"Failure to compile one or more Fortran source files.\"\"\"\n\nif os.name == 'nt':\n def run_command(command):\n \"\"\" not sure how to get exit status on nt. \"\"\"\n in_pipe,out_pipe = os.popen4(command)\n in_pipe.close()\n text = out_pipe.read()\n return 0, text\nelse:\n run_command = commands.getstatusoutput\n\n# Hooks for colored terminal output. Could be in a more general use.\n# See also http://www.livinglogic.de/Python/ansistyle\nif os.environ.get('TERM',None) in ['rxvt','xterm']:\n # Need a better way to determine whether a terminal supports colors\n def red_text(s): return '\\x1b[31m%s\\x1b[0m'%s\n def green_text(s): return '\\x1b[32m%s\\x1b[0m'%s\n def yellow_text(s): return '\\x1b[33m%s\\x1b[0m'%s\n def blue_text(s): return '\\x1b[34m%s\\x1b[0m'%s\n def cyan_text(s): return '\\x1b[35m%s\\x1b[0m'%s\nelse:\n def red_text(s): return s\n def green_text(s): return s\n def yellow_text(s): return s\n def cyan_text(s): return s\n def blue_text(s): return s\n\n\ndef show_compilers():\n for compiler_class in all_compilers:\n compiler = compiler_class()\n if compiler.is_available():\n print cyan_text(compiler)\n\nclass build_flib (build_clib):\n\n description = \"build f77/f90 libraries used by Python extensions\"\n\n user_options = [\n ('build-flib', 'b',\n \"directory to build f77/f90 libraries to\"),\n ('build-temp', 't',\n \"directory to put temporary build by-products\"),\n ('debug', 'g',\n \"compile with debugging information\"),\n ('force', 'f',\n \"forcibly build everything (ignore file timestamps)\"),\n ('fcompiler=', 'c',\n \"specify the compiler type\"),\n ('fcompiler-exec=', 'e',\n \"specify the path to F77 compiler\"),\n ('f90compiler-exec=', 'x',\n \"specify the path to F90 compiler\"),\n ]\n\n boolean_options = ['debug', 'force']\n\n help_options = [\n ('help-compiler', None,\n \"list available compilers\", show_compilers),\n ]\n\n def initialize_options (self):\n\n self.build_flib = None\n self.build_temp = None\n\n self.fortran_libraries = None\n self.define = None\n self.undef = None\n self.debug = None\n self.force = 0\n self.fcompiler = None\n self.fcompiler_exec = None\n self.f90compiler_exec = None\n\n # initialize_options()\n\n def finalize_options (self):\n self.set_undefined_options('build',\n ('build_temp', 'build_flib'),\n ('build_temp', 'build_temp'),\n ('debug', 'debug'),\n ('force', 'force'))\n fc = find_fortran_compiler(self.fcompiler,\n self.fcompiler_exec,\n self.f90compiler_exec)\n if not fc:\n raise DistutilsOptionError, 'Fortran compiler not available: %s'%(self.fcompiler)\n else:\n self.announce(cyan_text(' using %s Fortran compiler' % fc))\n self.fcompiler = fc\n if self.has_f_libraries():\n self.fortran_libraries = self.distribution.fortran_libraries\n self.check_library_list(self.fortran_libraries)\n \n # finalize_options()\n\n def has_f_libraries(self):\n return self.distribution.fortran_libraries \\\n and len(self.distribution.fortran_libraries) > 0\n\n def run (self):\n if not self.has_f_libraries():\n return\n self.build_libraries(self.fortran_libraries)\n\n # run ()\n\n def has_f_library(self,name):\n if self.has_f_libraries():\n # If self.fortran_libraries is None at this point\n # then it means that build_flib was called before\n # build. Always call build before build_flib.\n for (lib_name, build_info) in self.fortran_libraries:\n if lib_name == name:\n return 1\n \n def get_library_names(self, name=None):\n if not self.has_f_libraries():\n return None\n\n lib_names = []\n\n if name is None:\n for (lib_name, build_info) in self.fortran_libraries:\n lib_names.append(lib_name)\n\n if self.fcompiler is not None:\n lib_names.extend(self.fcompiler.get_libraries())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n for n in build_info.get('libraries',[]):\n lib_names.append(n)\n #XXX: how to catch recursive calls here?\n lib_names.extend(self.get_library_names(n))\n break\n return lib_names\n\n def get_fcompiler_library_names(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_libraries()\n return []\n\n def get_fcompiler_library_dirs(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_library_dirs()\n return []\n\n # get_library_names ()\n\n def get_library_dirs(self, name=None):\n if not self.has_f_libraries():\n return []\n\n lib_dirs = [] \n\n if name is None:\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_library_dirs())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n lib_dirs.extend(build_info.get('library_dirs',[]))\n for n in build_info.get('libraries',[]):\n lib_dirs.extend(self.get_library_dirs(n))\n break\n\n return lib_dirs\n\n # get_library_dirs ()\n\n def get_runtime_library_dirs(self):\n #if not self.has_f_libraries():\n # return []\n\n lib_dirs = []\n\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_runtime_library_dirs())\n \n return lib_dirs\n\n # get_library_dirs ()\n\n def get_source_files (self):\n if not self.has_f_libraries():\n return []\n\n self.check_library_list(self.fortran_libraries)\n filenames = []\n\n # Gets source files specified \n for ext in self.fortran_libraries:\n filenames.extend(ext[1]['sources'])\n\n return filenames \n \n def build_libraries (self, fortran_libraries):\n \n fcompiler = self.fcompiler\n \n for (lib_name, build_info) in fortran_libraries:\n self.announce(\" building '%s' library\" % lib_name)\n\n sources = build_info.get('sources')\n if sources is None or type(sources) not in (ListType, TupleType):\n raise DistutilsSetupError, \\\n (\"in 'fortran_libraries' option (library '%s'), \" +\n \"'sources' must be present and must be \" +\n \"a list of source filenames\") % lib_name\n sources = list(sources)\n module_dirs = build_info.get('module_dirs')\n module_files = build_info.get('module_files')\n\n\n include_dirs = build_info.get('include_dirs')\n\n if include_dirs:\n fcompiler.set_include_dirs(include_dirs)\n for n,v in build_info.get('define_macros') or []:\n fcompiler.define_macro(n,v)\n for n in build_info.get('undef_macros') or []:\n fcompiler.undefine_macro(n)\n\n if module_files:\n fcompiler.build_library(lib_name, module_files,\n temp_dir=self.build_temp)\n \n fcompiler.build_library(lib_name, sources,\n module_dirs, temp_dir=self.build_temp)\n\n # for loop\n\n # build_libraries ()\n\nclass fortran_compiler_base(CCompiler):\n\n vendor = None\n ver_match = None\n\n compiler_type = 'fortran'\n executables = {}\n \n def __init__(self,verbose=0,dry_run=0,force=0):\n # Default initialization. Constructors of derived classes MUST\n # call this function.\n CCompiler.__init__(self,verbose,dry_run,force)\n\n self.version = None\n \n self.f77_switches = ''\n self.f77_opt = ''\n self.f77_debug = ''\n \n self.f90_switches = ''\n self.f90_opt = ''\n self.f90_debug = ''\n \n #self.libraries = []\n #self.library_dirs = []\n\n if self.vendor is None:\n raise DistutilsInternalError,\\\n '%s must define vendor attribute'%(self.__class__)\n if self.ver_match is None:\n raise DistutilsInternalError,\\\n '%s must define ver_match attribute'%(self.__class__)\n\n def to_object(self,\n dirty_files,\n module_dirs=None,\n temp_dir=''):\n files = string.join(dirty_files)\n f90_files = get_f90_files(dirty_files)\n f77_files = get_f77_files(dirty_files)\n if f90_files != []:\n obj1 = self.f90_compile(f90_files,module_dirs,temp_dir = temp_dir)\n else:\n obj1 = []\n if f77_files != []:\n obj2 = self.f77_compile(f77_files, temp_dir = temp_dir)\n else:\n obj2 = []\n return obj1 + obj2\n\n def source_to_object_names(self,source_files, temp_dir=''):\n file_list = map(lambda x: os.path.basename(x),source_files)\n file_base_ext = map(lambda x: os.path.splitext(x),file_list)\n object_list = map(lambda x: x[0] +'.o',file_base_ext)\n object_files = map(lambda x,td=temp_dir: os.path.join(td,x),object_list)\n return object_files\n \n def source_and_object_pairs(self,source_files, temp_dir=''):\n object_files = self.source_to_object_names(source_files,temp_dir)\n file_pairs = zip(source_files,object_files)\n return file_pairs\n \n def f_compile(self,compiler,switches, source_files,\n module_dirs=None, temp_dir=''):\n\n pp_opts = gen_preprocess_options(self.macros,self.include_dirs)\n\n switches = switches + ' ' + string.join(pp_opts,' ')\n\n module_switch = self.build_module_switch(module_dirs)\n file_pairs = self.source_and_object_pairs(source_files,temp_dir)\n object_files = []\n for source,object in file_pairs:\n if distutils.dep_util.newer(source,object):\n cmd = compiler + ' ' + switches + ' '+\\\n module_switch + \\\n ' -c ' + source + ' -o ' + object \n print yellow_text(cmd)\n failure = os.system(cmd)\n if failure:\n raise FortranCompileError, 'failure during compile' \n object_files.append(object)\n return object_files\n #return all object files to make sure everything is archived \n #return map(lambda x: x[1], file_pairs)\n\n def f90_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f90_switches, self.f90_opt))\n return self.f_compile(self.f90_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n def f77_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f77_switches, self.f77_opt))\n return self.f_compile(self.f77_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n\n def build_module_switch(self, module_dirs):\n return ''\n\n def create_static_lib(self, object_files, library_name,\n output_dir='', debug=None):\n lib_file = os.path.join(output_dir,'lib'+library_name+'.a')\n newer = distutils.dep_util.newer\n # This doesn't work -- no way to know if the file is in the archive\n #object_files = filter(lambda o,lib=lib_file:\\\n # distutils.dep_util.newer(o,lib),object_files)\n objects = string.join(object_files)\n if objects:\n cmd = 'ar -cur %s %s' % (lib_file,objects)\n print yellow_text(cmd)\n os.system(cmd)\n cmd = 'ranlib %s ' % lib_file\n print yellow_text(cmd)\n os.system(cmd)\n\n def build_library(self,library_name,source_list,module_dirs=None,\n temp_dir = ''):\n #make sure the temp directory exists before trying to build files\n import distutils.dir_util\n distutils.dir_util.mkpath(temp_dir)\n\n #this compiles the files\n object_list = self.to_object(source_list,\n module_dirs,\n temp_dir)\n\n # actually we need to use all the object file names here to\n # make sure the library is always built. It could occur that an\n # object file exists but hasn't been put in the archive. (happens\n # a lot when builds fail once and are restarted).\n object_list = self.source_to_object_names(source_list, temp_dir)\n\n if os.name == 'nt':\n # This is pure bunk...\n # Windows fails for long argument strings on the command line.\n # if objects is real long (> 2048 chars or so on my machine),\n # the command fails (cmd.exe /e:2048 on w2k)\n # for now we'll split linking into to steps which should work for\n objects = object_list[:]\n while objects:\n obj,objects = objects[:20],objects[20:]\n self.create_static_lib(obj,library_name,temp_dir)\n else:\n self.create_static_lib(object_list,library_name,temp_dir)\n\n def dummy_fortran_files(self):\n import tempfile \n d = tempfile.gettempdir()\n dummy_name = os.path.join(d,'__dummy.f')\n dummy = open(dummy_name,'w')\n dummy.write(\" subroutine dummy()\\n end\\n\")\n dummy.close()\n return (os.path.join(d,'__dummy.f'),os.path.join(d,'__dummy.o'))\n \n def is_available(self):\n return self.get_version()\n \n def get_version(self):\n \"\"\"Return the compiler version. If compiler is not available,\n return empty string.\"\"\"\n # XXX: Is there compilers that have no version? If yes,\n # this test will fail even if the compiler is available.\n if self.version is not None:\n # Finding version is expensive, so return previously found\n # version string.\n return self.version\n self.version = ''\n # works I think only for unix... \n print 'command:', yellow_text(self.ver_cmd)\n exit_status, out_text = run_command(self.ver_cmd)\n print exit_status,\n if not exit_status:\n print green_text(out_text)\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n else:\n print red_text(out_text)\n return self.version\n\n def get_libraries(self):\n return self.libraries\n def get_library_dirs(self):\n return self.library_dirs\n def get_extra_link_args(self):\n return []\n def get_runtime_library_dirs(self):\n return []\n def get_linker_so(self):\n \"\"\"\n If a compiler requires specific linker then return a list\n containing a linker executable name and linker options.\n Otherwise, return None.\n \"\"\"\n\n def __str__(self):\n return \"%s %s\" % (self.vendor, self.get_version())\n\n\nclass absoft_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Absoft'\n ver_match = r'FORTRAN 77 Compiler (?P[^\\s*,]*).*?Absoft Corp'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n # got rid of -B108 cause it was generating 2 underscores instead\n # of one on the newest version. Now we use -YEXT_SFX=_ to \n # specify the output format\n if os.name == 'nt':\n self.f90_switches = '-f fixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -Q100'\n self.f77_switches = '-N22 -N90 -N110'\n self.f77_opt = '-O -Q100'\n self.libraries = ['fio', 'fmath', 'f90math', 'COMDLG32']\n else:\n self.f90_switches = '-ffixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -B101' \n self.f77_switches = '-N22 -N90 -N110 -B108'\n self.f77_opt = '-O -B101'\n\n self.libraries = ['fio', 'f77math', 'f90math']\n \n try:\n dir = os.environ['ABSOFT'] \n self.library_dirs = [os.path.join(dir,'lib')]\n except KeyError:\n self.library_dirs = []\n\n self.ver_cmd = self.f77_compiler + ' -V -c %s -o %s' % \\\n self.dummy_fortran_files()\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -p' + mod\n return res\n\n def get_extra_link_args(self):\n return []\n # Couldn't get this to link for anything using gcc.\n #dr = \"c:\\\\Absoft62\\\\lib\"\n #libs = ['fio.lib', 'COMDLG32.lib','fmath.lib', 'f90math.lib','libcomdlg32.a' ] \n #libs = map(lambda x,dr=dr:os.path.join(dr,x),libs)\n #return libs\n\n\nclass sun_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Sun'\n #ver_match = r'f77: (?P[^\\s*,]*)'\n ver_match = r'f90: Sun (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -pic '\n self.f77_opt = ' -fast -dalign '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -fixed ' # ??? why fixed?\n self.f90_opt = ' -fast -dalign '\n\n self.ver_cmd = self.f90_compiler + ' -V'\n\n #self.libraries = ['f90', 'F77', 'M77', 'sunmath', 'm']\n self.libraries = ['fsu', 'F77', 'M77', 'sunmath', 'm']\n \n #threaded\n #self.libraries = ['f90', 'F77_mt', 'sunmath_mt', 'm', 'thread']\n #self.libraries = []\n self.library_dirs = self.find_lib_dir()\n #print 'sun:',self.library_dirs\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -M' + mod\n return res\n\n def find_lib_dir(self):\n library_dirs = []\n lib_match = r'### f90: Note: LD_RUN_PATH\\s*= '\\\n '(?P[^\\s.]*).*'\n cmd = self.f90_compiler + ' -dryrun dummy.f'\n exit_status, output = run_command(cmd)\n if not exit_status:\n libs = re.findall(lib_match,output)\n if libs:\n library_dirs = string.split(libs[0],':')\n self.get_version() # force version calculation\n compiler_home = os.path.dirname(library_dirs[0])\n library_dirs.append(os.path.join(compiler_home,\n self.version,'lib'))\n return library_dirs\n def get_runtime_library_dirs(self):\n return self.find_lib_dir()\n def get_extra_link_args(self):\n return ['-mimpure-text']\n\n\nclass mips_fortran_compiler(fortran_compiler_base):\n\n vendor = 'SGI'\n ver_match = r'MIPSpro Compilers: Version (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -n32 -KPIC '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -n32 -KPIC -fixedform ' # why fixed ???\n self.f90_opt = ' ' \n\n self.ver_cmd = self.f77_compiler + ' -version'\n \n self.libraries = ['fortran', 'ftn', 'm']\n self.library_dirs = self.find_lib_dir()\n\n\n def build_module_switch(self,module_dirs):\n res = ''\n return res \n def find_lib_dir(self):\n library_dirs = []\n return library_dirs\n def get_runtime_library_dirs(self):\n\treturn self.find_lib_dir() \n def get_extra_link_args(self):\n\treturn []\n\n\nclass gnu_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Gnu'\n #ver_match = r'g77 version (?P[^\\s*]*)'\n ver_match = r'GNU Fortran (?P[^\\s*]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if sys.platform == 'win32':\n self.libraries = ['gcc','g2c']\n self.library_dirs = self.find_lib_directories()\n else:\n # On linux g77 does not need lib_directories to be specified.\n self.libraries = ['g2c']\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n\n switches = ' -Wall -fno-second-underscore '\n\n if os.name != 'nt':\n switches = switches + ' -fpic '\n\n self.f77_switches = switches\n #self.ver_cmd = self.f77_compiler + ' -v '\n self.ver_cmd = self.f77_compiler + ' --version'\n\n self.f77_opt = self.get_opt()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 -funroll-loops '\n \n # only check for more optimization if g77 can handle\n # it.\n if self.get_version():\n if self.version[0]=='3': # is g77 3.x.x\n if cpu.is_AthlonK6():\n opt = opt + ' -march=k6 '\n elif cpu.is_AthlonK7():\n opt = opt + ' -march=athlon '\n if cpu.is_i686():\n opt = opt + ' -march=i686 '\n elif cpu.is_i586():\n opt = opt + ' -march=i586 '\n elif cpu.is_i486():\n opt = opt + ' -march=i486 '\n elif cpu.is_i386():\n opt = opt + ' -march=i386 '\n if cpu.is_Intel():\n opt = opt + ' -malign-double ' \n return opt\n \n def find_lib_directories(self):\n lib_dir = []\n match = r'Reading specs from (.*)/specs'\n\n # works I think only for unix... \n exit_status, out_text = run_command('g77 -v')\n if not exit_status:\n m = re.findall(match,out_text)\n if m:\n lib_dir= m #m[0] \n return lib_dir\n\n def get_linker_so(self):\n # win32 linking should be handled by standard linker\n if sys.platform != 'win32' and os.uname()[0] != 'Darwin':\n return [self.f77_compiler,'-shared']\n \n def f90_compile(self,source_files,module_files,temp_dir=''):\n raise DistutilsExecError, 'f90 not supported by Gnu'\n\n\n#http://developer.intel.com/software/products/compilers/f50/linux/\nclass intel_ia32_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Intel' # Intel(R) Corporation \n ver_match = r'Intel\\(R\\) Fortran Compiler for 32-bit applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'ifc'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -KPIC '\n\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n if cpu.has_fdiv_bug():\n switches = switches + ' -fdiv_check '\n if cpu.has_f00f_bug():\n switches = switches + ' -0f_check '\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -FI -w90 -w95 '\n\n self.f77_opt = self.f90_opt = self.get_opt()\n \n debug = ' -g -C '\n self.f77_debug = self.f90_debug = debug\n\n self.ver_cmd = self.f77_compiler+' -FI -V -c %s -o %s' %\\\n self.dummy_fortran_files()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 '\n if cpu.is_PentiumPro() or cpu.is_PentiumII():\n opt = opt + ' -tpp6 -xi '\n elif cpu.is_PentiumIII():\n opt = opt + ' -tpp6 '\n elif cpu.is_Pentium():\n opt = opt + ' -tpp5 '\n elif cpu.is_PentiumIV():\n opt = opt + ' -tpp7 -xW '\n elif cpu.has_mmx():\n opt = opt + ' -xM '\n return opt\n \n\n def get_linker_so(self):\n return [self.f77_compiler,'-shared']\n\n\nclass intel_itanium_fortran_compiler(intel_ia32_fortran_compiler):\n\n vendor = 'Itanium'\n ver_match = r'Intel\\(R\\) Fortran 90 Compiler Itanium\\(TM\\) Compiler for the Itanium\\(TM\\)-based applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n if fc is None:\n fc = 'efc'\n intel_ia32_fortran_compiler.__init__(self, fc, f90c)\n\n\nclass nag_fortran_compiler(fortran_compiler_base):\n\n vendor = 'NAG'\n ver_match = r'NAGWare Fortran 95 compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'f95'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ''\n debug = ' -g -gline -g90 -nan -C '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -fixed '\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -target=native '\n return opt\n\n def get_linker_so(self):\n return [self.f77_compiler,'-Wl,-shared']\n\n# http://www.fortran.com/F/compilers.html\n#\n# We define F compiler here but it is quite useless\n# because it does not support for fixed format sources\n# which makes it impossible to use with f2py generated\n# fixed format wrappers to F90 modules.\nclass f_fortran_compiler(fortran_compiler_base):\n\n vendor = 'F'\n ver_match = r'Fortran Company/NAG F compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'F'\n if f90c is None:\n f90c = 'F'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n self.ver_cmd = self.f90_compiler+' -V '\n\n gnu = gnu_fortran_compiler('g77')\n if not gnu.is_available(): # F compiler requires gcc.\n self.version = ''\n return\n if not self.is_available():\n return\n\n print red_text(\"\"\"\nWARNING: F compiler is unsupported due to its incompleteness.\n Send complaints to its vendor. For adding its support\n to scipy_distutils, it must be able to compile\n fixed format Fortran 90.\n\"\"\")\n\n self.f90_switches = ''\n self.f90_debug = ' -g -gline -g90 -C '\n self.f90_opt = ' -O '\n\n #self.f77_switches = gnu.f77_switches\n #self.f77_debug = gnu.f77_debug\n #self.f77_opt = gnu.f77_opt\n\n def get_linker_so(self):\n return ['gcc','-shared']\n\nclass vast_fortran_compiler(fortran_compiler_base):\n\n vendor = 'VAST'\n ver_match = r'\\s*Pacific-Sierra Research vf90 (Personal|Professional)\\s+(?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n d,b = os.path.split(f90c)\n vf90 = os.path.join(d,'v'+b)\n self.ver_cmd = vf90+' -v '\n\n gnu = gnu_fortran_compiler(fc)\n if not gnu.is_available(): # VAST compiler requires g77.\n self.version = ''\n return\n if not self.is_available():\n return\n\n self.f77_switches = gnu.f77_switches\n self.f77_debug = gnu.f77_debug\n self.f77_opt = gnu.f77_opt \n\n # XXX: need f90 switches, debug, opt\n\n def get_linker_so(self):\n return [self.f90_compiler,'-shared']\n\nclass compaq_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Compaq'\n ver_match = r'Compaq Fortran (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'fort'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -assume no2underscore -nomixed_str_len_arg '\n debug = ' -g -check_bounds '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n # XXX: uncomment if required\n #self.libraries = ' -lUfor -lfor -lFutil -lcpml -lots -lc '\n\n # XXX: fix the version showing flag\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -align dcommons -arch host -assume bigarrays -assume nozsize -math_library fast -tune host '\n return opt\n\n def get_linker_so(self):\n # XXX: is -shared needed?\n return [self.f77_compiler,'-shared']\n\n\ndef match_extension(files,ext):\n match = re.compile(r'.*[.]('+ext+r')\\Z',re.I).match\n return filter(lambda x,match = match: match(x),files)\n\ndef get_f77_files(files):\n return match_extension(files,'for|f77|ftn|f')\n\ndef get_f90_files(files):\n return match_extension(files,'f90|f95')\n\ndef get_fortran_files(files):\n return match_extension(files,'f90|f95|for|f77|ftn|f')\n\ndef find_fortran_compiler(vendor = None, fc = None, f90c = None):\n fcompiler = None\n for compiler_class in all_compilers:\n if vendor is not None and vendor != compiler_class.vendor:\n continue\n print compiler_class\n compiler = compiler_class(fc,f90c)\n if compiler.is_available():\n fcompiler = compiler\n break\n return fcompiler\n\nall_compilers = [absoft_fortran_compiler,\n mips_fortran_compiler,\n sun_fortran_compiler,\n intel_ia32_fortran_compiler,\n intel_itanium_fortran_compiler,\n nag_fortran_compiler,\n compaq_fortran_compiler,\n vast_fortran_compiler,\n f_fortran_compiler,\n gnu_fortran_compiler,\n ]\n\nif __name__ == \"__main__\":\n show_compilers()\n", + "methods": [ + { + "name": "run_command", + "long_name": "run_command( command )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 1, + "token_count": 32, + "parameters": [ + "command" + ], + "start_line": 67, + "end_line": 72, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "show_compilers", + "long_name": "show_compilers( )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 3, + "token_count": 26, + "parameters": [], + "start_line": 93, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "initialize_options", + "long_name": "initialize_options( self )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 1, + "token_count": 55, + "parameters": [ + "self" + ], + "start_line": 127, + "end_line": 139, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "finalize_options", + "long_name": "finalize_options( self )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 3, + "token_count": 107, + "parameters": [ + "self" + ], + "start_line": 143, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "has_f_libraries", + "long_name": "has_f_libraries( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 163, + "end_line": 165, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "run", + "long_name": "run( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 167, + "end_line": 170, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "has_f_library", + "long_name": "has_f_library( self , name )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 32, + "parameters": [ + "self", + "name" + ], + "start_line": 174, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "get_library_names", + "long_name": "get_library_names( self , name = None )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 8, + "token_count": 117, + "parameters": [ + "self", + "name" + ], + "start_line": 183, + "end_line": 203, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_names", + "long_name": "get_fcompiler_library_names( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 205, + "end_line": 210, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_dirs", + "long_name": "get_fcompiler_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 212, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self , name = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 109, + "parameters": [ + "self", + "name" + ], + "start_line": 221, + "end_line": 238, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 242, + "end_line": 251, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "get_source_files", + "long_name": "get_source_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 266, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "build_libraries", + "long_name": "build_libraries( self , fortran_libraries )", + "filename": "build_flib.py", + "nloc": 25, + "complexity": 10, + "token_count": 181, + "parameters": [ + "self", + "fortran_libraries" + ], + "start_line": 268, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 33, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , verbose = 0 , dry_run = 0 , force = 0 )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "verbose", + "dry_run", + "force" + ], + "start_line": 314, + "end_line": 337, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "to_object", + "long_name": "to_object( self , dirty_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 16, + "complexity": 3, + "token_count": 89, + "parameters": [ + "self", + "dirty_files", + "module_dirs", + "temp_dir" + ], + "start_line": 339, + "end_line": 354, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "source_to_object_names", + "long_name": "source_to_object_names( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 1, + "token_count": 89, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 356, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "source_and_object_pairs", + "long_name": "source_and_object_pairs( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 363, + "end_line": 366, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f_compile", + "long_name": "f_compile( self , compiler , switches , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 4, + "token_count": 135, + "parameters": [ + "self", + "compiler", + "switches", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 368, + "end_line": 388, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 392, + "end_line": 395, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f77_compile", + "long_name": "f77_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 397, + "end_line": 400, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 403, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "create_static_lib", + "long_name": "create_static_lib( self , object_files , library_name , output_dir = '' , debug = None )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 2, + "token_count": 87, + "parameters": [ + "self", + "object_files", + "library_name", + "output_dir", + "debug" + ], + "start_line": 406, + "end_line": 420, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "build_library", + "long_name": "build_library( self , library_name , source_list , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self", + "library_name", + "source_list", + "module_dirs", + "temp_dir" + ], + "start_line": 422, + "end_line": 450, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "dummy_fortran_files", + "long_name": "dummy_fortran_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 1, + "token_count": 69, + "parameters": [ + "self" + ], + "start_line": 452, + "end_line": 459, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "is_available", + "long_name": "is_available( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 461, + "end_line": 462, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 4, + "token_count": 90, + "parameters": [ + "self" + ], + "start_line": 464, + "end_line": 485, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 1 + }, + { + "name": "get_libraries", + "long_name": "get_libraries( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 487, + "end_line": 488, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 489, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 491, + "end_line": 492, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 493, + "end_line": 494, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 1, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 495, + "end_line": 500, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 502, + "end_line": 503, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 31, + "complexity": 5, + "token_count": 177, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 511, + "end_line": 549, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 39, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 551, + "end_line": 556, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 558, + "end_line": 559, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 98, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 573, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 599, + "end_line": 604, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 99, + "parameters": [ + "self" + ], + "start_line": 606, + "end_line": 620, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 621, + "end_line": 622, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 623, + "end_line": 624, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 94, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 632, + "end_line": 650, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 653, + "end_line": 655, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 656, + "end_line": 658, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 659, + "end_line": 660, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 661, + "end_line": 662, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 87, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 669, + "end_line": 687, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 4, + "token_count": 94, + "parameters": [ + "self" + ], + "start_line": 689, + "end_line": 706, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 714, + "end_line": 739, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 21, + "complexity": 10, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 741, + "end_line": 764, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "find_lib_directories", + "long_name": "find_lib_directories( self )", + "filename": "build_flib.py", + "nloc": 9, + "complexity": 3, + "token_count": 43, + "parameters": [ + "self" + ], + "start_line": 766, + "end_line": 776, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 3, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 778, + "end_line": 781, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "source_files", + "module_files", + "temp_dir" + ], + "start_line": 783, + "end_line": 784, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 22, + "complexity": 5, + "token_count": 140, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 793, + "end_line": 821, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 85, + "parameters": [ + "self" + ], + "start_line": 823, + "end_line": 837, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 840, + "end_line": 841, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 849, + "end_line": 852, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 860, + "end_line": 879, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 881, + "end_line": 883, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 885, + "end_line": 886, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 24, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 899, + "end_line": 927, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 933, + "end_line": 934, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 20, + "complexity": 5, + "token_count": 128, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 941, + "end_line": 965, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 969, + "end_line": 970, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 14, + "complexity": 3, + "token_count": 91, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 977, + "end_line": 999, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 1001, + "end_line": 1003, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 1005, + "end_line": 1007, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "match_extension", + "long_name": "match_extension( files , ext )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 44, + "parameters": [ + "files", + "ext" + ], + "start_line": 1010, + "end_line": 1012, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "get_f77_files", + "long_name": "get_f77_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 1014, + "end_line": 1015, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_f90_files", + "long_name": "get_f90_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 1017, + "end_line": 1018, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_fortran_files", + "long_name": "get_fortran_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 1020, + "end_line": 1021, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "find_fortran_compiler", + "long_name": "find_fortran_compiler( vendor = None , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 5, + "token_count": 59, + "parameters": [ + "vendor", + "fc", + "f90c" + ], + "start_line": 1023, + "end_line": 1033, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "run_command", + "long_name": "run_command( command )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 1, + "token_count": 32, + "parameters": [ + "command" + ], + "start_line": 67, + "end_line": 72, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "show_compilers", + "long_name": "show_compilers( )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 3, + "token_count": 26, + "parameters": [], + "start_line": 93, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "initialize_options", + "long_name": "initialize_options( self )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 1, + "token_count": 55, + "parameters": [ + "self" + ], + "start_line": 127, + "end_line": 139, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "finalize_options", + "long_name": "finalize_options( self )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 3, + "token_count": 107, + "parameters": [ + "self" + ], + "start_line": 143, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "has_f_libraries", + "long_name": "has_f_libraries( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 163, + "end_line": 165, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "run", + "long_name": "run( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 167, + "end_line": 170, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "has_f_library", + "long_name": "has_f_library( self , name )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 32, + "parameters": [ + "self", + "name" + ], + "start_line": 174, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "get_library_names", + "long_name": "get_library_names( self , name = None )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 8, + "token_count": 117, + "parameters": [ + "self", + "name" + ], + "start_line": 183, + "end_line": 203, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_names", + "long_name": "get_fcompiler_library_names( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 205, + "end_line": 210, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_dirs", + "long_name": "get_fcompiler_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 212, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self , name = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 109, + "parameters": [ + "self", + "name" + ], + "start_line": 221, + "end_line": 238, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 242, + "end_line": 251, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "get_source_files", + "long_name": "get_source_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 266, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "build_libraries", + "long_name": "build_libraries( self , fortran_libraries )", + "filename": "build_flib.py", + "nloc": 25, + "complexity": 10, + "token_count": 181, + "parameters": [ + "self", + "fortran_libraries" + ], + "start_line": 268, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 33, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , verbose = 0 , dry_run = 0 , force = 0 )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "verbose", + "dry_run", + "force" + ], + "start_line": 314, + "end_line": 337, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "to_object", + "long_name": "to_object( self , dirty_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 16, + "complexity": 3, + "token_count": 89, + "parameters": [ + "self", + "dirty_files", + "module_dirs", + "temp_dir" + ], + "start_line": 339, + "end_line": 354, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "source_to_object_names", + "long_name": "source_to_object_names( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 1, + "token_count": 89, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 356, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "source_and_object_pairs", + "long_name": "source_and_object_pairs( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 363, + "end_line": 366, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f_compile", + "long_name": "f_compile( self , compiler , switches , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 4, + "token_count": 135, + "parameters": [ + "self", + "compiler", + "switches", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 368, + "end_line": 388, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 392, + "end_line": 395, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f77_compile", + "long_name": "f77_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 397, + "end_line": 400, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 403, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "create_static_lib", + "long_name": "create_static_lib( self , object_files , library_name , output_dir = '' , debug = None )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 2, + "token_count": 87, + "parameters": [ + "self", + "object_files", + "library_name", + "output_dir", + "debug" + ], + "start_line": 406, + "end_line": 420, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "build_library", + "long_name": "build_library( self , library_name , source_list , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self", + "library_name", + "source_list", + "module_dirs", + "temp_dir" + ], + "start_line": 422, + "end_line": 450, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "dummy_fortran_files", + "long_name": "dummy_fortran_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 1, + "token_count": 69, + "parameters": [ + "self" + ], + "start_line": 452, + "end_line": 459, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "is_available", + "long_name": "is_available( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 461, + "end_line": 462, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 4, + "token_count": 90, + "parameters": [ + "self" + ], + "start_line": 464, + "end_line": 485, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 1 + }, + { + "name": "get_libraries", + "long_name": "get_libraries( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 487, + "end_line": 488, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 489, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 491, + "end_line": 492, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 493, + "end_line": 494, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 1, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 495, + "end_line": 500, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 502, + "end_line": 503, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 31, + "complexity": 5, + "token_count": 177, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 511, + "end_line": 549, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 39, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 551, + "end_line": 556, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 558, + "end_line": 559, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 98, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 573, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 599, + "end_line": 604, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 99, + "parameters": [ + "self" + ], + "start_line": 606, + "end_line": 620, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 621, + "end_line": 622, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 623, + "end_line": 624, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 94, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 632, + "end_line": 650, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 653, + "end_line": 655, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 656, + "end_line": 658, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 659, + "end_line": 660, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 661, + "end_line": 662, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 671, + "end_line": 696, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 21, + "complexity": 10, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 698, + "end_line": 721, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "find_lib_directories", + "long_name": "find_lib_directories( self )", + "filename": "build_flib.py", + "nloc": 9, + "complexity": 3, + "token_count": 43, + "parameters": [ + "self" + ], + "start_line": 723, + "end_line": 733, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 3, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 735, + "end_line": 738, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "source_files", + "module_files", + "temp_dir" + ], + "start_line": 740, + "end_line": 741, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 22, + "complexity": 5, + "token_count": 140, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 750, + "end_line": 778, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 85, + "parameters": [ + "self" + ], + "start_line": 780, + "end_line": 794, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 797, + "end_line": 798, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 806, + "end_line": 809, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 817, + "end_line": 836, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 838, + "end_line": 840, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 842, + "end_line": 843, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 24, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 856, + "end_line": 884, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 890, + "end_line": 891, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 20, + "complexity": 5, + "token_count": 128, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 898, + "end_line": 922, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 926, + "end_line": 927, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 14, + "complexity": 3, + "token_count": 91, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 934, + "end_line": 956, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 958, + "end_line": 960, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 962, + "end_line": 964, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "match_extension", + "long_name": "match_extension( files , ext )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 44, + "parameters": [ + "files", + "ext" + ], + "start_line": 967, + "end_line": 969, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "get_f77_files", + "long_name": "get_f77_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 971, + "end_line": 972, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_f90_files", + "long_name": "get_f90_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 974, + "end_line": 975, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_fortran_files", + "long_name": "get_fortran_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 977, + "end_line": 978, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "find_fortran_compiler", + "long_name": "find_fortran_compiler( vendor = None , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 5, + "token_count": 59, + "parameters": [ + "vendor", + "fc", + "f90c" + ], + "start_line": 980, + "end_line": 990, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + } + ], + "changed_methods": [ + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 4, + "token_count": 94, + "parameters": [ + "self" + ], + "start_line": 689, + "end_line": 706, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 87, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 669, + "end_line": 687, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + } + ], + "nloc": 749, + "complexity": 184, + "token_count": 4340, + "diff_parsed": { + "added": [ + "class hpux_fortran_compiler(fortran_compiler_base):", + "", + " vendor = 'HP'", + " ver_match = r'HP F90 (?P[^\\s*,]*)'", + "", + " def __init__(self, fc = None, f90c = None):", + " fortran_compiler_base.__init__(self)", + " if fc is None:", + " fc = 'f90'", + " if f90c is None:", + " f90c = 'f90'", + "", + " self.f77_compiler = fc", + " self.f77_switches = ' +pic=long '", + " self.f77_opt = ' -O3 '", + "", + " self.f90_compiler = f90c", + " self.f90_switches = ' +pic=long '", + " self.f90_opt = ' -O3 '", + "", + " self.ver_cmd = self.f77_compiler + ' +version '", + "", + " self.libraries = ['m']", + " self.library_dirs = []", + "", + " def get_version(self):", + " if self.version is not None:", + " return self.version", + " self.version = ''", + " print 'command:', yellow_text(self.ver_cmd)", + " exit_status, out_text = run_command(self.ver_cmd)", + " print exit_status,", + " if exit_status in [0,256]:", + " # 256 seems to indicate success on HP-UX but keeping", + " # also 0. Or does 0 exit status mean something different", + " # in this platform?", + " print green_text(out_text)", + " m = re.match(self.ver_match,out_text)", + " if m:", + " self.version = m.group('version')", + " else:", + " print red_text(out_text)", + " return self.version", + " hpux_fortran_compiler,", + "" + ], + "deleted": [] + } + } + ] + }, + { + "hash": "3817c8dfefb7ffbf96ce6ebb90f70b65805e71a3", + "msg": "Made changes to allow SciPy to build correctly under cygwin", + "author": { + "name": "dmorrill", + "email": "dmorrill@localhost" + }, + "committer": { + "name": "dmorrill", + "email": "dmorrill@localhost" + }, + "author_date": "2002-05-10T18:30:42+00:00", + "author_timezone": 0, + "committer_date": "2002-05-10T18:30:42+00:00", + "committer_timezone": 0, + "branches": [ + "main" + ], + "in_main_branch": true, + "merge": false, + "parents": [ + "4a7ef6921cea42d182fa29c54a3d71998d407826" + ], + "project_name": "repo_copy", + "project_path": "/tmp/tmpvtrgvt0m/repo_copy", + "deletions": 12, + "insertions": 14, + "lines": 26, + "files": 3, + "dmm_unit_size": 0.6666666666666666, + "dmm_unit_complexity": 0.6666666666666666, + "dmm_unit_interfacing": 1.0, + "modified_files": [ + { + "old_path": "scipy_distutils/command/build_ext.py", + "new_path": "scipy_distutils/command/build_ext.py", + "filename": "build_ext.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -66,8 +66,8 @@ def build_extension(self, ext):\n l = build_flib.get_fcompiler_library_names()\n #l = self.compiler.libraries + l\n self.compiler.libraries = l\n- l = build_flib.get_fcompiler_library_dirs()\n- #l = self.compiler.library_dirs + l\n+ l = ( self.compiler.library_dirs +\n+ build_flib.get_fcompiler_library_dirs() )\n self.compiler.library_dirs = l\n else:\n libs = build_flib.get_fcompiler_library_names()\n", + "added_lines": 2, + "deleted_lines": 2, + "source_code": "\"\"\" Modified version of build_ext that handles fortran source files.\n\"\"\"\n\nimport os, string\nfrom types import *\n\nfrom distutils.dep_util import newer_group, newer\nfrom distutils.command.build_ext import build_ext as old_build_ext\n\nfrom scipy_distutils.command.build_clib import get_headers,get_directories\n\nclass build_ext (old_build_ext):\n\n def build_extension(self, ext):\n #XXX: anything else we need to save?\n save_linker_so = self.compiler.linker_so\n save_compiler_libs = self.compiler.libraries\n save_compiler_libs_dirs = self.compiler.library_dirs\n \n # support for building static fortran libraries\n need_f_libs = 0\n need_f_opts = getattr(ext,'need_fcompiler_opts',0)\n ext_name = string.split(ext.name,'.')[-1]\n\n if self.distribution.has_f_libraries():\n build_flib = self.get_finalized_command('build_flib')\n if build_flib.has_f_library(ext_name):\n need_f_libs = 1\n else:\n for lib_name in ext.libraries:\n if build_flib.has_f_library(lib_name):\n need_f_libs = 1\n break\n elif need_f_opts:\n build_flib = self.get_finalized_command('build_flib')\n print ext.name,ext_name,'needs fortran libraries',\\\n need_f_libs,need_f_opts\n \n if need_f_libs:\n if build_flib.has_f_library(ext_name) and \\\n ext_name not in ext.libraries:\n ext.libraries.insert(0,ext_name)\n for lib_name in ext.libraries[:]:\n ext.libraries.extend(build_flib.get_library_names(lib_name))\n ext.library_dirs.extend(build_flib.get_library_dirs(lib_name))\n \n ext.library_dirs.append(build_flib.build_flib)\n\n if need_f_libs or need_f_opts:\n moreargs = build_flib.fcompiler.get_extra_link_args()\n if moreargs != []:\n if ext.extra_link_args is None:\n ext.extra_link_args = moreargs\n else:\n ext.extra_link_args += moreargs\n\n runtime_dirs = build_flib.get_runtime_library_dirs()\n ext.runtime_library_dirs.extend(runtime_dirs or [])\n\n linker_so = build_flib.fcompiler.get_linker_so()\n\n if linker_so is not None:\n if linker_so is not save_linker_so:\n print 'replacing linker_so %s with %s' %(save_linker_so,linker_so)\n self.compiler.linker_so = linker_so\n l = build_flib.get_fcompiler_library_names()\n #l = self.compiler.libraries + l\n self.compiler.libraries = l\n l = ( self.compiler.library_dirs +\n build_flib.get_fcompiler_library_dirs() )\n self.compiler.library_dirs = l\n else:\n libs = build_flib.get_fcompiler_library_names()\n for lib in libs:\n if lib not in self.compiler.libraries:\n self.compiler.libraries.append(lib)\n\n lib_dirs = build_flib.get_fcompiler_library_dirs()\n for lib_dir in lib_dirs:\n if lib_dir not in self.compiler.library_dirs:\n self.compiler.library_dirs.append(lib_dir)\n\n # end of fortran source support\n res = old_build_ext.build_extension(self,ext)\n\n if save_linker_so is not self.compiler.linker_so:\n print 'restoring linker_so',save_linker_so\n self.compiler.linker_so = save_linker_so\n self.compiler.libraries = save_compiler_libs\n self.compiler.library_dirs = save_compiler_libs_dirs\n\n return res\n\n def get_source_files (self):\n self.check_extensions_list(self.extensions)\n filenames = []\n\n # Get sources and any include files in the same directory.\n for ext in self.extensions:\n filenames.extend(ext.sources)\n filenames.extend(get_headers(get_directories(ext.sources)))\n\n return filenames\n\n \n", + "source_code_before": "\"\"\" Modified version of build_ext that handles fortran source files.\n\"\"\"\n\nimport os, string\nfrom types import *\n\nfrom distutils.dep_util import newer_group, newer\nfrom distutils.command.build_ext import build_ext as old_build_ext\n\nfrom scipy_distutils.command.build_clib import get_headers,get_directories\n\nclass build_ext (old_build_ext):\n\n def build_extension(self, ext):\n #XXX: anything else we need to save?\n save_linker_so = self.compiler.linker_so\n save_compiler_libs = self.compiler.libraries\n save_compiler_libs_dirs = self.compiler.library_dirs\n \n # support for building static fortran libraries\n need_f_libs = 0\n need_f_opts = getattr(ext,'need_fcompiler_opts',0)\n ext_name = string.split(ext.name,'.')[-1]\n\n if self.distribution.has_f_libraries():\n build_flib = self.get_finalized_command('build_flib')\n if build_flib.has_f_library(ext_name):\n need_f_libs = 1\n else:\n for lib_name in ext.libraries:\n if build_flib.has_f_library(lib_name):\n need_f_libs = 1\n break\n elif need_f_opts:\n build_flib = self.get_finalized_command('build_flib')\n print ext.name,ext_name,'needs fortran libraries',\\\n need_f_libs,need_f_opts\n \n if need_f_libs:\n if build_flib.has_f_library(ext_name) and \\\n ext_name not in ext.libraries:\n ext.libraries.insert(0,ext_name)\n for lib_name in ext.libraries[:]:\n ext.libraries.extend(build_flib.get_library_names(lib_name))\n ext.library_dirs.extend(build_flib.get_library_dirs(lib_name))\n \n ext.library_dirs.append(build_flib.build_flib)\n\n if need_f_libs or need_f_opts:\n moreargs = build_flib.fcompiler.get_extra_link_args()\n if moreargs != []:\n if ext.extra_link_args is None:\n ext.extra_link_args = moreargs\n else:\n ext.extra_link_args += moreargs\n\n runtime_dirs = build_flib.get_runtime_library_dirs()\n ext.runtime_library_dirs.extend(runtime_dirs or [])\n\n linker_so = build_flib.fcompiler.get_linker_so()\n\n if linker_so is not None:\n if linker_so is not save_linker_so:\n print 'replacing linker_so %s with %s' %(save_linker_so,linker_so)\n self.compiler.linker_so = linker_so\n l = build_flib.get_fcompiler_library_names()\n #l = self.compiler.libraries + l\n self.compiler.libraries = l\n l = build_flib.get_fcompiler_library_dirs()\n #l = self.compiler.library_dirs + l\n self.compiler.library_dirs = l\n else:\n libs = build_flib.get_fcompiler_library_names()\n for lib in libs:\n if lib not in self.compiler.libraries:\n self.compiler.libraries.append(lib)\n\n lib_dirs = build_flib.get_fcompiler_library_dirs()\n for lib_dir in lib_dirs:\n if lib_dir not in self.compiler.library_dirs:\n self.compiler.library_dirs.append(lib_dir)\n\n # end of fortran source support\n res = old_build_ext.build_extension(self,ext)\n\n if save_linker_so is not self.compiler.linker_so:\n print 'restoring linker_so',save_linker_so\n self.compiler.linker_so = save_linker_so\n self.compiler.libraries = save_compiler_libs\n self.compiler.library_dirs = save_compiler_libs_dirs\n\n return res\n\n def get_source_files (self):\n self.check_extensions_list(self.extensions)\n filenames = []\n\n # Get sources and any include files in the same directory.\n for ext in self.extensions:\n filenames.extend(ext.sources)\n filenames.extend(get_headers(get_directories(ext.sources)))\n\n return filenames\n\n \n", + "methods": [ + { + "name": "build_extension", + "long_name": "build_extension( self , ext )", + "filename": "build_ext.py", + "nloc": 63, + "complexity": 22, + "token_count": 447, + "parameters": [ + "self", + "ext" + ], + "start_line": 14, + "end_line": 92, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 79, + "top_nesting_level": 1 + }, + { + "name": "get_source_files", + "long_name": "get_source_files( self )", + "filename": "build_ext.py", + "nloc": 7, + "complexity": 2, + "token_count": 48, + "parameters": [ + "self" + ], + "start_line": 94, + "end_line": 103, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + } + ], + "methods_before": [ + { + "name": "build_extension", + "long_name": "build_extension( self , ext )", + "filename": "build_ext.py", + "nloc": 62, + "complexity": 22, + "token_count": 439, + "parameters": [ + "self", + "ext" + ], + "start_line": 14, + "end_line": 92, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 79, + "top_nesting_level": 1 + }, + { + "name": "get_source_files", + "long_name": "get_source_files( self )", + "filename": "build_ext.py", + "nloc": 7, + "complexity": 2, + "token_count": 48, + "parameters": [ + "self" + ], + "start_line": 94, + "end_line": 103, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + } + ], + "changed_methods": [ + { + "name": "build_extension", + "long_name": "build_extension( self , ext )", + "filename": "build_ext.py", + "nloc": 63, + "complexity": 22, + "token_count": 447, + "parameters": [ + "self", + "ext" + ], + "start_line": 14, + "end_line": 92, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 79, + "top_nesting_level": 1 + } + ], + "nloc": 78, + "complexity": 24, + "token_count": 540, + "diff_parsed": { + "added": [ + " l = ( self.compiler.library_dirs +", + " build_flib.get_fcompiler_library_dirs() )" + ], + "deleted": [ + " l = build_flib.get_fcompiler_library_dirs()", + " #l = self.compiler.library_dirs + l" + ] + } + }, + { + "old_path": "scipy_distutils/command/build_flib.py", + "new_path": "scipy_distutils/command/build_flib.py", + "filename": "build_flib.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -777,7 +777,9 @@ def find_lib_directories(self):\n \n def get_linker_so(self):\n # win32 linking should be handled by standard linker\n- if sys.platform != 'win32' and os.uname()[0] != 'Darwin':\n+ if ((sys.platform != 'win32') and\n+ (sys.platform != 'cygwin') and\n+ (os.uname()[0] != 'Darwin')):\n return [self.f77_compiler,'-shared']\n \n def f90_compile(self,source_files,module_files,temp_dir=''):\n", + "added_lines": 3, + "deleted_lines": 1, + "source_code": "\"\"\" Implements the build_flib command which should go into Distutils\n at some point.\n \n Note:\n Right now, we're dynamically linking to the Fortran libraries on \n some platforms (Sun for sure). This is fine for local installations\n but a bad thing for redistribution because these libraries won't\n live on any machine that doesn't have a fortran compiler installed.\n It is pretty hard (impossible?) to get gcc to pass the right compiler\n flags on Sun to get the linker to use static libs for the fortran\n stuff. Investigate further...\n\nBugs:\n *** Options -e and -x have no effect when used with --help-compiler\n options. E.g. \n ./setup.py build_flib --help-compiler -e g77-3.0\n finds g77-2.95.\n How to extract these options inside the show_compilers function?\n *** compiler.is_available() method may not work correctly on nt\n because of lack of knowledge how to get exit status in\n run_command function. However, it may give reasonable results\n based on a version string.\n *** Some vendors provide different compilers for F77 and F90\n compilations. Currently, checking the availability of these\n compilers is based on only checking the availability of the\n corresponding F77 compiler. If it exists, then F90 is assumed\n to exist also.\n *** F compiler from Fortran Compiler is _not_ supported, though it\n is defined below. The reasons is that this F95 compiler is\n incomplete: it does not compile fixed format sources and\n that is needed by f2py generated wrappers for F90 modules.\n To support F as it is, some effort is needed to re-code\n f2py but it is not clear if this effort is worth.\n May be in future...\n\nOpen issues:\n *** User-defined compiler flags. Do we need --fflags?\n\nFortran compilers (as to be used with --fcompiler= option):\n Absoft\n Sun\n SGI\n Intel\n Itanium\n NAG\n Compaq\n Gnu\n VAST\n F [unsupported]\n\"\"\"\n\nimport distutils\nimport distutils.dep_util, distutils.dir_util\nimport os,sys,string\nimport commands,re\nfrom types import *\nfrom distutils.ccompiler import CCompiler,gen_preprocess_options\nfrom distutils.command.build_clib import build_clib\nfrom distutils.errors import *\n\nclass FortranCompilerError (CCompilerError):\n \"\"\"Some compile/link operation failed.\"\"\"\nclass FortranCompileError (FortranCompilerError):\n \"\"\"Failure to compile one or more Fortran source files.\"\"\"\n\nif os.name == 'nt':\n def run_command(command):\n \"\"\" not sure how to get exit status on nt. \"\"\"\n in_pipe,out_pipe = os.popen4(command)\n in_pipe.close()\n text = out_pipe.read()\n return 0, text\nelse:\n run_command = commands.getstatusoutput\n\n# Hooks for colored terminal output. Could be in a more general use.\n# See also http://www.livinglogic.de/Python/ansistyle\nif os.environ.get('TERM',None) in ['rxvt','xterm']:\n # Need a better way to determine whether a terminal supports colors\n def red_text(s): return '\\x1b[31m%s\\x1b[0m'%s\n def green_text(s): return '\\x1b[32m%s\\x1b[0m'%s\n def yellow_text(s): return '\\x1b[33m%s\\x1b[0m'%s\n def blue_text(s): return '\\x1b[34m%s\\x1b[0m'%s\n def cyan_text(s): return '\\x1b[35m%s\\x1b[0m'%s\nelse:\n def red_text(s): return s\n def green_text(s): return s\n def yellow_text(s): return s\n def cyan_text(s): return s\n def blue_text(s): return s\n\n\ndef show_compilers():\n for compiler_class in all_compilers:\n compiler = compiler_class()\n if compiler.is_available():\n print cyan_text(compiler)\n\nclass build_flib (build_clib):\n\n description = \"build f77/f90 libraries used by Python extensions\"\n\n user_options = [\n ('build-flib', 'b',\n \"directory to build f77/f90 libraries to\"),\n ('build-temp', 't',\n \"directory to put temporary build by-products\"),\n ('debug', 'g',\n \"compile with debugging information\"),\n ('force', 'f',\n \"forcibly build everything (ignore file timestamps)\"),\n ('fcompiler=', 'c',\n \"specify the compiler type\"),\n ('fcompiler-exec=', 'e',\n \"specify the path to F77 compiler\"),\n ('f90compiler-exec=', 'x',\n \"specify the path to F90 compiler\"),\n ]\n\n boolean_options = ['debug', 'force']\n\n help_options = [\n ('help-compiler', None,\n \"list available compilers\", show_compilers),\n ]\n\n def initialize_options (self):\n\n self.build_flib = None\n self.build_temp = None\n\n self.fortran_libraries = None\n self.define = None\n self.undef = None\n self.debug = None\n self.force = 0\n self.fcompiler = None\n self.fcompiler_exec = None\n self.f90compiler_exec = None\n\n # initialize_options()\n\n def finalize_options (self):\n self.set_undefined_options('build',\n ('build_temp', 'build_flib'),\n ('build_temp', 'build_temp'),\n ('debug', 'debug'),\n ('force', 'force'))\n fc = find_fortran_compiler(self.fcompiler,\n self.fcompiler_exec,\n self.f90compiler_exec)\n if not fc:\n raise DistutilsOptionError, 'Fortran compiler not available: %s'%(self.fcompiler)\n else:\n self.announce(cyan_text(' using %s Fortran compiler' % fc))\n self.fcompiler = fc\n if self.has_f_libraries():\n self.fortran_libraries = self.distribution.fortran_libraries\n self.check_library_list(self.fortran_libraries)\n \n # finalize_options()\n\n def has_f_libraries(self):\n return self.distribution.fortran_libraries \\\n and len(self.distribution.fortran_libraries) > 0\n\n def run (self):\n if not self.has_f_libraries():\n return\n self.build_libraries(self.fortran_libraries)\n\n # run ()\n\n def has_f_library(self,name):\n if self.has_f_libraries():\n # If self.fortran_libraries is None at this point\n # then it means that build_flib was called before\n # build. Always call build before build_flib.\n for (lib_name, build_info) in self.fortran_libraries:\n if lib_name == name:\n return 1\n \n def get_library_names(self, name=None):\n if not self.has_f_libraries():\n return None\n\n lib_names = []\n\n if name is None:\n for (lib_name, build_info) in self.fortran_libraries:\n lib_names.append(lib_name)\n\n if self.fcompiler is not None:\n lib_names.extend(self.fcompiler.get_libraries())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n for n in build_info.get('libraries',[]):\n lib_names.append(n)\n #XXX: how to catch recursive calls here?\n lib_names.extend(self.get_library_names(n))\n break\n return lib_names\n\n def get_fcompiler_library_names(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_libraries()\n return []\n\n def get_fcompiler_library_dirs(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_library_dirs()\n return []\n\n # get_library_names ()\n\n def get_library_dirs(self, name=None):\n if not self.has_f_libraries():\n return []\n\n lib_dirs = [] \n\n if name is None:\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_library_dirs())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n lib_dirs.extend(build_info.get('library_dirs',[]))\n for n in build_info.get('libraries',[]):\n lib_dirs.extend(self.get_library_dirs(n))\n break\n\n return lib_dirs\n\n # get_library_dirs ()\n\n def get_runtime_library_dirs(self):\n #if not self.has_f_libraries():\n # return []\n\n lib_dirs = []\n\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_runtime_library_dirs())\n \n return lib_dirs\n\n # get_library_dirs ()\n\n def get_source_files (self):\n if not self.has_f_libraries():\n return []\n\n self.check_library_list(self.fortran_libraries)\n filenames = []\n\n # Gets source files specified \n for ext in self.fortran_libraries:\n filenames.extend(ext[1]['sources'])\n\n return filenames \n \n def build_libraries (self, fortran_libraries):\n \n fcompiler = self.fcompiler\n \n for (lib_name, build_info) in fortran_libraries:\n self.announce(\" building '%s' library\" % lib_name)\n\n sources = build_info.get('sources')\n if sources is None or type(sources) not in (ListType, TupleType):\n raise DistutilsSetupError, \\\n (\"in 'fortran_libraries' option (library '%s'), \" +\n \"'sources' must be present and must be \" +\n \"a list of source filenames\") % lib_name\n sources = list(sources)\n module_dirs = build_info.get('module_dirs')\n module_files = build_info.get('module_files')\n\n\n include_dirs = build_info.get('include_dirs')\n\n if include_dirs:\n fcompiler.set_include_dirs(include_dirs)\n for n,v in build_info.get('define_macros') or []:\n fcompiler.define_macro(n,v)\n for n in build_info.get('undef_macros') or []:\n fcompiler.undefine_macro(n)\n\n if module_files:\n fcompiler.build_library(lib_name, module_files,\n temp_dir=self.build_temp)\n \n fcompiler.build_library(lib_name, sources,\n module_dirs, temp_dir=self.build_temp)\n\n # for loop\n\n # build_libraries ()\n\nclass fortran_compiler_base(CCompiler):\n\n vendor = None\n ver_match = None\n\n compiler_type = 'fortran'\n executables = {}\n \n def __init__(self,verbose=0,dry_run=0,force=0):\n # Default initialization. Constructors of derived classes MUST\n # call this function.\n CCompiler.__init__(self,verbose,dry_run,force)\n\n self.version = None\n \n self.f77_switches = ''\n self.f77_opt = ''\n self.f77_debug = ''\n \n self.f90_switches = ''\n self.f90_opt = ''\n self.f90_debug = ''\n \n #self.libraries = []\n #self.library_dirs = []\n\n if self.vendor is None:\n raise DistutilsInternalError,\\\n '%s must define vendor attribute'%(self.__class__)\n if self.ver_match is None:\n raise DistutilsInternalError,\\\n '%s must define ver_match attribute'%(self.__class__)\n\n def to_object(self,\n dirty_files,\n module_dirs=None,\n temp_dir=''):\n files = string.join(dirty_files)\n f90_files = get_f90_files(dirty_files)\n f77_files = get_f77_files(dirty_files)\n if f90_files != []:\n obj1 = self.f90_compile(f90_files,module_dirs,temp_dir = temp_dir)\n else:\n obj1 = []\n if f77_files != []:\n obj2 = self.f77_compile(f77_files, temp_dir = temp_dir)\n else:\n obj2 = []\n return obj1 + obj2\n\n def source_to_object_names(self,source_files, temp_dir=''):\n file_list = map(lambda x: os.path.basename(x),source_files)\n file_base_ext = map(lambda x: os.path.splitext(x),file_list)\n object_list = map(lambda x: x[0] +'.o',file_base_ext)\n object_files = map(lambda x,td=temp_dir: os.path.join(td,x),object_list)\n return object_files\n \n def source_and_object_pairs(self,source_files, temp_dir=''):\n object_files = self.source_to_object_names(source_files,temp_dir)\n file_pairs = zip(source_files,object_files)\n return file_pairs\n \n def f_compile(self,compiler,switches, source_files,\n module_dirs=None, temp_dir=''):\n\n pp_opts = gen_preprocess_options(self.macros,self.include_dirs)\n\n switches = switches + ' ' + string.join(pp_opts,' ')\n\n module_switch = self.build_module_switch(module_dirs)\n file_pairs = self.source_and_object_pairs(source_files,temp_dir)\n object_files = []\n for source,object in file_pairs:\n if distutils.dep_util.newer(source,object):\n cmd = compiler + ' ' + switches + ' '+\\\n module_switch + \\\n ' -c ' + source + ' -o ' + object \n print yellow_text(cmd)\n failure = os.system(cmd)\n if failure:\n raise FortranCompileError, 'failure during compile' \n object_files.append(object)\n return object_files\n #return all object files to make sure everything is archived \n #return map(lambda x: x[1], file_pairs)\n\n def f90_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f90_switches, self.f90_opt))\n return self.f_compile(self.f90_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n def f77_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f77_switches, self.f77_opt))\n return self.f_compile(self.f77_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n\n def build_module_switch(self, module_dirs):\n return ''\n\n def create_static_lib(self, object_files, library_name,\n output_dir='', debug=None):\n lib_file = os.path.join(output_dir,'lib'+library_name+'.a')\n newer = distutils.dep_util.newer\n # This doesn't work -- no way to know if the file is in the archive\n #object_files = filter(lambda o,lib=lib_file:\\\n # distutils.dep_util.newer(o,lib),object_files)\n objects = string.join(object_files)\n if objects:\n cmd = 'ar -cur %s %s' % (lib_file,objects)\n print yellow_text(cmd)\n os.system(cmd)\n cmd = 'ranlib %s ' % lib_file\n print yellow_text(cmd)\n os.system(cmd)\n\n def build_library(self,library_name,source_list,module_dirs=None,\n temp_dir = ''):\n #make sure the temp directory exists before trying to build files\n import distutils.dir_util\n distutils.dir_util.mkpath(temp_dir)\n\n #this compiles the files\n object_list = self.to_object(source_list,\n module_dirs,\n temp_dir)\n\n # actually we need to use all the object file names here to\n # make sure the library is always built. It could occur that an\n # object file exists but hasn't been put in the archive. (happens\n # a lot when builds fail once and are restarted).\n object_list = self.source_to_object_names(source_list, temp_dir)\n\n if os.name == 'nt':\n # This is pure bunk...\n # Windows fails for long argument strings on the command line.\n # if objects is real long (> 2048 chars or so on my machine),\n # the command fails (cmd.exe /e:2048 on w2k)\n # for now we'll split linking into to steps which should work for\n objects = object_list[:]\n while objects:\n obj,objects = objects[:20],objects[20:]\n self.create_static_lib(obj,library_name,temp_dir)\n else:\n self.create_static_lib(object_list,library_name,temp_dir)\n\n def dummy_fortran_files(self):\n import tempfile \n d = tempfile.gettempdir()\n dummy_name = os.path.join(d,'__dummy.f')\n dummy = open(dummy_name,'w')\n dummy.write(\" subroutine dummy()\\n end\\n\")\n dummy.close()\n return (os.path.join(d,'__dummy.f'),os.path.join(d,'__dummy.o'))\n \n def is_available(self):\n return self.get_version()\n \n def get_version(self):\n \"\"\"Return the compiler version. If compiler is not available,\n return empty string.\"\"\"\n # XXX: Is there compilers that have no version? If yes,\n # this test will fail even if the compiler is available.\n if self.version is not None:\n # Finding version is expensive, so return previously found\n # version string.\n return self.version\n self.version = ''\n # works I think only for unix... \n print 'command:', yellow_text(self.ver_cmd)\n exit_status, out_text = run_command(self.ver_cmd)\n print exit_status,\n if not exit_status:\n print green_text(out_text)\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n else:\n print red_text(out_text)\n return self.version\n\n def get_libraries(self):\n return self.libraries\n def get_library_dirs(self):\n return self.library_dirs\n def get_extra_link_args(self):\n return []\n def get_runtime_library_dirs(self):\n return []\n def get_linker_so(self):\n \"\"\"\n If a compiler requires specific linker then return a list\n containing a linker executable name and linker options.\n Otherwise, return None.\n \"\"\"\n\n def __str__(self):\n return \"%s %s\" % (self.vendor, self.get_version())\n\n\nclass absoft_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Absoft'\n ver_match = r'FORTRAN 77 Compiler (?P[^\\s*,]*).*?Absoft Corp'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n # got rid of -B108 cause it was generating 2 underscores instead\n # of one on the newest version. Now we use -YEXT_SFX=_ to \n # specify the output format\n if os.name == 'nt':\n self.f90_switches = '-f fixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -Q100'\n self.f77_switches = '-N22 -N90 -N110'\n self.f77_opt = '-O -Q100'\n self.libraries = ['fio', 'fmath', 'f90math', 'COMDLG32']\n else:\n self.f90_switches = '-ffixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -B101' \n self.f77_switches = '-N22 -N90 -N110 -B108'\n self.f77_opt = '-O -B101'\n\n self.libraries = ['fio', 'f77math', 'f90math']\n \n try:\n dir = os.environ['ABSOFT'] \n self.library_dirs = [os.path.join(dir,'lib')]\n except KeyError:\n self.library_dirs = []\n\n self.ver_cmd = self.f77_compiler + ' -V -c %s -o %s' % \\\n self.dummy_fortran_files()\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -p' + mod\n return res\n\n def get_extra_link_args(self):\n return []\n # Couldn't get this to link for anything using gcc.\n #dr = \"c:\\\\Absoft62\\\\lib\"\n #libs = ['fio.lib', 'COMDLG32.lib','fmath.lib', 'f90math.lib','libcomdlg32.a' ] \n #libs = map(lambda x,dr=dr:os.path.join(dr,x),libs)\n #return libs\n\n\nclass sun_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Sun'\n #ver_match = r'f77: (?P[^\\s*,]*)'\n ver_match = r'f90: Sun (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -pic '\n self.f77_opt = ' -fast -dalign '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -fixed ' # ??? why fixed?\n self.f90_opt = ' -fast -dalign '\n\n self.ver_cmd = self.f90_compiler + ' -V'\n\n #self.libraries = ['f90', 'F77', 'M77', 'sunmath', 'm']\n self.libraries = ['fsu', 'F77', 'M77', 'sunmath', 'm']\n \n #threaded\n #self.libraries = ['f90', 'F77_mt', 'sunmath_mt', 'm', 'thread']\n #self.libraries = []\n self.library_dirs = self.find_lib_dir()\n #print 'sun:',self.library_dirs\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -M' + mod\n return res\n\n def find_lib_dir(self):\n library_dirs = []\n lib_match = r'### f90: Note: LD_RUN_PATH\\s*= '\\\n '(?P[^\\s.]*).*'\n cmd = self.f90_compiler + ' -dryrun dummy.f'\n exit_status, output = run_command(cmd)\n if not exit_status:\n libs = re.findall(lib_match,output)\n if libs:\n library_dirs = string.split(libs[0],':')\n self.get_version() # force version calculation\n compiler_home = os.path.dirname(library_dirs[0])\n library_dirs.append(os.path.join(compiler_home,\n self.version,'lib'))\n return library_dirs\n def get_runtime_library_dirs(self):\n return self.find_lib_dir()\n def get_extra_link_args(self):\n return ['-mimpure-text']\n\n\nclass mips_fortran_compiler(fortran_compiler_base):\n\n vendor = 'SGI'\n ver_match = r'MIPSpro Compilers: Version (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -n32 -KPIC '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -n32 -KPIC -fixedform ' # why fixed ???\n self.f90_opt = ' ' \n\n self.ver_cmd = self.f77_compiler + ' -version'\n \n self.libraries = ['fortran', 'ftn', 'm']\n self.library_dirs = self.find_lib_dir()\n\n\n def build_module_switch(self,module_dirs):\n res = ''\n return res \n def find_lib_dir(self):\n library_dirs = []\n return library_dirs\n def get_runtime_library_dirs(self):\n\treturn self.find_lib_dir() \n def get_extra_link_args(self):\n\treturn []\n\nclass hpux_fortran_compiler(fortran_compiler_base):\n\n vendor = 'HP'\n ver_match = r'HP F90 (?P[^\\s*,]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f90'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f77_switches = ' +pic=long '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' +pic=long '\n self.f90_opt = ' -O3 '\n\n self.ver_cmd = self.f77_compiler + ' +version '\n\n self.libraries = ['m']\n self.library_dirs = []\n\n def get_version(self):\n if self.version is not None:\n return self.version\n self.version = ''\n print 'command:', yellow_text(self.ver_cmd)\n exit_status, out_text = run_command(self.ver_cmd)\n print exit_status,\n if exit_status in [0,256]:\n # 256 seems to indicate success on HP-UX but keeping\n # also 0. Or does 0 exit status mean something different\n # in this platform?\n print green_text(out_text)\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n else:\n print red_text(out_text)\n return self.version\n\nclass gnu_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Gnu'\n #ver_match = r'g77 version (?P[^\\s*]*)'\n ver_match = r'GNU Fortran (?P[^\\s*]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if sys.platform == 'win32':\n self.libraries = ['gcc','g2c']\n self.library_dirs = self.find_lib_directories()\n else:\n # On linux g77 does not need lib_directories to be specified.\n self.libraries = ['g2c']\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n\n switches = ' -Wall -fno-second-underscore '\n\n if os.name != 'nt':\n switches = switches + ' -fpic '\n\n self.f77_switches = switches\n #self.ver_cmd = self.f77_compiler + ' -v '\n self.ver_cmd = self.f77_compiler + ' --version'\n\n self.f77_opt = self.get_opt()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 -funroll-loops '\n \n # only check for more optimization if g77 can handle\n # it.\n if self.get_version():\n if self.version[0]=='3': # is g77 3.x.x\n if cpu.is_AthlonK6():\n opt = opt + ' -march=k6 '\n elif cpu.is_AthlonK7():\n opt = opt + ' -march=athlon '\n if cpu.is_i686():\n opt = opt + ' -march=i686 '\n elif cpu.is_i586():\n opt = opt + ' -march=i586 '\n elif cpu.is_i486():\n opt = opt + ' -march=i486 '\n elif cpu.is_i386():\n opt = opt + ' -march=i386 '\n if cpu.is_Intel():\n opt = opt + ' -malign-double ' \n return opt\n \n def find_lib_directories(self):\n lib_dir = []\n match = r'Reading specs from (.*)/specs'\n\n # works I think only for unix... \n exit_status, out_text = run_command('g77 -v')\n if not exit_status:\n m = re.findall(match,out_text)\n if m:\n lib_dir= m #m[0] \n return lib_dir\n\n def get_linker_so(self):\n # win32 linking should be handled by standard linker\n if ((sys.platform != 'win32') and\n (sys.platform != 'cygwin') and\n (os.uname()[0] != 'Darwin')):\n return [self.f77_compiler,'-shared']\n \n def f90_compile(self,source_files,module_files,temp_dir=''):\n raise DistutilsExecError, 'f90 not supported by Gnu'\n\n\n#http://developer.intel.com/software/products/compilers/f50/linux/\nclass intel_ia32_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Intel' # Intel(R) Corporation \n ver_match = r'Intel\\(R\\) Fortran Compiler for 32-bit applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'ifc'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -KPIC '\n\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n if cpu.has_fdiv_bug():\n switches = switches + ' -fdiv_check '\n if cpu.has_f00f_bug():\n switches = switches + ' -0f_check '\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -FI -w90 -w95 '\n\n self.f77_opt = self.f90_opt = self.get_opt()\n \n debug = ' -g -C '\n self.f77_debug = self.f90_debug = debug\n\n self.ver_cmd = self.f77_compiler+' -FI -V -c %s -o %s' %\\\n self.dummy_fortran_files()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 '\n if cpu.is_PentiumPro() or cpu.is_PentiumII():\n opt = opt + ' -tpp6 -xi '\n elif cpu.is_PentiumIII():\n opt = opt + ' -tpp6 '\n elif cpu.is_Pentium():\n opt = opt + ' -tpp5 '\n elif cpu.is_PentiumIV():\n opt = opt + ' -tpp7 -xW '\n elif cpu.has_mmx():\n opt = opt + ' -xM '\n return opt\n \n\n def get_linker_so(self):\n return [self.f77_compiler,'-shared']\n\n\nclass intel_itanium_fortran_compiler(intel_ia32_fortran_compiler):\n\n vendor = 'Itanium'\n ver_match = r'Intel\\(R\\) Fortran 90 Compiler Itanium\\(TM\\) Compiler for the Itanium\\(TM\\)-based applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n if fc is None:\n fc = 'efc'\n intel_ia32_fortran_compiler.__init__(self, fc, f90c)\n\n\nclass nag_fortran_compiler(fortran_compiler_base):\n\n vendor = 'NAG'\n ver_match = r'NAGWare Fortran 95 compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'f95'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ''\n debug = ' -g -gline -g90 -nan -C '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -fixed '\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -target=native '\n return opt\n\n def get_linker_so(self):\n return [self.f77_compiler,'-Wl,-shared']\n\n# http://www.fortran.com/F/compilers.html\n#\n# We define F compiler here but it is quite useless\n# because it does not support for fixed format sources\n# which makes it impossible to use with f2py generated\n# fixed format wrappers to F90 modules.\nclass f_fortran_compiler(fortran_compiler_base):\n\n vendor = 'F'\n ver_match = r'Fortran Company/NAG F compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'F'\n if f90c is None:\n f90c = 'F'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n self.ver_cmd = self.f90_compiler+' -V '\n\n gnu = gnu_fortran_compiler('g77')\n if not gnu.is_available(): # F compiler requires gcc.\n self.version = ''\n return\n if not self.is_available():\n return\n\n print red_text(\"\"\"\nWARNING: F compiler is unsupported due to its incompleteness.\n Send complaints to its vendor. For adding its support\n to scipy_distutils, it must be able to compile\n fixed format Fortran 90.\n\"\"\")\n\n self.f90_switches = ''\n self.f90_debug = ' -g -gline -g90 -C '\n self.f90_opt = ' -O '\n\n #self.f77_switches = gnu.f77_switches\n #self.f77_debug = gnu.f77_debug\n #self.f77_opt = gnu.f77_opt\n\n def get_linker_so(self):\n return ['gcc','-shared']\n\nclass vast_fortran_compiler(fortran_compiler_base):\n\n vendor = 'VAST'\n ver_match = r'\\s*Pacific-Sierra Research vf90 (Personal|Professional)\\s+(?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n d,b = os.path.split(f90c)\n vf90 = os.path.join(d,'v'+b)\n self.ver_cmd = vf90+' -v '\n\n gnu = gnu_fortran_compiler(fc)\n if not gnu.is_available(): # VAST compiler requires g77.\n self.version = ''\n return\n if not self.is_available():\n return\n\n self.f77_switches = gnu.f77_switches\n self.f77_debug = gnu.f77_debug\n self.f77_opt = gnu.f77_opt \n\n # XXX: need f90 switches, debug, opt\n\n def get_linker_so(self):\n return [self.f90_compiler,'-shared']\n\nclass compaq_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Compaq'\n ver_match = r'Compaq Fortran (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'fort'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -assume no2underscore -nomixed_str_len_arg '\n debug = ' -g -check_bounds '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n # XXX: uncomment if required\n #self.libraries = ' -lUfor -lfor -lFutil -lcpml -lots -lc '\n\n # XXX: fix the version showing flag\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -align dcommons -arch host -assume bigarrays -assume nozsize -math_library fast -tune host '\n return opt\n\n def get_linker_so(self):\n # XXX: is -shared needed?\n return [self.f77_compiler,'-shared']\n\n\ndef match_extension(files,ext):\n match = re.compile(r'.*[.]('+ext+r')\\Z',re.I).match\n return filter(lambda x,match = match: match(x),files)\n\ndef get_f77_files(files):\n return match_extension(files,'for|f77|ftn|f')\n\ndef get_f90_files(files):\n return match_extension(files,'f90|f95')\n\ndef get_fortran_files(files):\n return match_extension(files,'f90|f95|for|f77|ftn|f')\n\ndef find_fortran_compiler(vendor = None, fc = None, f90c = None):\n fcompiler = None\n for compiler_class in all_compilers:\n if vendor is not None and vendor != compiler_class.vendor:\n continue\n print compiler_class\n compiler = compiler_class(fc,f90c)\n if compiler.is_available():\n fcompiler = compiler\n break\n return fcompiler\n\nall_compilers = [absoft_fortran_compiler,\n mips_fortran_compiler,\n sun_fortran_compiler,\n intel_ia32_fortran_compiler,\n intel_itanium_fortran_compiler,\n nag_fortran_compiler,\n compaq_fortran_compiler,\n vast_fortran_compiler,\n hpux_fortran_compiler,\n f_fortran_compiler,\n gnu_fortran_compiler,\n\n ]\n\nif __name__ == \"__main__\":\n show_compilers()\n", + "source_code_before": "\"\"\" Implements the build_flib command which should go into Distutils\n at some point.\n \n Note:\n Right now, we're dynamically linking to the Fortran libraries on \n some platforms (Sun for sure). This is fine for local installations\n but a bad thing for redistribution because these libraries won't\n live on any machine that doesn't have a fortran compiler installed.\n It is pretty hard (impossible?) to get gcc to pass the right compiler\n flags on Sun to get the linker to use static libs for the fortran\n stuff. Investigate further...\n\nBugs:\n *** Options -e and -x have no effect when used with --help-compiler\n options. E.g. \n ./setup.py build_flib --help-compiler -e g77-3.0\n finds g77-2.95.\n How to extract these options inside the show_compilers function?\n *** compiler.is_available() method may not work correctly on nt\n because of lack of knowledge how to get exit status in\n run_command function. However, it may give reasonable results\n based on a version string.\n *** Some vendors provide different compilers for F77 and F90\n compilations. Currently, checking the availability of these\n compilers is based on only checking the availability of the\n corresponding F77 compiler. If it exists, then F90 is assumed\n to exist also.\n *** F compiler from Fortran Compiler is _not_ supported, though it\n is defined below. The reasons is that this F95 compiler is\n incomplete: it does not compile fixed format sources and\n that is needed by f2py generated wrappers for F90 modules.\n To support F as it is, some effort is needed to re-code\n f2py but it is not clear if this effort is worth.\n May be in future...\n\nOpen issues:\n *** User-defined compiler flags. Do we need --fflags?\n\nFortran compilers (as to be used with --fcompiler= option):\n Absoft\n Sun\n SGI\n Intel\n Itanium\n NAG\n Compaq\n Gnu\n VAST\n F [unsupported]\n\"\"\"\n\nimport distutils\nimport distutils.dep_util, distutils.dir_util\nimport os,sys,string\nimport commands,re\nfrom types import *\nfrom distutils.ccompiler import CCompiler,gen_preprocess_options\nfrom distutils.command.build_clib import build_clib\nfrom distutils.errors import *\n\nclass FortranCompilerError (CCompilerError):\n \"\"\"Some compile/link operation failed.\"\"\"\nclass FortranCompileError (FortranCompilerError):\n \"\"\"Failure to compile one or more Fortran source files.\"\"\"\n\nif os.name == 'nt':\n def run_command(command):\n \"\"\" not sure how to get exit status on nt. \"\"\"\n in_pipe,out_pipe = os.popen4(command)\n in_pipe.close()\n text = out_pipe.read()\n return 0, text\nelse:\n run_command = commands.getstatusoutput\n\n# Hooks for colored terminal output. Could be in a more general use.\n# See also http://www.livinglogic.de/Python/ansistyle\nif os.environ.get('TERM',None) in ['rxvt','xterm']:\n # Need a better way to determine whether a terminal supports colors\n def red_text(s): return '\\x1b[31m%s\\x1b[0m'%s\n def green_text(s): return '\\x1b[32m%s\\x1b[0m'%s\n def yellow_text(s): return '\\x1b[33m%s\\x1b[0m'%s\n def blue_text(s): return '\\x1b[34m%s\\x1b[0m'%s\n def cyan_text(s): return '\\x1b[35m%s\\x1b[0m'%s\nelse:\n def red_text(s): return s\n def green_text(s): return s\n def yellow_text(s): return s\n def cyan_text(s): return s\n def blue_text(s): return s\n\n\ndef show_compilers():\n for compiler_class in all_compilers:\n compiler = compiler_class()\n if compiler.is_available():\n print cyan_text(compiler)\n\nclass build_flib (build_clib):\n\n description = \"build f77/f90 libraries used by Python extensions\"\n\n user_options = [\n ('build-flib', 'b',\n \"directory to build f77/f90 libraries to\"),\n ('build-temp', 't',\n \"directory to put temporary build by-products\"),\n ('debug', 'g',\n \"compile with debugging information\"),\n ('force', 'f',\n \"forcibly build everything (ignore file timestamps)\"),\n ('fcompiler=', 'c',\n \"specify the compiler type\"),\n ('fcompiler-exec=', 'e',\n \"specify the path to F77 compiler\"),\n ('f90compiler-exec=', 'x',\n \"specify the path to F90 compiler\"),\n ]\n\n boolean_options = ['debug', 'force']\n\n help_options = [\n ('help-compiler', None,\n \"list available compilers\", show_compilers),\n ]\n\n def initialize_options (self):\n\n self.build_flib = None\n self.build_temp = None\n\n self.fortran_libraries = None\n self.define = None\n self.undef = None\n self.debug = None\n self.force = 0\n self.fcompiler = None\n self.fcompiler_exec = None\n self.f90compiler_exec = None\n\n # initialize_options()\n\n def finalize_options (self):\n self.set_undefined_options('build',\n ('build_temp', 'build_flib'),\n ('build_temp', 'build_temp'),\n ('debug', 'debug'),\n ('force', 'force'))\n fc = find_fortran_compiler(self.fcompiler,\n self.fcompiler_exec,\n self.f90compiler_exec)\n if not fc:\n raise DistutilsOptionError, 'Fortran compiler not available: %s'%(self.fcompiler)\n else:\n self.announce(cyan_text(' using %s Fortran compiler' % fc))\n self.fcompiler = fc\n if self.has_f_libraries():\n self.fortran_libraries = self.distribution.fortran_libraries\n self.check_library_list(self.fortran_libraries)\n \n # finalize_options()\n\n def has_f_libraries(self):\n return self.distribution.fortran_libraries \\\n and len(self.distribution.fortran_libraries) > 0\n\n def run (self):\n if not self.has_f_libraries():\n return\n self.build_libraries(self.fortran_libraries)\n\n # run ()\n\n def has_f_library(self,name):\n if self.has_f_libraries():\n # If self.fortran_libraries is None at this point\n # then it means that build_flib was called before\n # build. Always call build before build_flib.\n for (lib_name, build_info) in self.fortran_libraries:\n if lib_name == name:\n return 1\n \n def get_library_names(self, name=None):\n if not self.has_f_libraries():\n return None\n\n lib_names = []\n\n if name is None:\n for (lib_name, build_info) in self.fortran_libraries:\n lib_names.append(lib_name)\n\n if self.fcompiler is not None:\n lib_names.extend(self.fcompiler.get_libraries())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n for n in build_info.get('libraries',[]):\n lib_names.append(n)\n #XXX: how to catch recursive calls here?\n lib_names.extend(self.get_library_names(n))\n break\n return lib_names\n\n def get_fcompiler_library_names(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_libraries()\n return []\n\n def get_fcompiler_library_dirs(self):\n #if not self.has_f_libraries():\n # return None\n if self.fcompiler is not None:\n return self.fcompiler.get_library_dirs()\n return []\n\n # get_library_names ()\n\n def get_library_dirs(self, name=None):\n if not self.has_f_libraries():\n return []\n\n lib_dirs = [] \n\n if name is None:\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_library_dirs())\n else:\n for (lib_name, build_info) in self.fortran_libraries:\n if name != lib_name: continue\n lib_dirs.extend(build_info.get('library_dirs',[]))\n for n in build_info.get('libraries',[]):\n lib_dirs.extend(self.get_library_dirs(n))\n break\n\n return lib_dirs\n\n # get_library_dirs ()\n\n def get_runtime_library_dirs(self):\n #if not self.has_f_libraries():\n # return []\n\n lib_dirs = []\n\n if self.fcompiler is not None:\n lib_dirs.extend(self.fcompiler.get_runtime_library_dirs())\n \n return lib_dirs\n\n # get_library_dirs ()\n\n def get_source_files (self):\n if not self.has_f_libraries():\n return []\n\n self.check_library_list(self.fortran_libraries)\n filenames = []\n\n # Gets source files specified \n for ext in self.fortran_libraries:\n filenames.extend(ext[1]['sources'])\n\n return filenames \n \n def build_libraries (self, fortran_libraries):\n \n fcompiler = self.fcompiler\n \n for (lib_name, build_info) in fortran_libraries:\n self.announce(\" building '%s' library\" % lib_name)\n\n sources = build_info.get('sources')\n if sources is None or type(sources) not in (ListType, TupleType):\n raise DistutilsSetupError, \\\n (\"in 'fortran_libraries' option (library '%s'), \" +\n \"'sources' must be present and must be \" +\n \"a list of source filenames\") % lib_name\n sources = list(sources)\n module_dirs = build_info.get('module_dirs')\n module_files = build_info.get('module_files')\n\n\n include_dirs = build_info.get('include_dirs')\n\n if include_dirs:\n fcompiler.set_include_dirs(include_dirs)\n for n,v in build_info.get('define_macros') or []:\n fcompiler.define_macro(n,v)\n for n in build_info.get('undef_macros') or []:\n fcompiler.undefine_macro(n)\n\n if module_files:\n fcompiler.build_library(lib_name, module_files,\n temp_dir=self.build_temp)\n \n fcompiler.build_library(lib_name, sources,\n module_dirs, temp_dir=self.build_temp)\n\n # for loop\n\n # build_libraries ()\n\nclass fortran_compiler_base(CCompiler):\n\n vendor = None\n ver_match = None\n\n compiler_type = 'fortran'\n executables = {}\n \n def __init__(self,verbose=0,dry_run=0,force=0):\n # Default initialization. Constructors of derived classes MUST\n # call this function.\n CCompiler.__init__(self,verbose,dry_run,force)\n\n self.version = None\n \n self.f77_switches = ''\n self.f77_opt = ''\n self.f77_debug = ''\n \n self.f90_switches = ''\n self.f90_opt = ''\n self.f90_debug = ''\n \n #self.libraries = []\n #self.library_dirs = []\n\n if self.vendor is None:\n raise DistutilsInternalError,\\\n '%s must define vendor attribute'%(self.__class__)\n if self.ver_match is None:\n raise DistutilsInternalError,\\\n '%s must define ver_match attribute'%(self.__class__)\n\n def to_object(self,\n dirty_files,\n module_dirs=None,\n temp_dir=''):\n files = string.join(dirty_files)\n f90_files = get_f90_files(dirty_files)\n f77_files = get_f77_files(dirty_files)\n if f90_files != []:\n obj1 = self.f90_compile(f90_files,module_dirs,temp_dir = temp_dir)\n else:\n obj1 = []\n if f77_files != []:\n obj2 = self.f77_compile(f77_files, temp_dir = temp_dir)\n else:\n obj2 = []\n return obj1 + obj2\n\n def source_to_object_names(self,source_files, temp_dir=''):\n file_list = map(lambda x: os.path.basename(x),source_files)\n file_base_ext = map(lambda x: os.path.splitext(x),file_list)\n object_list = map(lambda x: x[0] +'.o',file_base_ext)\n object_files = map(lambda x,td=temp_dir: os.path.join(td,x),object_list)\n return object_files\n \n def source_and_object_pairs(self,source_files, temp_dir=''):\n object_files = self.source_to_object_names(source_files,temp_dir)\n file_pairs = zip(source_files,object_files)\n return file_pairs\n \n def f_compile(self,compiler,switches, source_files,\n module_dirs=None, temp_dir=''):\n\n pp_opts = gen_preprocess_options(self.macros,self.include_dirs)\n\n switches = switches + ' ' + string.join(pp_opts,' ')\n\n module_switch = self.build_module_switch(module_dirs)\n file_pairs = self.source_and_object_pairs(source_files,temp_dir)\n object_files = []\n for source,object in file_pairs:\n if distutils.dep_util.newer(source,object):\n cmd = compiler + ' ' + switches + ' '+\\\n module_switch + \\\n ' -c ' + source + ' -o ' + object \n print yellow_text(cmd)\n failure = os.system(cmd)\n if failure:\n raise FortranCompileError, 'failure during compile' \n object_files.append(object)\n return object_files\n #return all object files to make sure everything is archived \n #return map(lambda x: x[1], file_pairs)\n\n def f90_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f90_switches, self.f90_opt))\n return self.f_compile(self.f90_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n def f77_compile(self,source_files,module_dirs=None, temp_dir=''):\n switches = string.join((self.f77_switches, self.f77_opt))\n return self.f_compile(self.f77_compiler,switches,\n source_files, module_dirs,temp_dir)\n\n\n def build_module_switch(self, module_dirs):\n return ''\n\n def create_static_lib(self, object_files, library_name,\n output_dir='', debug=None):\n lib_file = os.path.join(output_dir,'lib'+library_name+'.a')\n newer = distutils.dep_util.newer\n # This doesn't work -- no way to know if the file is in the archive\n #object_files = filter(lambda o,lib=lib_file:\\\n # distutils.dep_util.newer(o,lib),object_files)\n objects = string.join(object_files)\n if objects:\n cmd = 'ar -cur %s %s' % (lib_file,objects)\n print yellow_text(cmd)\n os.system(cmd)\n cmd = 'ranlib %s ' % lib_file\n print yellow_text(cmd)\n os.system(cmd)\n\n def build_library(self,library_name,source_list,module_dirs=None,\n temp_dir = ''):\n #make sure the temp directory exists before trying to build files\n import distutils.dir_util\n distutils.dir_util.mkpath(temp_dir)\n\n #this compiles the files\n object_list = self.to_object(source_list,\n module_dirs,\n temp_dir)\n\n # actually we need to use all the object file names here to\n # make sure the library is always built. It could occur that an\n # object file exists but hasn't been put in the archive. (happens\n # a lot when builds fail once and are restarted).\n object_list = self.source_to_object_names(source_list, temp_dir)\n\n if os.name == 'nt':\n # This is pure bunk...\n # Windows fails for long argument strings on the command line.\n # if objects is real long (> 2048 chars or so on my machine),\n # the command fails (cmd.exe /e:2048 on w2k)\n # for now we'll split linking into to steps which should work for\n objects = object_list[:]\n while objects:\n obj,objects = objects[:20],objects[20:]\n self.create_static_lib(obj,library_name,temp_dir)\n else:\n self.create_static_lib(object_list,library_name,temp_dir)\n\n def dummy_fortran_files(self):\n import tempfile \n d = tempfile.gettempdir()\n dummy_name = os.path.join(d,'__dummy.f')\n dummy = open(dummy_name,'w')\n dummy.write(\" subroutine dummy()\\n end\\n\")\n dummy.close()\n return (os.path.join(d,'__dummy.f'),os.path.join(d,'__dummy.o'))\n \n def is_available(self):\n return self.get_version()\n \n def get_version(self):\n \"\"\"Return the compiler version. If compiler is not available,\n return empty string.\"\"\"\n # XXX: Is there compilers that have no version? If yes,\n # this test will fail even if the compiler is available.\n if self.version is not None:\n # Finding version is expensive, so return previously found\n # version string.\n return self.version\n self.version = ''\n # works I think only for unix... \n print 'command:', yellow_text(self.ver_cmd)\n exit_status, out_text = run_command(self.ver_cmd)\n print exit_status,\n if not exit_status:\n print green_text(out_text)\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n else:\n print red_text(out_text)\n return self.version\n\n def get_libraries(self):\n return self.libraries\n def get_library_dirs(self):\n return self.library_dirs\n def get_extra_link_args(self):\n return []\n def get_runtime_library_dirs(self):\n return []\n def get_linker_so(self):\n \"\"\"\n If a compiler requires specific linker then return a list\n containing a linker executable name and linker options.\n Otherwise, return None.\n \"\"\"\n\n def __str__(self):\n return \"%s %s\" % (self.vendor, self.get_version())\n\n\nclass absoft_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Absoft'\n ver_match = r'FORTRAN 77 Compiler (?P[^\\s*,]*).*?Absoft Corp'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n # got rid of -B108 cause it was generating 2 underscores instead\n # of one on the newest version. Now we use -YEXT_SFX=_ to \n # specify the output format\n if os.name == 'nt':\n self.f90_switches = '-f fixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -Q100'\n self.f77_switches = '-N22 -N90 -N110'\n self.f77_opt = '-O -Q100'\n self.libraries = ['fio', 'fmath', 'f90math', 'COMDLG32']\n else:\n self.f90_switches = '-ffixed -YCFRL=1 -YCOM_NAMES=LCS' \\\n ' -YCOM_PFX -YEXT_PFX -YEXT_NAMES=LCS' \\\n ' -YCOM_SFX=_ -YEXT_SFX=_ -YEXT_NAMES=LCS' \n self.f90_opt = '-O -B101' \n self.f77_switches = '-N22 -N90 -N110 -B108'\n self.f77_opt = '-O -B101'\n\n self.libraries = ['fio', 'f77math', 'f90math']\n \n try:\n dir = os.environ['ABSOFT'] \n self.library_dirs = [os.path.join(dir,'lib')]\n except KeyError:\n self.library_dirs = []\n\n self.ver_cmd = self.f77_compiler + ' -V -c %s -o %s' % \\\n self.dummy_fortran_files()\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -p' + mod\n return res\n\n def get_extra_link_args(self):\n return []\n # Couldn't get this to link for anything using gcc.\n #dr = \"c:\\\\Absoft62\\\\lib\"\n #libs = ['fio.lib', 'COMDLG32.lib','fmath.lib', 'f90math.lib','libcomdlg32.a' ] \n #libs = map(lambda x,dr=dr:os.path.join(dr,x),libs)\n #return libs\n\n\nclass sun_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Sun'\n #ver_match = r'f77: (?P[^\\s*,]*)'\n ver_match = r'f90: Sun (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -pic '\n self.f77_opt = ' -fast -dalign '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -fixed ' # ??? why fixed?\n self.f90_opt = ' -fast -dalign '\n\n self.ver_cmd = self.f90_compiler + ' -V'\n\n #self.libraries = ['f90', 'F77', 'M77', 'sunmath', 'm']\n self.libraries = ['fsu', 'F77', 'M77', 'sunmath', 'm']\n \n #threaded\n #self.libraries = ['f90', 'F77_mt', 'sunmath_mt', 'm', 'thread']\n #self.libraries = []\n self.library_dirs = self.find_lib_dir()\n #print 'sun:',self.library_dirs\n\n def build_module_switch(self,module_dirs):\n res = ''\n if module_dirs:\n for mod in module_dirs:\n res = res + ' -M' + mod\n return res\n\n def find_lib_dir(self):\n library_dirs = []\n lib_match = r'### f90: Note: LD_RUN_PATH\\s*= '\\\n '(?P[^\\s.]*).*'\n cmd = self.f90_compiler + ' -dryrun dummy.f'\n exit_status, output = run_command(cmd)\n if not exit_status:\n libs = re.findall(lib_match,output)\n if libs:\n library_dirs = string.split(libs[0],':')\n self.get_version() # force version calculation\n compiler_home = os.path.dirname(library_dirs[0])\n library_dirs.append(os.path.join(compiler_home,\n self.version,'lib'))\n return library_dirs\n def get_runtime_library_dirs(self):\n return self.find_lib_dir()\n def get_extra_link_args(self):\n return ['-mimpure-text']\n\n\nclass mips_fortran_compiler(fortran_compiler_base):\n\n vendor = 'SGI'\n ver_match = r'MIPSpro Compilers: Version (?P[^\\s*,]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc # not tested\n self.f77_switches = ' -n32 -KPIC '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' -n32 -KPIC -fixedform ' # why fixed ???\n self.f90_opt = ' ' \n\n self.ver_cmd = self.f77_compiler + ' -version'\n \n self.libraries = ['fortran', 'ftn', 'm']\n self.library_dirs = self.find_lib_dir()\n\n\n def build_module_switch(self,module_dirs):\n res = ''\n return res \n def find_lib_dir(self):\n library_dirs = []\n return library_dirs\n def get_runtime_library_dirs(self):\n\treturn self.find_lib_dir() \n def get_extra_link_args(self):\n\treturn []\n\nclass hpux_fortran_compiler(fortran_compiler_base):\n\n vendor = 'HP'\n ver_match = r'HP F90 (?P[^\\s*,]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if fc is None:\n fc = 'f90'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f77_switches = ' +pic=long '\n self.f77_opt = ' -O3 '\n\n self.f90_compiler = f90c\n self.f90_switches = ' +pic=long '\n self.f90_opt = ' -O3 '\n\n self.ver_cmd = self.f77_compiler + ' +version '\n\n self.libraries = ['m']\n self.library_dirs = []\n\n def get_version(self):\n if self.version is not None:\n return self.version\n self.version = ''\n print 'command:', yellow_text(self.ver_cmd)\n exit_status, out_text = run_command(self.ver_cmd)\n print exit_status,\n if exit_status in [0,256]:\n # 256 seems to indicate success on HP-UX but keeping\n # also 0. Or does 0 exit status mean something different\n # in this platform?\n print green_text(out_text)\n m = re.match(self.ver_match,out_text)\n if m:\n self.version = m.group('version')\n else:\n print red_text(out_text)\n return self.version\n\nclass gnu_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Gnu'\n #ver_match = r'g77 version (?P[^\\s*]*)'\n ver_match = r'GNU Fortran (?P[^\\s*]*)'\n \n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n if sys.platform == 'win32':\n self.libraries = ['gcc','g2c']\n self.library_dirs = self.find_lib_directories()\n else:\n # On linux g77 does not need lib_directories to be specified.\n self.libraries = ['g2c']\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n\n switches = ' -Wall -fno-second-underscore '\n\n if os.name != 'nt':\n switches = switches + ' -fpic '\n\n self.f77_switches = switches\n #self.ver_cmd = self.f77_compiler + ' -v '\n self.ver_cmd = self.f77_compiler + ' --version'\n\n self.f77_opt = self.get_opt()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 -funroll-loops '\n \n # only check for more optimization if g77 can handle\n # it.\n if self.get_version():\n if self.version[0]=='3': # is g77 3.x.x\n if cpu.is_AthlonK6():\n opt = opt + ' -march=k6 '\n elif cpu.is_AthlonK7():\n opt = opt + ' -march=athlon '\n if cpu.is_i686():\n opt = opt + ' -march=i686 '\n elif cpu.is_i586():\n opt = opt + ' -march=i586 '\n elif cpu.is_i486():\n opt = opt + ' -march=i486 '\n elif cpu.is_i386():\n opt = opt + ' -march=i386 '\n if cpu.is_Intel():\n opt = opt + ' -malign-double ' \n return opt\n \n def find_lib_directories(self):\n lib_dir = []\n match = r'Reading specs from (.*)/specs'\n\n # works I think only for unix... \n exit_status, out_text = run_command('g77 -v')\n if not exit_status:\n m = re.findall(match,out_text)\n if m:\n lib_dir= m #m[0] \n return lib_dir\n\n def get_linker_so(self):\n # win32 linking should be handled by standard linker\n if sys.platform != 'win32' and os.uname()[0] != 'Darwin':\n return [self.f77_compiler,'-shared']\n \n def f90_compile(self,source_files,module_files,temp_dir=''):\n raise DistutilsExecError, 'f90 not supported by Gnu'\n\n\n#http://developer.intel.com/software/products/compilers/f50/linux/\nclass intel_ia32_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Intel' # Intel(R) Corporation \n ver_match = r'Intel\\(R\\) Fortran Compiler for 32-bit applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'ifc'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -KPIC '\n\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n if cpu.has_fdiv_bug():\n switches = switches + ' -fdiv_check '\n if cpu.has_f00f_bug():\n switches = switches + ' -0f_check '\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -FI -w90 -w95 '\n\n self.f77_opt = self.f90_opt = self.get_opt()\n \n debug = ' -g -C '\n self.f77_debug = self.f90_debug = debug\n\n self.ver_cmd = self.f77_compiler+' -FI -V -c %s -o %s' %\\\n self.dummy_fortran_files()\n\n def get_opt(self):\n import cpuinfo\n cpu = cpuinfo.cpuinfo()\n opt = ' -O3 '\n if cpu.is_PentiumPro() or cpu.is_PentiumII():\n opt = opt + ' -tpp6 -xi '\n elif cpu.is_PentiumIII():\n opt = opt + ' -tpp6 '\n elif cpu.is_Pentium():\n opt = opt + ' -tpp5 '\n elif cpu.is_PentiumIV():\n opt = opt + ' -tpp7 -xW '\n elif cpu.has_mmx():\n opt = opt + ' -xM '\n return opt\n \n\n def get_linker_so(self):\n return [self.f77_compiler,'-shared']\n\n\nclass intel_itanium_fortran_compiler(intel_ia32_fortran_compiler):\n\n vendor = 'Itanium'\n ver_match = r'Intel\\(R\\) Fortran 90 Compiler Itanium\\(TM\\) Compiler for the Itanium\\(TM\\)-based applications, Version (?P[^\\s*]*)'\n\n def __init__(self, fc = None, f90c = None):\n if fc is None:\n fc = 'efc'\n intel_ia32_fortran_compiler.__init__(self, fc, f90c)\n\n\nclass nag_fortran_compiler(fortran_compiler_base):\n\n vendor = 'NAG'\n ver_match = r'NAGWare Fortran 95 compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'f95'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ''\n debug = ' -g -gline -g90 -nan -C '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_switches = self.f77_switches + ' -fixed '\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -target=native '\n return opt\n\n def get_linker_so(self):\n return [self.f77_compiler,'-Wl,-shared']\n\n# http://www.fortran.com/F/compilers.html\n#\n# We define F compiler here but it is quite useless\n# because it does not support for fixed format sources\n# which makes it impossible to use with f2py generated\n# fixed format wrappers to F90 modules.\nclass f_fortran_compiler(fortran_compiler_base):\n\n vendor = 'F'\n ver_match = r'Fortran Company/NAG F compiler Release (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'F'\n if f90c is None:\n f90c = 'F'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n self.ver_cmd = self.f90_compiler+' -V '\n\n gnu = gnu_fortran_compiler('g77')\n if not gnu.is_available(): # F compiler requires gcc.\n self.version = ''\n return\n if not self.is_available():\n return\n\n print red_text(\"\"\"\nWARNING: F compiler is unsupported due to its incompleteness.\n Send complaints to its vendor. For adding its support\n to scipy_distutils, it must be able to compile\n fixed format Fortran 90.\n\"\"\")\n\n self.f90_switches = ''\n self.f90_debug = ' -g -gline -g90 -C '\n self.f90_opt = ' -O '\n\n #self.f77_switches = gnu.f77_switches\n #self.f77_debug = gnu.f77_debug\n #self.f77_opt = gnu.f77_opt\n\n def get_linker_so(self):\n return ['gcc','-shared']\n\nclass vast_fortran_compiler(fortran_compiler_base):\n\n vendor = 'VAST'\n ver_match = r'\\s*Pacific-Sierra Research vf90 (Personal|Professional)\\s+(?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'g77'\n if f90c is None:\n f90c = 'f90'\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n d,b = os.path.split(f90c)\n vf90 = os.path.join(d,'v'+b)\n self.ver_cmd = vf90+' -v '\n\n gnu = gnu_fortran_compiler(fc)\n if not gnu.is_available(): # VAST compiler requires g77.\n self.version = ''\n return\n if not self.is_available():\n return\n\n self.f77_switches = gnu.f77_switches\n self.f77_debug = gnu.f77_debug\n self.f77_opt = gnu.f77_opt \n\n # XXX: need f90 switches, debug, opt\n\n def get_linker_so(self):\n return [self.f90_compiler,'-shared']\n\nclass compaq_fortran_compiler(fortran_compiler_base):\n\n vendor = 'Compaq'\n ver_match = r'Compaq Fortran (?P[^\\s]*)'\n\n def __init__(self, fc = None, f90c = None):\n fortran_compiler_base.__init__(self)\n\n if fc is None:\n fc = 'fort'\n if f90c is None:\n f90c = fc\n\n self.f77_compiler = fc\n self.f90_compiler = f90c\n\n switches = ' -assume no2underscore -nomixed_str_len_arg '\n debug = ' -g -check_bounds '\n\n self.f77_switches = self.f90_switches = switches\n self.f77_debug = self.f90_debug = debug\n self.f77_opt = self.f90_opt = self.get_opt()\n\n # XXX: uncomment if required\n #self.libraries = ' -lUfor -lfor -lFutil -lcpml -lots -lc '\n\n # XXX: fix the version showing flag\n self.ver_cmd = self.f77_compiler+' -V '\n\n def get_opt(self):\n opt = ' -O4 -align dcommons -arch host -assume bigarrays -assume nozsize -math_library fast -tune host '\n return opt\n\n def get_linker_so(self):\n # XXX: is -shared needed?\n return [self.f77_compiler,'-shared']\n\n\ndef match_extension(files,ext):\n match = re.compile(r'.*[.]('+ext+r')\\Z',re.I).match\n return filter(lambda x,match = match: match(x),files)\n\ndef get_f77_files(files):\n return match_extension(files,'for|f77|ftn|f')\n\ndef get_f90_files(files):\n return match_extension(files,'f90|f95')\n\ndef get_fortran_files(files):\n return match_extension(files,'f90|f95|for|f77|ftn|f')\n\ndef find_fortran_compiler(vendor = None, fc = None, f90c = None):\n fcompiler = None\n for compiler_class in all_compilers:\n if vendor is not None and vendor != compiler_class.vendor:\n continue\n print compiler_class\n compiler = compiler_class(fc,f90c)\n if compiler.is_available():\n fcompiler = compiler\n break\n return fcompiler\n\nall_compilers = [absoft_fortran_compiler,\n mips_fortran_compiler,\n sun_fortran_compiler,\n intel_ia32_fortran_compiler,\n intel_itanium_fortran_compiler,\n nag_fortran_compiler,\n compaq_fortran_compiler,\n vast_fortran_compiler,\n hpux_fortran_compiler,\n f_fortran_compiler,\n gnu_fortran_compiler,\n\n ]\n\nif __name__ == \"__main__\":\n show_compilers()\n", + "methods": [ + { + "name": "run_command", + "long_name": "run_command( command )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 1, + "token_count": 32, + "parameters": [ + "command" + ], + "start_line": 67, + "end_line": 72, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "show_compilers", + "long_name": "show_compilers( )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 3, + "token_count": 26, + "parameters": [], + "start_line": 93, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "initialize_options", + "long_name": "initialize_options( self )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 1, + "token_count": 55, + "parameters": [ + "self" + ], + "start_line": 127, + "end_line": 139, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "finalize_options", + "long_name": "finalize_options( self )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 3, + "token_count": 107, + "parameters": [ + "self" + ], + "start_line": 143, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "has_f_libraries", + "long_name": "has_f_libraries( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 163, + "end_line": 165, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "run", + "long_name": "run( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 167, + "end_line": 170, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "has_f_library", + "long_name": "has_f_library( self , name )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 32, + "parameters": [ + "self", + "name" + ], + "start_line": 174, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "get_library_names", + "long_name": "get_library_names( self , name = None )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 8, + "token_count": 117, + "parameters": [ + "self", + "name" + ], + "start_line": 183, + "end_line": 203, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_names", + "long_name": "get_fcompiler_library_names( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 205, + "end_line": 210, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_dirs", + "long_name": "get_fcompiler_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 212, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self , name = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 109, + "parameters": [ + "self", + "name" + ], + "start_line": 221, + "end_line": 238, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 242, + "end_line": 251, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "get_source_files", + "long_name": "get_source_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 266, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "build_libraries", + "long_name": "build_libraries( self , fortran_libraries )", + "filename": "build_flib.py", + "nloc": 25, + "complexity": 10, + "token_count": 181, + "parameters": [ + "self", + "fortran_libraries" + ], + "start_line": 268, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 33, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , verbose = 0 , dry_run = 0 , force = 0 )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "verbose", + "dry_run", + "force" + ], + "start_line": 314, + "end_line": 337, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "to_object", + "long_name": "to_object( self , dirty_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 16, + "complexity": 3, + "token_count": 89, + "parameters": [ + "self", + "dirty_files", + "module_dirs", + "temp_dir" + ], + "start_line": 339, + "end_line": 354, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "source_to_object_names", + "long_name": "source_to_object_names( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 1, + "token_count": 89, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 356, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "source_and_object_pairs", + "long_name": "source_and_object_pairs( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 363, + "end_line": 366, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f_compile", + "long_name": "f_compile( self , compiler , switches , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 4, + "token_count": 135, + "parameters": [ + "self", + "compiler", + "switches", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 368, + "end_line": 388, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 392, + "end_line": 395, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f77_compile", + "long_name": "f77_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 397, + "end_line": 400, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 403, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "create_static_lib", + "long_name": "create_static_lib( self , object_files , library_name , output_dir = '' , debug = None )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 2, + "token_count": 87, + "parameters": [ + "self", + "object_files", + "library_name", + "output_dir", + "debug" + ], + "start_line": 406, + "end_line": 420, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "build_library", + "long_name": "build_library( self , library_name , source_list , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self", + "library_name", + "source_list", + "module_dirs", + "temp_dir" + ], + "start_line": 422, + "end_line": 450, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "dummy_fortran_files", + "long_name": "dummy_fortran_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 1, + "token_count": 69, + "parameters": [ + "self" + ], + "start_line": 452, + "end_line": 459, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "is_available", + "long_name": "is_available( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 461, + "end_line": 462, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 4, + "token_count": 90, + "parameters": [ + "self" + ], + "start_line": 464, + "end_line": 485, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 1 + }, + { + "name": "get_libraries", + "long_name": "get_libraries( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 487, + "end_line": 488, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 489, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 491, + "end_line": 492, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 493, + "end_line": 494, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 1, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 495, + "end_line": 500, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 502, + "end_line": 503, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 31, + "complexity": 5, + "token_count": 177, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 511, + "end_line": 549, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 39, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 551, + "end_line": 556, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 558, + "end_line": 559, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 98, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 573, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 599, + "end_line": 604, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 99, + "parameters": [ + "self" + ], + "start_line": 606, + "end_line": 620, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 621, + "end_line": 622, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 623, + "end_line": 624, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 94, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 632, + "end_line": 650, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 653, + "end_line": 655, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 656, + "end_line": 658, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 659, + "end_line": 660, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 661, + "end_line": 662, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 87, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 669, + "end_line": 687, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 4, + "token_count": 94, + "parameters": [ + "self" + ], + "start_line": 689, + "end_line": 706, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 714, + "end_line": 739, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 21, + "complexity": 10, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 741, + "end_line": 764, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "find_lib_directories", + "long_name": "find_lib_directories( self )", + "filename": "build_flib.py", + "nloc": 9, + "complexity": 3, + "token_count": 43, + "parameters": [ + "self" + ], + "start_line": 766, + "end_line": 776, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 45, + "parameters": [ + "self" + ], + "start_line": 778, + "end_line": 783, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "source_files", + "module_files", + "temp_dir" + ], + "start_line": 785, + "end_line": 786, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 22, + "complexity": 5, + "token_count": 140, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 795, + "end_line": 823, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 85, + "parameters": [ + "self" + ], + "start_line": 825, + "end_line": 839, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 842, + "end_line": 843, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 851, + "end_line": 854, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 862, + "end_line": 881, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 883, + "end_line": 885, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 887, + "end_line": 888, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 24, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 901, + "end_line": 929, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 935, + "end_line": 936, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 20, + "complexity": 5, + "token_count": 128, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 943, + "end_line": 967, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 971, + "end_line": 972, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 14, + "complexity": 3, + "token_count": 91, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 979, + "end_line": 1001, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 1003, + "end_line": 1005, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 1007, + "end_line": 1009, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "match_extension", + "long_name": "match_extension( files , ext )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 44, + "parameters": [ + "files", + "ext" + ], + "start_line": 1012, + "end_line": 1014, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "get_f77_files", + "long_name": "get_f77_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 1016, + "end_line": 1017, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_f90_files", + "long_name": "get_f90_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 1019, + "end_line": 1020, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_fortran_files", + "long_name": "get_fortran_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 1022, + "end_line": 1023, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "find_fortran_compiler", + "long_name": "find_fortran_compiler( vendor = None , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 5, + "token_count": 59, + "parameters": [ + "vendor", + "fc", + "f90c" + ], + "start_line": 1025, + "end_line": 1035, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "run_command", + "long_name": "run_command( command )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 1, + "token_count": 32, + "parameters": [ + "command" + ], + "start_line": 67, + "end_line": 72, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "show_compilers", + "long_name": "show_compilers( )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 3, + "token_count": 26, + "parameters": [], + "start_line": 93, + "end_line": 97, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "initialize_options", + "long_name": "initialize_options( self )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 1, + "token_count": 55, + "parameters": [ + "self" + ], + "start_line": 127, + "end_line": 139, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "finalize_options", + "long_name": "finalize_options( self )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 3, + "token_count": 107, + "parameters": [ + "self" + ], + "start_line": 143, + "end_line": 159, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "has_f_libraries", + "long_name": "has_f_libraries( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 2, + "token_count": 23, + "parameters": [ + "self" + ], + "start_line": 163, + "end_line": 165, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "run", + "long_name": "run( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 22, + "parameters": [ + "self" + ], + "start_line": 167, + "end_line": 170, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "has_f_library", + "long_name": "has_f_library( self , name )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 32, + "parameters": [ + "self", + "name" + ], + "start_line": 174, + "end_line": 181, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "get_library_names", + "long_name": "get_library_names( self , name = None )", + "filename": "build_flib.py", + "nloc": 17, + "complexity": 8, + "token_count": 117, + "parameters": [ + "self", + "name" + ], + "start_line": 183, + "end_line": 203, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_names", + "long_name": "get_fcompiler_library_names( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 205, + "end_line": 210, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_fcompiler_library_dirs", + "long_name": "get_fcompiler_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 24, + "parameters": [ + "self" + ], + "start_line": 212, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self , name = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 109, + "parameters": [ + "self", + "name" + ], + "start_line": 221, + "end_line": 238, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 242, + "end_line": 251, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 10, + "top_nesting_level": 1 + }, + { + "name": "get_source_files", + "long_name": "get_source_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self" + ], + "start_line": 255, + "end_line": 266, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 12, + "top_nesting_level": 1 + }, + { + "name": "build_libraries", + "long_name": "build_libraries( self , fortran_libraries )", + "filename": "build_flib.py", + "nloc": 25, + "complexity": 10, + "token_count": 181, + "parameters": [ + "self", + "fortran_libraries" + ], + "start_line": 268, + "end_line": 300, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 33, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , verbose = 0 , dry_run = 0 , force = 0 )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "verbose", + "dry_run", + "force" + ], + "start_line": 314, + "end_line": 337, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "to_object", + "long_name": "to_object( self , dirty_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 16, + "complexity": 3, + "token_count": 89, + "parameters": [ + "self", + "dirty_files", + "module_dirs", + "temp_dir" + ], + "start_line": 339, + "end_line": 354, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 16, + "top_nesting_level": 1 + }, + { + "name": "source_to_object_names", + "long_name": "source_to_object_names( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 1, + "token_count": 89, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 356, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "source_and_object_pairs", + "long_name": "source_and_object_pairs( self , source_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 31, + "parameters": [ + "self", + "source_files", + "temp_dir" + ], + "start_line": 363, + "end_line": 366, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f_compile", + "long_name": "f_compile( self , compiler , switches , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 4, + "token_count": 135, + "parameters": [ + "self", + "compiler", + "switches", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 368, + "end_line": 388, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 21, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 392, + "end_line": 395, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f77_compile", + "long_name": "f77_compile( self , source_files , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 1, + "token_count": 48, + "parameters": [ + "self", + "source_files", + "module_dirs", + "temp_dir" + ], + "start_line": 397, + "end_line": 400, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 403, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "create_static_lib", + "long_name": "create_static_lib( self , object_files , library_name , output_dir = '' , debug = None )", + "filename": "build_flib.py", + "nloc": 12, + "complexity": 2, + "token_count": 87, + "parameters": [ + "self", + "object_files", + "library_name", + "output_dir", + "debug" + ], + "start_line": 406, + "end_line": 420, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "build_library", + "long_name": "build_library( self , library_name , source_list , module_dirs = None , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 104, + "parameters": [ + "self", + "library_name", + "source_list", + "module_dirs", + "temp_dir" + ], + "start_line": 422, + "end_line": 450, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "dummy_fortran_files", + "long_name": "dummy_fortran_files( self )", + "filename": "build_flib.py", + "nloc": 8, + "complexity": 1, + "token_count": 69, + "parameters": [ + "self" + ], + "start_line": 452, + "end_line": 459, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "is_available", + "long_name": "is_available( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 461, + "end_line": 462, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 4, + "token_count": 90, + "parameters": [ + "self" + ], + "start_line": 464, + "end_line": 485, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 1 + }, + { + "name": "get_libraries", + "long_name": "get_libraries( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 487, + "end_line": 488, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_library_dirs", + "long_name": "get_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 489, + "end_line": 490, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 491, + "end_line": 492, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 493, + "end_line": 494, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 1, + "complexity": 1, + "token_count": 6, + "parameters": [ + "self" + ], + "start_line": 495, + "end_line": 500, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "__str__", + "long_name": "__str__( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 502, + "end_line": 503, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 31, + "complexity": 5, + "token_count": 177, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 511, + "end_line": 549, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 39, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 551, + "end_line": 556, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 558, + "end_line": 559, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 98, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 573, + "end_line": 596, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 6, + "complexity": 3, + "token_count": 27, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 599, + "end_line": 604, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 99, + "parameters": [ + "self" + ], + "start_line": 606, + "end_line": 620, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 621, + "end_line": 622, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 9, + "parameters": [ + "self" + ], + "start_line": 623, + "end_line": 624, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 94, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 632, + "end_line": 650, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "build_module_switch", + "long_name": "build_module_switch( self , module_dirs )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 12, + "parameters": [ + "self", + "module_dirs" + ], + "start_line": 653, + "end_line": 655, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "find_lib_dir", + "long_name": "find_lib_dir( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 656, + "end_line": 658, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_runtime_library_dirs", + "long_name": "get_runtime_library_dirs( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 659, + "end_line": 660, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_extra_link_args", + "long_name": "get_extra_link_args( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self" + ], + "start_line": 661, + "end_line": 662, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 87, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 669, + "end_line": 687, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 19, + "top_nesting_level": 1 + }, + { + "name": "get_version", + "long_name": "get_version( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 4, + "token_count": 94, + "parameters": [ + "self" + ], + "start_line": 689, + "end_line": 706, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 18, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 18, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 714, + "end_line": 739, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 26, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 21, + "complexity": 10, + "token_count": 120, + "parameters": [ + "self" + ], + "start_line": 741, + "end_line": 764, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 24, + "top_nesting_level": 1 + }, + { + "name": "find_lib_directories", + "long_name": "find_lib_directories( self )", + "filename": "build_flib.py", + "nloc": 9, + "complexity": 3, + "token_count": 43, + "parameters": [ + "self" + ], + "start_line": 766, + "end_line": 776, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 3, + "token_count": 31, + "parameters": [ + "self" + ], + "start_line": 778, + "end_line": 781, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "f90_compile", + "long_name": "f90_compile( self , source_files , module_files , temp_dir = '' )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 17, + "parameters": [ + "self", + "source_files", + "module_files", + "temp_dir" + ], + "start_line": 783, + "end_line": 784, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 22, + "complexity": 5, + "token_count": 140, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 793, + "end_line": 821, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 7, + "token_count": 85, + "parameters": [ + "self" + ], + "start_line": 823, + "end_line": 837, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 15, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 840, + "end_line": 841, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 4, + "complexity": 2, + "token_count": 31, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 849, + "end_line": 852, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 15, + "complexity": 3, + "token_count": 100, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 860, + "end_line": 879, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 881, + "end_line": 883, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 885, + "end_line": 886, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 24, + "complexity": 5, + "token_count": 103, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 899, + "end_line": 927, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 29, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 933, + "end_line": 934, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 20, + "complexity": 5, + "token_count": 128, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 941, + "end_line": 965, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 25, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 969, + "end_line": 970, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 14, + "complexity": 3, + "token_count": 91, + "parameters": [ + "self", + "fc", + "f90c" + ], + "start_line": 977, + "end_line": 999, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "get_opt", + "long_name": "get_opt( self )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 10, + "parameters": [ + "self" + ], + "start_line": 1001, + "end_line": 1003, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 13, + "parameters": [ + "self" + ], + "start_line": 1005, + "end_line": 1007, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 1 + }, + { + "name": "match_extension", + "long_name": "match_extension( files , ext )", + "filename": "build_flib.py", + "nloc": 3, + "complexity": 1, + "token_count": 44, + "parameters": [ + "files", + "ext" + ], + "start_line": 1010, + "end_line": 1012, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "get_f77_files", + "long_name": "get_f77_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 1014, + "end_line": 1015, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_f90_files", + "long_name": "get_f90_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 1017, + "end_line": 1018, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "get_fortran_files", + "long_name": "get_fortran_files( files )", + "filename": "build_flib.py", + "nloc": 2, + "complexity": 1, + "token_count": 12, + "parameters": [ + "files" + ], + "start_line": 1020, + "end_line": 1021, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 0 + }, + { + "name": "find_fortran_compiler", + "long_name": "find_fortran_compiler( vendor = None , fc = None , f90c = None )", + "filename": "build_flib.py", + "nloc": 11, + "complexity": 5, + "token_count": 59, + "parameters": [ + "vendor", + "fc", + "f90c" + ], + "start_line": 1023, + "end_line": 1033, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 11, + "top_nesting_level": 0 + } + ], + "changed_methods": [ + { + "name": "get_linker_so", + "long_name": "get_linker_so( self )", + "filename": "build_flib.py", + "nloc": 5, + "complexity": 4, + "token_count": 45, + "parameters": [ + "self" + ], + "start_line": 778, + "end_line": 783, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + } + ], + "nloc": 751, + "complexity": 185, + "token_count": 4354, + "diff_parsed": { + "added": [ + " if ((sys.platform != 'win32') and", + " (sys.platform != 'cygwin') and", + " (os.uname()[0] != 'Darwin')):" + ], + "deleted": [ + " if sys.platform != 'win32' and os.uname()[0] != 'Darwin':" + ] + } + }, + { + "old_path": "scipy_distutils/system_info.py", + "new_path": "scipy_distutils/system_info.py", + "filename": "system_info.py", + "extension": "py", + "change_type": "MODIFY", + "diff": "@@ -30,8 +30,8 @@\n Example:\n ----------\n [DEFAULT]\n-lib_dir = /usr/lib:/usr/local/lib:/opt/lib\n-include_dir = /usr/include:/usr/local/include:/opt/include\n+library_dirs = /usr/lib:/usr/local/lib:/opt/lib\n+include_dirs = /usr/include:/usr/local/include:/opt/include\n # use static libraries in preference to shared ones\n static_first = 1\n \n@@ -41,14 +41,14 @@\n # if the above aren't found, look for {s,d}fftw_libs and {s,d}fftw_opt_libs\n \n [atlas]\n-lib_dir = /usr/lib/3dnow:/usr/lib/3dnow/atlas\n+library_dirs = /usr/lib/3dnow:/usr/lib/3dnow/atlas\n # for overriding the names of the atlas libraries\n atlas_libs = f77blas, cblas, atlas\n lapack_libs = lapack\n \n [x11]\n-lib_dir = /usr/X11R6/lib\n-include_dir = /usr/X11R6/include\n+library_dirs = /usr/X11R6/lib\n+include_dirs = /usr/X11R6/include\n ----------\n \n Authors:\n@@ -146,8 +146,8 @@ def __init__ (self,\n self.__class__.info = {}\n self.local_prefixes = []\n defaults = {}\n- defaults['lib_dir'] = os.pathsep.join(default_lib_dirs)\n- defaults['include_dir'] = os.pathsep.join(default_include_dirs)\n+ defaults['library_dirs'] = os.pathsep.join(default_lib_dirs)\n+ defaults['include_dirs'] = os.pathsep.join(default_include_dirs)\n defaults['static_first'] = '1'\n self.cp = ConfigParser.ConfigParser(defaults)\n cf = os.path.join(os.path.split(os.path.abspath(__file__))[0],\n@@ -194,9 +194,9 @@ def get_paths(self, section, key):\n dirs.extend(default_dirs)\n return [ d for d in dirs if os.path.isdir(d) ]\n \n- def get_lib_dirs(self, key='lib_dir'):\n+ def get_lib_dirs(self, key='library_dirs'):\n return self.get_paths(self.section, key)\n- def get_include_dirs(self, key='include_dir'):\n+ def get_include_dirs(self, key='include_dirs'):\n return self.get_paths(self.section, key)\n \n def get_libs(self, key, default):\n", + "added_lines": 9, + "deleted_lines": 9, + "source_code": "#!/usr/bin/env python\n\"\"\"\nThis file defines a set of system_info classes for getting\ninformation about various resources (libraries, library directories,\ninclude directories, etc.) in the system. Currently, the following\nclasses are available:\n atlas_info\n fftw_info\n x11_info\n\nUsage:\n info_dict = get_info()\n where is a string 'atlas','x11','fftw'.\n\n Returned info_dict is a dictionary which is compatible with\n distutils.setup keyword arguments. If info_dict == {}, then the\n asked resource is not available (or system_info could not find it).\n\nGlobal parameters:\n system_info.static_first - a flag for indicating that static\n libraries are searched first than shared ones.\n system_info.verbose - show the results if set.\n\nThe file 'site.cfg' in the same directory as this module is read\nfor configuration options. The format is that used by ConfigParser (i.e.,\nWindows .INI style). The section DEFAULT has options that are the default\nfor each section. The available sections are fftw, atlas, and x11. Appropiate\ndefaults are used if nothing is specified.\n\nExample:\n----------\n[DEFAULT]\nlibrary_dirs = /usr/lib:/usr/local/lib:/opt/lib\ninclude_dirs = /usr/include:/usr/local/include:/opt/include\n# use static libraries in preference to shared ones\nstatic_first = 1\n\n[fftw]\nfftw_libs = fftw, rfftw\nfftw_opt_libs = fftw_threaded, rfftw_threaded\n# if the above aren't found, look for {s,d}fftw_libs and {s,d}fftw_opt_libs\n\n[atlas]\nlibrary_dirs = /usr/lib/3dnow:/usr/lib/3dnow/atlas\n# for overriding the names of the atlas libraries\natlas_libs = f77blas, cblas, atlas\nlapack_libs = lapack\n\n[x11]\nlibrary_dirs = /usr/X11R6/lib\ninclude_dirs = /usr/X11R6/include\n----------\n\nAuthors:\n Pearu Peterson , February 2002\n David M. Cooke , April 2002\n\nCopyright 2002 Pearu Peterson all rights reserved,\nPearu Peterson \nPermission to use, modify, and distribute this software is given under the \nterms of the SciPy (BSD style) license. See LICENSE.txt that came with\nthis distribution for specifics.\n\nNO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n\"\"\"\n\nimport sys,os,re,types\nfrom distutils.errors import DistutilsError\nfrom glob import glob\nimport ConfigParser\n\nfrom distutils.sysconfig import get_config_vars\n\nif sys.platform == 'win32':\n default_lib_dirs = ['C:\\\\'] # probably not very helpful...\n default_include_dirs = []\n default_x11_lib_dirs = []\n default_x11_include_dirs = []\nelse:\n default_lib_dirs = ['/usr/local/lib', '/opt/lib', '/usr/lib']\n default_include_dirs = ['/usr/local/include',\n '/opt/include', '/usr/include']\n default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib']\n default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include']\n\nif os.path.join(sys.prefix, 'lib') not in default_lib_dirs:\n default_lib_dirs.insert(0,os.path.join(sys.prefix, 'lib'))\n# default_lib_dirs.append(os.path.join(sys.prefix, 'lib'))\n default_include_dirs.append(os.path.join(sys.prefix, 'include'))\ndefault_lib_dirs = filter(os.path.isdir, default_lib_dirs)\ndefault_include_dirs = filter(os.path.isdir, default_include_dirs)\n\nso_ext = get_config_vars('SO')[0] or ''\n\ndef get_info(name):\n cl = {'atlas':atlas_info,\n 'x11':x11_info,\n 'fftw':fftw_info}.get(name.lower(),system_info)\n return cl().get_info()\n\nclass NotFoundError(DistutilsError):\n \"\"\"Some third-party program or library is not found.\"\"\"\n\nclass AtlasNotFoundError(NotFoundError):\n \"\"\"\n Atlas (http://math-atlas.sourceforge.net/) libraries not found.\n Either install them in /usr/local/lib/atlas or /usr/lib/atlas\n and retry setup.py. One can use also ATLAS environment variable\n to indicate the location of Atlas libraries.\"\"\"\n\nclass FFTWNotFoundError(NotFoundError):\n \"\"\"\n FFTW (http://www.fftw.org/) libraries not found.\n Either install them in /usr/local/lib or /usr/lib and retry setup.py.\n One can use also FFTW environment variable to indicate\n the location of FFTW libraries.\"\"\"\n\nclass F2pyNotFoundError(NotFoundError):\n \"\"\"\n f2py2e (http://cens.ioc.ee/projects/f2py2e/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass NumericNotFoundError(NotFoundError):\n \"\"\"\n Numeric (http://www.numpy.org/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass X11NotFoundError(NotFoundError):\n \"\"\"X11 libraries not found.\"\"\"\n\nclass system_info:\n\n \"\"\" get_info() is the only public method. Don't use others.\n \"\"\"\n section = 'DEFAULT'\n\n static_first = 1\n verbose = 1\n need_refresh = 1\n saved_results = {}\n\n def __init__ (self,\n default_lib_dirs=default_lib_dirs,\n default_include_dirs=default_include_dirs,\n ):\n self.__class__.info = {}\n self.local_prefixes = []\n defaults = {}\n defaults['library_dirs'] = os.pathsep.join(default_lib_dirs)\n defaults['include_dirs'] = os.pathsep.join(default_include_dirs)\n defaults['static_first'] = '1'\n self.cp = ConfigParser.ConfigParser(defaults)\n cf = os.path.join(os.path.split(os.path.abspath(__file__))[0],\n 'site.cfg')\n self.cp.read([cf])\n if not self.cp.has_section(self.section):\n self.cp.add_section(self.section)\n self.static_first = self.cp.getboolean(self.section, 'static_first')\n\n def set_info(self,**info):\n self.saved_results[self.__class__.__name__] = info\n def has_info(self):\n return self.saved_results.has_key(self.__class__.__name__)\n def get_info(self):\n \"\"\" Return a dictonary with items that are compatible\n with scipy_distutils.setup keyword arguments.\n \"\"\"\n flag = 0\n if not self.has_info():\n flag = 1\n if self.verbose:\n print self.__class__.__name__ + ':'\n if hasattr(self, 'calc_info'):\n self.calc_info()\n if self.verbose:\n if not self.has_info():\n print ' NOT AVAILABLE'\n self.set_info()\n else:\n print ' FOUND:'\n res = self.saved_results.get(self.__class__.__name__)\n if self.verbose and flag:\n for k,v in res.items():\n print ' %s = %s'%(k,v)\n print\n return res\n\n def calc_info_template(self,prefix):\n \"\"\" Calculate info dictionary. \"\"\"\n\n def get_paths(self, section, key):\n dirs = self.cp.get(section, key).split(os.pathsep)\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs.extend(default_dirs)\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def get_lib_dirs(self, key='library_dirs'):\n return self.get_paths(self.section, key)\n def get_include_dirs(self, key='include_dirs'):\n return self.get_paths(self.section, key)\n\n def get_libs(self, key, default):\n try:\n libs = self.cp.get(self.section, key)\n except ConfigParser.NoOptionError:\n return default\n return [a.strip() for a in libs.split(',')]\n\n def check_libs(self,lib_dir,libs,opt_libs =[]):\n \"\"\" If static or shared libraries are available then return\n their info dictionary. \"\"\"\n mths = [self.check_static_libs,self.check_shared_libs]\n if not self.static_first:\n mths.reverse() # if one prefers shared libraries\n for m in mths:\n info = m(lib_dir,libs,opt_libs)\n if info is not None: return info\n\n def check_static_libs(self,lib_dir,libs,opt_libs =[]):\n #XXX: what are .lib and .dll files under win32?\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs])) == len(libs):\n info = {'libraries':libs,'library_dirs':[lib_dir]}\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs]))\\\n ==len(opt_libs):\n info['libraries'].extend(opt_libs)\n return info\n\n def check_shared_libs(self,lib_dir,libs,opt_libs =[]):\n shared_libs = []\n for l in libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: shared_libs.append(p)\n if len(shared_libs) == len(libs):\n info = {'extra_objects':shared_libs}\n opt_shared_libs = []\n for l in opt_libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: opt_shared_libs.append(p)\n info['extra_objects'].extend(opt_shared_libs)\n return info\n\n\nclass fftw_info(system_info):\n section = 'fftw'\n\n def __init__(self):\n system_info.__init__(self)\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n incl_dirs = self.get_include_dirs()\n incl_dir = None\n\n libs = self.get_libs('fftw_libs', ['fftw','rfftw'])\n opt_libs = self.get_libs('fftw_opt_libs',\n ['fftw_threads','rfftw_threads'])\n info = None\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['fftw.h','rfftw.h']))==2:\n dict_append(info,include_dirs=[d])\n flag = 1\n incl_dirs = [d]\n incl_dir = d\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_FFTW_H',1)])\n else:\n info = None\n\n if info is None:\n libs = self.get_libs('dfftw_libs', ['dfftw', 'drfftw'])\n opt_libs = self.get_libs('dfftw_opt_libs',\n ['dfftw_threads', 'drfftw_threads'])\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['dfftw.h','drfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n incl_dirs = [d]\n incl_dir = d\n flag = 1\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_DFFTW_H',1)])\n else:\n info = None\n\n libs = self.get_libs('sfftw_libs', ['sfftw', 'srfftw'])\n opt_libs = self.get_libs('sfftw_opt_libs',\n ['sfftw_threads', 'srfftw_threads'])\n flag = 0\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n if info is None: info = r\n else: dict_append(info,**r)\n flag = 1\n break\n if info is not None and flag:\n for d in incl_dirs:\n if len(combine_paths(d,['sfftw.h','srfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n dict_append(info,define_macros=[('SCIPY_SFFTW_H',1)])\n break\n if info is not None:\n self.set_info(**info)\n\n\nclass atlas_info(system_info):\n section = 'atlas'\n\n def get_paths(self, section, key):\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n if os.environ.has_key('ATLAS'):\n default_dirs.append(os.environ['ATLAS'])\n dirs = []\n for d in self.cp.get(section, key).split(os.pathsep) + default_dirs:\n dirs.extend([d]+combine_paths(d,['atlas*','ATLAS*']))\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n\n h = (combine_paths(lib_dirs+include_dirs,'cblas.h') or [None])[0]\n if h: h = os.path.dirname(h)\n info = None\n # lapack must appear before atlas\n lapack_libs = self.get_libs('lapack_libs', ['lapack'])\n for d in lib_dirs:\n lapack = self.check_libs(d,lapack_libs,[])\n if lapack is not None:\n info = lapack \n break\n else:\n return\n atlas_libs = self.get_libs('atlas_libs', ['f77blas', 'cblas', 'atlas'])\n for d in lib_dirs:\n atlas = self.check_libs(d,atlas_libs,[])\n if atlas is not None:\n dict_append(info, **atlas)\n break\n else:\n return\n\n if h: dict_append(info,include_dirs=[h])\n self.set_info(**info)\n\n## class blas_info(system_info):\n## # For Fortran or optimized blas, not atlas.\n## pass\n\n\n## class lapack_info(system_info):\n## # For Fortran or optimized lapack, not atlas\n## pass\n\n\nclass x11_info(system_info):\n section = 'x11'\n\n def __init__(self):\n system_info.__init__(self,\n default_lib_dirs=default_x11_lib_dirs,\n default_include_dirs=default_x11_include_dirs)\n\n def calc_info(self):\n if sys.platform == 'win32':\n return\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n x11_libs = self.get_libs('x11_libs', ['X11'])\n for lib_dir in lib_dirs:\n info = self.check_libs(lib_dir, x11_libs, [])\n if info is not None:\n break\n else:\n return\n inc_dir = None\n for d in include_dirs:\n if combine_paths(d, 'X11/X.h'):\n inc_dir = d\n break\n if inc_dir is not None:\n dict_append(info, include_dirs=[inc_dir])\n self.set_info(**info)\n\ndef shortest_path(pths):\n pths.sort()\n if pths: return pths[0]\n\ndef combine_paths(*args):\n \"\"\" Return a list of existing paths composed by all combinations of\n items from arguments.\n \"\"\"\n r = []\n for a in args:\n if not a: continue\n if type(a) is types.StringType:\n a = [a]\n r.append(a)\n args = r\n if not args: return []\n if len(args)==1:\n result = reduce(lambda a,b:a+b,map(glob,args[0]),[])\n elif len (args)==2:\n result = []\n for a0 in args[0]:\n for a1 in args[1]:\n result.extend(glob(os.path.join(a0,a1)))\n else:\n result = combine_paths(*(combine_paths(args[0],args[1])+args[2:]))\n return result\n\ndef dict_append(d,**kws):\n for k,v in kws.items():\n if d.has_key(k):\n d[k].extend(v)\n else:\n d[k] = v\n\ndef show_all():\n import system_info\n import pprint\n match_info = re.compile(r'.*?_info').match\n for n in filter(match_info,dir(system_info)):\n if n in ['system_info','get_info']: continue\n c = getattr(system_info,n)()\n r = c.get_info()\n\nif __name__ == \"__main__\":\n show_all()\n", + "source_code_before": "#!/usr/bin/env python\n\"\"\"\nThis file defines a set of system_info classes for getting\ninformation about various resources (libraries, library directories,\ninclude directories, etc.) in the system. Currently, the following\nclasses are available:\n atlas_info\n fftw_info\n x11_info\n\nUsage:\n info_dict = get_info()\n where is a string 'atlas','x11','fftw'.\n\n Returned info_dict is a dictionary which is compatible with\n distutils.setup keyword arguments. If info_dict == {}, then the\n asked resource is not available (or system_info could not find it).\n\nGlobal parameters:\n system_info.static_first - a flag for indicating that static\n libraries are searched first than shared ones.\n system_info.verbose - show the results if set.\n\nThe file 'site.cfg' in the same directory as this module is read\nfor configuration options. The format is that used by ConfigParser (i.e.,\nWindows .INI style). The section DEFAULT has options that are the default\nfor each section. The available sections are fftw, atlas, and x11. Appropiate\ndefaults are used if nothing is specified.\n\nExample:\n----------\n[DEFAULT]\nlib_dir = /usr/lib:/usr/local/lib:/opt/lib\ninclude_dir = /usr/include:/usr/local/include:/opt/include\n# use static libraries in preference to shared ones\nstatic_first = 1\n\n[fftw]\nfftw_libs = fftw, rfftw\nfftw_opt_libs = fftw_threaded, rfftw_threaded\n# if the above aren't found, look for {s,d}fftw_libs and {s,d}fftw_opt_libs\n\n[atlas]\nlib_dir = /usr/lib/3dnow:/usr/lib/3dnow/atlas\n# for overriding the names of the atlas libraries\natlas_libs = f77blas, cblas, atlas\nlapack_libs = lapack\n\n[x11]\nlib_dir = /usr/X11R6/lib\ninclude_dir = /usr/X11R6/include\n----------\n\nAuthors:\n Pearu Peterson , February 2002\n David M. Cooke , April 2002\n\nCopyright 2002 Pearu Peterson all rights reserved,\nPearu Peterson \nPermission to use, modify, and distribute this software is given under the \nterms of the SciPy (BSD style) license. See LICENSE.txt that came with\nthis distribution for specifics.\n\nNO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\n\"\"\"\n\nimport sys,os,re,types\nfrom distutils.errors import DistutilsError\nfrom glob import glob\nimport ConfigParser\n\nfrom distutils.sysconfig import get_config_vars\n\nif sys.platform == 'win32':\n default_lib_dirs = ['C:\\\\'] # probably not very helpful...\n default_include_dirs = []\n default_x11_lib_dirs = []\n default_x11_include_dirs = []\nelse:\n default_lib_dirs = ['/usr/local/lib', '/opt/lib', '/usr/lib']\n default_include_dirs = ['/usr/local/include',\n '/opt/include', '/usr/include']\n default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib']\n default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include']\n\nif os.path.join(sys.prefix, 'lib') not in default_lib_dirs:\n default_lib_dirs.insert(0,os.path.join(sys.prefix, 'lib'))\n# default_lib_dirs.append(os.path.join(sys.prefix, 'lib'))\n default_include_dirs.append(os.path.join(sys.prefix, 'include'))\ndefault_lib_dirs = filter(os.path.isdir, default_lib_dirs)\ndefault_include_dirs = filter(os.path.isdir, default_include_dirs)\n\nso_ext = get_config_vars('SO')[0] or ''\n\ndef get_info(name):\n cl = {'atlas':atlas_info,\n 'x11':x11_info,\n 'fftw':fftw_info}.get(name.lower(),system_info)\n return cl().get_info()\n\nclass NotFoundError(DistutilsError):\n \"\"\"Some third-party program or library is not found.\"\"\"\n\nclass AtlasNotFoundError(NotFoundError):\n \"\"\"\n Atlas (http://math-atlas.sourceforge.net/) libraries not found.\n Either install them in /usr/local/lib/atlas or /usr/lib/atlas\n and retry setup.py. One can use also ATLAS environment variable\n to indicate the location of Atlas libraries.\"\"\"\n\nclass FFTWNotFoundError(NotFoundError):\n \"\"\"\n FFTW (http://www.fftw.org/) libraries not found.\n Either install them in /usr/local/lib or /usr/lib and retry setup.py.\n One can use also FFTW environment variable to indicate\n the location of FFTW libraries.\"\"\"\n\nclass F2pyNotFoundError(NotFoundError):\n \"\"\"\n f2py2e (http://cens.ioc.ee/projects/f2py2e/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass NumericNotFoundError(NotFoundError):\n \"\"\"\n Numeric (http://www.numpy.org/) module not found.\n Get it from above location, install it, and retry setup.py.\"\"\"\n\nclass X11NotFoundError(NotFoundError):\n \"\"\"X11 libraries not found.\"\"\"\n\nclass system_info:\n\n \"\"\" get_info() is the only public method. Don't use others.\n \"\"\"\n section = 'DEFAULT'\n\n static_first = 1\n verbose = 1\n need_refresh = 1\n saved_results = {}\n\n def __init__ (self,\n default_lib_dirs=default_lib_dirs,\n default_include_dirs=default_include_dirs,\n ):\n self.__class__.info = {}\n self.local_prefixes = []\n defaults = {}\n defaults['lib_dir'] = os.pathsep.join(default_lib_dirs)\n defaults['include_dir'] = os.pathsep.join(default_include_dirs)\n defaults['static_first'] = '1'\n self.cp = ConfigParser.ConfigParser(defaults)\n cf = os.path.join(os.path.split(os.path.abspath(__file__))[0],\n 'site.cfg')\n self.cp.read([cf])\n if not self.cp.has_section(self.section):\n self.cp.add_section(self.section)\n self.static_first = self.cp.getboolean(self.section, 'static_first')\n\n def set_info(self,**info):\n self.saved_results[self.__class__.__name__] = info\n def has_info(self):\n return self.saved_results.has_key(self.__class__.__name__)\n def get_info(self):\n \"\"\" Return a dictonary with items that are compatible\n with scipy_distutils.setup keyword arguments.\n \"\"\"\n flag = 0\n if not self.has_info():\n flag = 1\n if self.verbose:\n print self.__class__.__name__ + ':'\n if hasattr(self, 'calc_info'):\n self.calc_info()\n if self.verbose:\n if not self.has_info():\n print ' NOT AVAILABLE'\n self.set_info()\n else:\n print ' FOUND:'\n res = self.saved_results.get(self.__class__.__name__)\n if self.verbose and flag:\n for k,v in res.items():\n print ' %s = %s'%(k,v)\n print\n return res\n\n def calc_info_template(self,prefix):\n \"\"\" Calculate info dictionary. \"\"\"\n\n def get_paths(self, section, key):\n dirs = self.cp.get(section, key).split(os.pathsep)\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n dirs.extend(default_dirs)\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def get_lib_dirs(self, key='lib_dir'):\n return self.get_paths(self.section, key)\n def get_include_dirs(self, key='include_dir'):\n return self.get_paths(self.section, key)\n\n def get_libs(self, key, default):\n try:\n libs = self.cp.get(self.section, key)\n except ConfigParser.NoOptionError:\n return default\n return [a.strip() for a in libs.split(',')]\n\n def check_libs(self,lib_dir,libs,opt_libs =[]):\n \"\"\" If static or shared libraries are available then return\n their info dictionary. \"\"\"\n mths = [self.check_static_libs,self.check_shared_libs]\n if not self.static_first:\n mths.reverse() # if one prefers shared libraries\n for m in mths:\n info = m(lib_dir,libs,opt_libs)\n if info is not None: return info\n\n def check_static_libs(self,lib_dir,libs,opt_libs =[]):\n #XXX: what are .lib and .dll files under win32?\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs])) == len(libs):\n info = {'libraries':libs,'library_dirs':[lib_dir]}\n if len(combine_paths(lib_dir,['lib'+l+'.a' for l in libs]))\\\n ==len(opt_libs):\n info['libraries'].extend(opt_libs)\n return info\n\n def check_shared_libs(self,lib_dir,libs,opt_libs =[]):\n shared_libs = []\n for l in libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: shared_libs.append(p)\n if len(shared_libs) == len(libs):\n info = {'extra_objects':shared_libs}\n opt_shared_libs = []\n for l in opt_libs:\n p = shortest_path(combine_paths(lib_dir,'lib'+l+so_ext+'*'))\n if p is not None: opt_shared_libs.append(p)\n info['extra_objects'].extend(opt_shared_libs)\n return info\n\n\nclass fftw_info(system_info):\n section = 'fftw'\n\n def __init__(self):\n system_info.__init__(self)\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n incl_dirs = self.get_include_dirs()\n incl_dir = None\n\n libs = self.get_libs('fftw_libs', ['fftw','rfftw'])\n opt_libs = self.get_libs('fftw_opt_libs',\n ['fftw_threads','rfftw_threads'])\n info = None\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['fftw.h','rfftw.h']))==2:\n dict_append(info,include_dirs=[d])\n flag = 1\n incl_dirs = [d]\n incl_dir = d\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_FFTW_H',1)])\n else:\n info = None\n\n if info is None:\n libs = self.get_libs('dfftw_libs', ['dfftw', 'drfftw'])\n opt_libs = self.get_libs('dfftw_opt_libs',\n ['dfftw_threads', 'drfftw_threads'])\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n info = r\n break\n if info is not None:\n flag = 0\n for d in incl_dirs:\n if len(combine_paths(d,['dfftw.h','drfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n incl_dirs = [d]\n incl_dir = d\n flag = 1\n break\n if flag:\n dict_append(info,define_macros=[('SCIPY_DFFTW_H',1)])\n else:\n info = None\n\n libs = self.get_libs('sfftw_libs', ['sfftw', 'srfftw'])\n opt_libs = self.get_libs('sfftw_opt_libs',\n ['sfftw_threads', 'srfftw_threads'])\n flag = 0\n for d in lib_dirs:\n r = self.check_libs(d,libs,opt_libs)\n if r is not None:\n if info is None: info = r\n else: dict_append(info,**r)\n flag = 1\n break\n if info is not None and flag:\n for d in incl_dirs:\n if len(combine_paths(d,['sfftw.h','srfftw.h']))==2:\n if incl_dir is None:\n dict_append(info,include_dirs=[d])\n dict_append(info,define_macros=[('SCIPY_SFFTW_H',1)])\n break\n if info is not None:\n self.set_info(**info)\n\n\nclass atlas_info(system_info):\n section = 'atlas'\n\n def get_paths(self, section, key):\n default_dirs = self.cp.get('DEFAULT', key).split(os.pathsep)\n if os.environ.has_key('ATLAS'):\n default_dirs.append(os.environ['ATLAS'])\n dirs = []\n for d in self.cp.get(section, key).split(os.pathsep) + default_dirs:\n dirs.extend([d]+combine_paths(d,['atlas*','ATLAS*']))\n return [ d for d in dirs if os.path.isdir(d) ]\n\n def calc_info(self):\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n\n h = (combine_paths(lib_dirs+include_dirs,'cblas.h') or [None])[0]\n if h: h = os.path.dirname(h)\n info = None\n # lapack must appear before atlas\n lapack_libs = self.get_libs('lapack_libs', ['lapack'])\n for d in lib_dirs:\n lapack = self.check_libs(d,lapack_libs,[])\n if lapack is not None:\n info = lapack \n break\n else:\n return\n atlas_libs = self.get_libs('atlas_libs', ['f77blas', 'cblas', 'atlas'])\n for d in lib_dirs:\n atlas = self.check_libs(d,atlas_libs,[])\n if atlas is not None:\n dict_append(info, **atlas)\n break\n else:\n return\n\n if h: dict_append(info,include_dirs=[h])\n self.set_info(**info)\n\n## class blas_info(system_info):\n## # For Fortran or optimized blas, not atlas.\n## pass\n\n\n## class lapack_info(system_info):\n## # For Fortran or optimized lapack, not atlas\n## pass\n\n\nclass x11_info(system_info):\n section = 'x11'\n\n def __init__(self):\n system_info.__init__(self,\n default_lib_dirs=default_x11_lib_dirs,\n default_include_dirs=default_x11_include_dirs)\n\n def calc_info(self):\n if sys.platform == 'win32':\n return\n lib_dirs = self.get_lib_dirs()\n include_dirs = self.get_include_dirs()\n x11_libs = self.get_libs('x11_libs', ['X11'])\n for lib_dir in lib_dirs:\n info = self.check_libs(lib_dir, x11_libs, [])\n if info is not None:\n break\n else:\n return\n inc_dir = None\n for d in include_dirs:\n if combine_paths(d, 'X11/X.h'):\n inc_dir = d\n break\n if inc_dir is not None:\n dict_append(info, include_dirs=[inc_dir])\n self.set_info(**info)\n\ndef shortest_path(pths):\n pths.sort()\n if pths: return pths[0]\n\ndef combine_paths(*args):\n \"\"\" Return a list of existing paths composed by all combinations of\n items from arguments.\n \"\"\"\n r = []\n for a in args:\n if not a: continue\n if type(a) is types.StringType:\n a = [a]\n r.append(a)\n args = r\n if not args: return []\n if len(args)==1:\n result = reduce(lambda a,b:a+b,map(glob,args[0]),[])\n elif len (args)==2:\n result = []\n for a0 in args[0]:\n for a1 in args[1]:\n result.extend(glob(os.path.join(a0,a1)))\n else:\n result = combine_paths(*(combine_paths(args[0],args[1])+args[2:]))\n return result\n\ndef dict_append(d,**kws):\n for k,v in kws.items():\n if d.has_key(k):\n d[k].extend(v)\n else:\n d[k] = v\n\ndef show_all():\n import system_info\n import pprint\n match_info = re.compile(r'.*?_info').match\n for n in filter(match_info,dir(system_info)):\n if n in ['system_info','get_info']: continue\n c = getattr(system_info,n)()\n r = c.get_info()\n\nif __name__ == \"__main__\":\n show_all()\n", + "methods": [ + { + "name": "get_info", + "long_name": "get_info( name )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 1, + "token_count": 39, + "parameters": [ + "name" + ], + "start_line": 95, + "end_line": 99, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , default_lib_dirs = default_lib_dirs , default_include_dirs = default_include_dirs , )", + "filename": "system_info.py", + "nloc": 17, + "complexity": 2, + "token_count": 152, + "parameters": [ + "self", + "default_lib_dirs", + "default_include_dirs" + ], + "start_line": 142, + "end_line": 158, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "set_info", + "long_name": "set_info( self , ** info )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "info" + ], + "start_line": 160, + "end_line": 161, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "has_info", + "long_name": "has_info( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self" + ], + "start_line": 162, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_info", + "long_name": "get_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 9, + "token_count": 113, + "parameters": [ + "self" + ], + "start_line": 164, + "end_line": 186, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "calc_info_template", + "long_name": "calc_info_template( self , prefix )", + "filename": "system_info.py", + "nloc": 1, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self", + "prefix" + ], + "start_line": 188, + "end_line": 189, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 3, + "token_count": 70, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 191, + "end_line": 195, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "get_lib_dirs", + "long_name": "get_lib_dirs( self , key = 'library_dirs' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 197, + "end_line": 198, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_include_dirs", + "long_name": "get_include_dirs( self , key = 'include_dirs' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 199, + "end_line": 200, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_libs", + "long_name": "get_libs( self , key , default )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "key", + "default" + ], + "start_line": 202, + "end_line": 207, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "check_libs", + "long_name": "check_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 4, + "token_count": 60, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 209, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "check_static_libs", + "long_name": "check_static_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 5, + "token_count": 91, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 219, + "end_line": 226, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "check_shared_libs", + "long_name": "check_shared_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 13, + "complexity": 6, + "token_count": 119, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 228, + "end_line": 240, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 246, + "end_line": 247, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 69, + "complexity": 24, + "token_count": 443, + "parameters": [ + "self" + ], + "start_line": 249, + "end_line": 320, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 72, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 8, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 326, + "end_line": 333, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 24, + "complexity": 8, + "token_count": 168, + "parameters": [ + "self" + ], + "start_line": 335, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 27, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 4, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 376, + "end_line": 379, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 7, + "token_count": 110, + "parameters": [ + "self" + ], + "start_line": 381, + "end_line": 400, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "shortest_path", + "long_name": "shortest_path( pths )", + "filename": "system_info.py", + "nloc": 3, + "complexity": 2, + "token_count": 18, + "parameters": [ + "pths" + ], + "start_line": 402, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "combine_paths", + "long_name": "combine_paths( * args )", + "filename": "system_info.py", + "nloc": 19, + "complexity": 9, + "token_count": 162, + "parameters": [ + "args" + ], + "start_line": 406, + "end_line": 427, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "dict_append", + "long_name": "dict_append( d , ** kws )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 44, + "parameters": [ + "d", + "kws" + ], + "start_line": 429, + "end_line": 434, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "show_all", + "long_name": "show_all( )", + "filename": "system_info.py", + "nloc": 8, + "complexity": 3, + "token_count": 59, + "parameters": [], + "start_line": 436, + "end_line": 443, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + } + ], + "methods_before": [ + { + "name": "get_info", + "long_name": "get_info( name )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 1, + "token_count": 39, + "parameters": [ + "name" + ], + "start_line": 95, + "end_line": 99, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 0 + }, + { + "name": "__init__", + "long_name": "__init__( self , default_lib_dirs = default_lib_dirs , default_include_dirs = default_include_dirs , )", + "filename": "system_info.py", + "nloc": 17, + "complexity": 2, + "token_count": 152, + "parameters": [ + "self", + "default_lib_dirs", + "default_include_dirs" + ], + "start_line": 142, + "end_line": 158, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "set_info", + "long_name": "set_info( self , ** info )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "info" + ], + "start_line": 160, + "end_line": 161, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "has_info", + "long_name": "has_info( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 18, + "parameters": [ + "self" + ], + "start_line": 162, + "end_line": 163, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_info", + "long_name": "get_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 9, + "token_count": 113, + "parameters": [ + "self" + ], + "start_line": 164, + "end_line": 186, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 23, + "top_nesting_level": 1 + }, + { + "name": "calc_info_template", + "long_name": "calc_info_template( self , prefix )", + "filename": "system_info.py", + "nloc": 1, + "complexity": 1, + "token_count": 8, + "parameters": [ + "self", + "prefix" + ], + "start_line": 188, + "end_line": 189, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 5, + "complexity": 3, + "token_count": 70, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 191, + "end_line": 195, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 5, + "top_nesting_level": 1 + }, + { + "name": "get_lib_dirs", + "long_name": "get_lib_dirs( self , key = 'lib_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 197, + "end_line": 198, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_include_dirs", + "long_name": "get_include_dirs( self , key = 'include_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 199, + "end_line": 200, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_libs", + "long_name": "get_libs( self , key , default )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 49, + "parameters": [ + "self", + "key", + "default" + ], + "start_line": 202, + "end_line": 207, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 1 + }, + { + "name": "check_libs", + "long_name": "check_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 4, + "token_count": 60, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 209, + "end_line": 217, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 9, + "top_nesting_level": 1 + }, + { + "name": "check_static_libs", + "long_name": "check_static_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 7, + "complexity": 5, + "token_count": 91, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 219, + "end_line": 226, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "check_shared_libs", + "long_name": "check_shared_libs( self , lib_dir , libs , opt_libs = [ ] )", + "filename": "system_info.py", + "nloc": 13, + "complexity": 6, + "token_count": 119, + "parameters": [ + "self", + "lib_dir", + "libs", + "opt_libs" + ], + "start_line": 228, + "end_line": 240, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 13, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 11, + "parameters": [ + "self" + ], + "start_line": 246, + "end_line": 247, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 69, + "complexity": 24, + "token_count": 443, + "parameters": [ + "self" + ], + "start_line": 249, + "end_line": 320, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 72, + "top_nesting_level": 1 + }, + { + "name": "get_paths", + "long_name": "get_paths( self , section , key )", + "filename": "system_info.py", + "nloc": 8, + "complexity": 5, + "token_count": 112, + "parameters": [ + "self", + "section", + "key" + ], + "start_line": 326, + "end_line": 333, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 24, + "complexity": 8, + "token_count": 168, + "parameters": [ + "self" + ], + "start_line": 335, + "end_line": 361, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 27, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self )", + "filename": "system_info.py", + "nloc": 4, + "complexity": 1, + "token_count": 19, + "parameters": [ + "self" + ], + "start_line": 376, + "end_line": 379, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 4, + "top_nesting_level": 1 + }, + { + "name": "calc_info", + "long_name": "calc_info( self )", + "filename": "system_info.py", + "nloc": 20, + "complexity": 7, + "token_count": 110, + "parameters": [ + "self" + ], + "start_line": 381, + "end_line": 400, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 20, + "top_nesting_level": 1 + }, + { + "name": "shortest_path", + "long_name": "shortest_path( pths )", + "filename": "system_info.py", + "nloc": 3, + "complexity": 2, + "token_count": 18, + "parameters": [ + "pths" + ], + "start_line": 402, + "end_line": 404, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 3, + "top_nesting_level": 0 + }, + { + "name": "combine_paths", + "long_name": "combine_paths( * args )", + "filename": "system_info.py", + "nloc": 19, + "complexity": 9, + "token_count": 162, + "parameters": [ + "args" + ], + "start_line": 406, + "end_line": 427, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 22, + "top_nesting_level": 0 + }, + { + "name": "dict_append", + "long_name": "dict_append( d , ** kws )", + "filename": "system_info.py", + "nloc": 6, + "complexity": 3, + "token_count": 44, + "parameters": [ + "d", + "kws" + ], + "start_line": 429, + "end_line": 434, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 6, + "top_nesting_level": 0 + }, + { + "name": "show_all", + "long_name": "show_all( )", + "filename": "system_info.py", + "nloc": 8, + "complexity": 3, + "token_count": 59, + "parameters": [], + "start_line": 436, + "end_line": 443, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 8, + "top_nesting_level": 0 + } + ], + "changed_methods": [ + { + "name": "get_include_dirs", + "long_name": "get_include_dirs( self , key = 'include_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 199, + "end_line": 200, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "__init__", + "long_name": "__init__( self , default_lib_dirs = default_lib_dirs , default_include_dirs = default_include_dirs , )", + "filename": "system_info.py", + "nloc": 17, + "complexity": 2, + "token_count": 152, + "parameters": [ + "self", + "default_lib_dirs", + "default_include_dirs" + ], + "start_line": 142, + "end_line": 158, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 17, + "top_nesting_level": 1 + }, + { + "name": "get_lib_dirs", + "long_name": "get_lib_dirs( self , key = 'lib_dir' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 197, + "end_line": 198, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_include_dirs", + "long_name": "get_include_dirs( self , key = 'include_dirs' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 199, + "end_line": 200, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + }, + { + "name": "get_lib_dirs", + "long_name": "get_lib_dirs( self , key = 'library_dirs' )", + "filename": "system_info.py", + "nloc": 2, + "complexity": 1, + "token_count": 20, + "parameters": [ + "self", + "key" + ], + "start_line": 197, + "end_line": 198, + "fan_in": 0, + "fan_out": 0, + "general_fan_out": 0, + "length": 2, + "top_nesting_level": 1 + } + ], + "nloc": 378, + "complexity": 101, + "token_count": 2218, + "diff_parsed": { + "added": [ + "library_dirs = /usr/lib:/usr/local/lib:/opt/lib", + "include_dirs = /usr/include:/usr/local/include:/opt/include", + "library_dirs = /usr/lib/3dnow:/usr/lib/3dnow/atlas", + "library_dirs = /usr/X11R6/lib", + "include_dirs = /usr/X11R6/include", + " defaults['library_dirs'] = os.pathsep.join(default_lib_dirs)", + " defaults['include_dirs'] = os.pathsep.join(default_include_dirs)", + " def get_lib_dirs(self, key='library_dirs'):", + " def get_include_dirs(self, key='include_dirs'):" + ], + "deleted": [ + "lib_dir = /usr/lib:/usr/local/lib:/opt/lib", + "include_dir = /usr/include:/usr/local/include:/opt/include", + "lib_dir = /usr/lib/3dnow:/usr/lib/3dnow/atlas", + "lib_dir = /usr/X11R6/lib", + "include_dir = /usr/X11R6/include", + " defaults['lib_dir'] = os.pathsep.join(default_lib_dirs)", + " defaults['include_dir'] = os.pathsep.join(default_include_dirs)", + " def get_lib_dirs(self, key='lib_dir'):", + " def get_include_dirs(self, key='include_dir'):" + ] + } + } + ] + } +] \ No newline at end of file