<commit_before># coding: utf-8
'''
    @license: Apache License, Version 2.0
    @copyright: 2007-2013 <NAME>
    @author: <NAME>
'''

## Python imports
from datetime import timedelta

## Django imports
from django.utils.timezone import now

## MAGE imports
from scm.exceptions import MageScmError, MageScmCallerError,\
    MageScmFailedEnvironmentDependencyCheck
from scm.models import Installation, ComponentInstanceConfiguration
from prm.models import getParam


def install_iset_envt(iset, envt, force_prereqs = False, install_date = now(), ticket = None):
    compos = envt.component_instances.filter(instanciates__isnull=False)
    install_iset(iset, compos, envt, force_prereqs, install_date, ticket)

def install_iset(iset, targets, envt, force_prereqs = False, install_date = now(), ticket = None, ii_selection = None):
    ## Check arguments
    if ii_selection is None:
        ii_selection = iset.set_content.all()
    for ii in ii_selection:
        if ii.belongs_to_set != iset:
            raise MageScmCallerError('an Installable Item does not belong to the specified set')
    
    ## Check prerequisites
    try:
        iset.check_prerequisites(envt.name, ii_selection)
    except MageScmFailedEnvironmentDependencyCheck, e:
        if not force_prereqs:<commit_msg>Bugfix: date was evaluated at script loading, not at execution time<commit_after># coding: utf-8
'''
    @license: Apache License, Version 2.0
    @copyright: 2007-2013 <NAME>
    @author: <NAME>
'''

## Python imports
from datetime import timedelta

## Django imports
from django.utils.timezone import now

## MAGE imports
from scm.exceptions import MageScmError, MageScmCallerError,\
    MageScmFailedEnvironmentDependencyCheck
from scm.models import Installation, ComponentInstanceConfiguration
from prm.models import getParam


def install_iset_envt(iset, envt, force_prereqs = False, install_date = now(), ticket = None):
    compos = envt.component_instances.filter(instanciates__isnull=False)
    install_iset(iset, compos, envt, force_prereqs, install_date, ticket)

def install_iset(iset, targets, envt, force_prereqs = False, install_date = None, ticket = None, ii_selection = None):
    ## Check arguments
    if ii_selection is None:
        ii_selection = iset.set_content.all()
    for ii in ii_selection:
        if ii.belongs_to_set != iset:
            raise MageScmCallerError('an Installable Item does not belong to the specified set')
    if install_date is None:
        install_date = now()
    
    ## Check prerequisites
    try:
        iset.check_prerequisites(envt.name, ii_selection)
    except MageScmFailedEnvironmentDependencyCheck, e:
        if not force_prereqs:
{'fraction_non_alphanumeric': 0.08205893323386795, 'fraction_numerical': 0.008205893323386795, 'mean_word_length': 4.1976744186046515, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '295192', 'n_tokens_mistral': 846, 'n_tokens_neox': 794, 'n_words': 231}