<commit_before>import BaseEnvironment
import re
import os
from subprocess import Popen, PIPE, STDOUT

class Environment(BaseEnvironment.Environment):
   def __init__(self, **kw):
      apply(BaseEnvironment.Environment.__init__, (self,), kw)

      self.ConfigureCompiler()

      self['ENV']['INCLUDE'] = self['CPPPATH']
      self['ENV']['LIB'] = self['LIBPATH']
      self['ENV']['PATH'] = os.environ['PATH']

   def ConfigureCompiler(self):
      cxx = self.WhereIs(self['CXX'])
      cxx_bin = os.path.basename(cxx).lower()
      cxx_dir = os.path.dirname(cxx)

      if cxx_bin == "cl.exe":
         common = cxx_dir + "\..\.."
         if os.path.exists(common + "\Common\IDE"):
           os.environ['PATH'] = common + "\Common\IDE" + ";" + cxx_dir
         elif os.path.exists(common + "\Common7\IDE"):
           os.environ['PATH'] = common + "\Common7\IDE" + ";" + cxx_dir

         proc = Popen(cxx_bin, stderr=STDOUT, stdout=PIPE)
         proc.wait()
         version = "".join(proc.stdout.readlines())

         if re.search("Version 13\.10", version):
            print "Microsoft Visual C++ .NET 2003 (7.1) Detected"
         elif re.search("Version 14\.00", version):
            print "Microsoft Visual C++ 2005 (8.0) Detected"
         elif re.search("Version 15\.00", version):
            print "Microsoft Visual C++ 2008 (9.0) Detected"
         # TODO: handle unsupported msvc++ version

         self.AppendUnique(CCFLAGS = ['/EHsc'])
         self['CXX'] = cxx_bin
#         self['LINK'] = "link.exe"
         self['CPPPATH'] = os.path.abspath(cxx_dir + "\..\include")
         self['LIBPATH'] = os.path.abspath(cxx_dir + "\..\lib")

         sdk_dir = ""
         if os.getenv('MicrosoftPlatformSDK', None) != None:
            sdk_dir = os.environ['MicrosoftPlatformSDK']
         # standard MSVC++ relative install
         elif os.path.exists(cxx_dir + "\..\PlatformSDK"):
            sdk_dir = cxx_dir + "\..\PlatformSDK"
         #TODO: handle directory not found<commit_msg>prevent auto-linking with boost and MSVC compilers caused by #pragma comment(lib, ...)<commit_after>import BaseEnvironment
import re
import os
from subprocess import Popen, PIPE, STDOUT

class Environment(BaseEnvironment.Environment):
   def __init__(self, **kw):
      apply(BaseEnvironment.Environment.__init__, (self,), kw)

      self.ConfigureCompiler()

      self['ENV']['INCLUDE'] = self['CPPPATH']
      self['ENV']['LIB'] = self['LIBPATH']
      self['ENV']['PATH'] = os.environ['PATH']

   def ConfigureCompiler(self):
      cxx = self.WhereIs(self['CXX'])
      cxx_bin = os.path.basename(cxx).lower()
      cxx_dir = os.path.dirname(cxx)

      if cxx_bin == "cl.exe":
         common = cxx_dir + "\..\.."
         if os.path.exists(common + "\Common\IDE"):
           os.environ['PATH'] = common + "\Common\IDE" + ";" + cxx_dir
         elif os.path.exists(common + "\Common7\IDE"):
           os.environ['PATH'] = common + "\Common7\IDE" + ";" + cxx_dir

         proc = Popen(cxx_bin, stderr=STDOUT, stdout=PIPE)
         proc.wait()
         version = "".join(proc.stdout.readlines())

         if re.search("Version 13\.10", version):
            print "Microsoft Visual C++ .NET 2003 (7.1) Detected"
         elif re.search("Version 14\.00", version):
            print "Microsoft Visual C++ 2005 (8.0) Detected"
         elif re.search("Version 15\.00", version):
            print "Microsoft Visual C++ 2008 (9.0) Detected"
         # TODO: handle unsupported msvc++ version

         # XXX: BOOST_ALL_NO_LIB prevents MSVC from auto-linking a non-existent library
         self.AppendUnique(CXXFLAGS = ['/EHsc', '/DBOOST_ALL_NO_LIB'])
         self['CXX'] = cxx_bin
#         self['LINK'] = "link.exe"
         self['CPPPATH'] = os.path.abspath(cxx_dir + "\..\include")
         self['LIBPATH'] = os.path.abspath(cxx_dir + "\..\lib")

         sdk_dir = ""
         if os.getenv('MicrosoftPlatformSDK', None) != None:
            sdk_dir = os.environ['MicrosoftPlatformSDK']
         # standard MSVC++ relative install
         elif os.path.exists(cxx_dir + "\..\PlatformSDK"):
            sdk_dir = cxx_dir + "\..\PlatformSDK"
         #TODO: handle directory not found
{'fraction_non_alphanumeric': 0.16102906145783707, 'fraction_numerical': 0.015245354930919485, 'mean_word_length': 2.5020850708924103, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3061670', 'n_tokens_mistral': 1413, 'n_tokens_neox': 1305, 'n_words': 288}