<commit_before># Copyright (c) <NAME>, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.

import config
from install_package import InstallPackage
import os
import shutil
import utils

BASENAME = "vtkdevide"
#SVN_REPO = "http://devide.googlecode.com/svn/trunk/" + BASENAME
# this should be the same release as johannes and the rest of devide
#SVN_REL = config.DEVIDE_REL

dependencies = ['VTK', 'DeVIDE']

class VTKDEVIDE(InstallPackage):
    
    def __init__(self):
        self.source_dir = os.path.join(config.archive_dir, BASENAME)
        self.build_dir = os.path.join(config.build_dir, '%s-build' %
                                      (BASENAME,))
        self.inst_dir = os.path.join(config.inst_dir, BASENAME)

    def get(self):
        if os.path.exists(self.source_dir):
            utils.output("vtkdevide already checked out, skipping step.")

        else:
            os.chdir(config.archive_dir)
            #ret = os.system("%s co %s -r%s" % (config.SVN, SVN_REPO, SVN_REL))
            ret = 1
            if ret != 0:
                utils.error("Could not SVN checkout.  Fix and try again.")

    def unpack(self):
        # no unpack step
        pass

    def configure(self):
        if os.path.exists(
            os.path.join(self.build_dir, 'CMakeFiles/cmake.check_cache')):
            utils.output("vtkdevide build already configured.")
            return
        
        if not os.path.exists(self.build_dir):
            os.mkdir(self.build_dir)

        cmake_params = "-DBUILD_SHARED_LIBS=ON " \
                       "-DBUILD_TESTING=OFF " \
                       "-DCMAKE_BUILD_TYPE=RelWithDebInfo " \
                       "-DCMAKE_INSTALL_PREFIX=%s " \
                       "-DVTK_DIR=%s " \
                       "-DDCMTK_INCLUDE_PATH=%s " \
                       "-DDCMTK_LIB_PATH=%s" % \
                       (self.inst_dir, config.VTK_DIR,
                        config.DCMTK_INCLUDE, config.DCMTK_LIB)

        ret = utils.cmake_command(self.build_dir, self.source_dir,
                cmake_params)

        if ret != 0:
            utils.error("Could not configure vtkdevide.  Fix and try again.")
        

    def build(self):
        posix_file = os.path.join(self.build_dir, 
                'bin/libvtkdevideExternalPython.so')
        nt_file = os.path.join(self.build_dir, 'bin',
                config.BUILD_TARGET, 
                'vtkdevideExternalPython' + config.PYE_EXT)

        if utils.file_exists(posix_file, nt_file):    
            utils.output("vtkdevide already built.  Skipping build step.")

        else:
            os.chdir(self.build_dir)
            ret = utils.make_command('VTKDEVIDE.sln')
            if ret != 0:
                utils.error("Could not build vtkdevide.  Fix and try again.")
        

    def install(self):
        config.VTKDEVIDE_PYTHON = os.path.join(
            self.inst_dir, 'lib')

        config.VTKDEVIDE_LIB = os.path.join(self.inst_dir, 'lib')

        test_file = os.path.join(config.VTKDEVIDE_LIB, 'vtkdevide.py')
        if os.path.exists(test_file):
            utils.output("vtkdevide already installed, skipping step.")
        else:
            os.chdir(self.build_dir)
            ret = utils.make_command('VTKDEVIDE.sln', install=True)

            if ret != 0:
                utils.error(
                "Could not install vtkdevide.  Fix and try again.")
 

    def clean_build(self):
        # nuke the build dir, the source dir is pristine and there is
        # no installation
        utils.output("Removing build dir.")
        if os.path.exists(self.build_dir):
            shutil.rmtree(self.build_dir)

    def get_installed_version(self):
        return None
       
<commit_msg>Changed vtkdevide install package to make use of already unpacked devide source.<commit_after># Copyright (c) <NAME>, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.

import config
from install_package import InstallPackage
import os
import shutil
import utils

BASENAME = "vtkdevide"

dependencies = ['VTK', 'DeVIDE']

class VTKDEVIDE(InstallPackage):
    
    def __init__(self):
        self.source_dir = os.path.join(config.DEVIDE_SRC_DIR, BASENAME)
        self.build_dir = os.path.join(config.build_dir, '%s-build' %
                                      (BASENAME,))
        self.inst_dir = os.path.join(config.inst_dir, BASENAME)

    def get(self):
        if not os.path.exists(self.source_dir):
            utils.error("Couldn't find vtkdevide source dir. Build DeVIDE package first.")

    def unpack(self):
        # no unpack step
        pass

    def configure(self):
        if os.path.exists(
            os.path.join(self.build_dir, 'CMakeFiles/cmake.check_cache')):
            utils.output("vtkdevide build already configured.")
            return
        
        if not os.path.exists(self.build_dir):
            os.mkdir(self.build_dir)

        cmake_params = "-DBUILD_SHARED_LIBS=ON " \
                       "-DBUILD_TESTING=OFF " \
                       "-DCMAKE_BUILD_TYPE=RelWithDebInfo " \
                       "-DCMAKE_INSTALL_PREFIX=%s " \
                       "-DVTK_DIR=%s " \
                       "-DDCMTK_INCLUDE_PATH=%s " \
                       "-DDCMTK_LIB_PATH=%s" % \
                       (self.inst_dir, config.VTK_DIR,
                        config.DCMTK_INCLUDE, config.DCMTK_LIB)

        ret = utils.cmake_command(self.build_dir, self.source_dir,
                cmake_params)

        if ret != 0:
            utils.error("Could not configure vtkdevide.  Fix and try again.")
        

    def build(self):
        posix_file = os.path.join(self.build_dir, 
                'bin/libvtkdevideExternalPython.so')
        nt_file = os.path.join(self.build_dir, 'bin',
                config.BUILD_TARGET, 
                'vtkdevideExternalPython' + config.PYE_EXT)

        if utils.file_exists(posix_file, nt_file):    
            utils.output("vtkdevide already built.  Skipping build step.")

        else:
            os.chdir(self.build_dir)
            ret = utils.make_command('VTKDEVIDE.sln')
            if ret != 0:
                utils.error("Could not build vtkdevide.  Fix and try again.")
        

    def install(self):
        config.VTKDEVIDE_PYTHON = os.path.join(
            self.inst_dir, 'lib')

        config.VTKDEVIDE_LIB = os.path.join(self.inst_dir, 'lib')

        test_file = os.path.join(config.VTKDEVIDE_LIB, 'vtkdevide.py')
        if os.path.exists(test_file):
            utils.output("vtkdevide already installed, skipping step.")
        else:
            os.chdir(self.build_dir)
            ret = utils.make_command('VTKDEVIDE.sln', install=True)

            if ret != 0:
                utils.error(
                "Could not install vtkdevide.  Fix and try again.")
 

    def clean_build(self):
        # nuke the build dir, the source dir is pristine and there is
        # no installation
        utils.output("Removing build dir.")
        if os.path.exists(self.build_dir):
            shutil.rmtree(self.build_dir)

    def get_installed_version(self):
        return None
       

{'fraction_non_alphanumeric': 0.10339030540767723, 'fraction_numerical': 0.0011207621182404036, 'mean_word_length': 1.8430904022301873, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1762628', 'n_tokens_mistral': 2309, 'n_tokens_neox': 2169, 'n_words': 454}