Exemplo n.º 1
0
def make_build_dir ( build = None ) :
    """Create proper temporary directory for ROOT builds
    """

    if not build or not writeable  ( build ) : 
        from ostap.utils.cleanup import CleanUp 
        build = CleanUp.tempdir ( prefix = 'ostap-build-' )

    if not os.path.exists ( build ) :
        make_dir ( build )
        
    return build
Exemplo n.º 2
0
date_format =  "%Y-%b-%d"
re_format   = r"-(\d{4}-(\D&\S){3}-\d{2})-" 
# =============================================================================
user = whoami ()
# =============================================================================            
## temporary directory for <code>tempfile</code> module
base_tmp_dir = None
for_cleanup  = False 
# =============================================================================

## 1) check the environment variable OSTAP_TMPDIR 
if not base_tmp_dir :
    base_tmp_dir = os.environ.get  ( 'OSTAP_TMP_DIR' , None )
    ##
    if base_tmp_dir and not os.path.exists ( base_tmp_dir ) :
        base_tmp_dir = make_dir  ( base_tmp_dir ) 
    if base_tmp_dir and not writeable ( base_tmp_dir ) :
        logger.warning ('Directory ``%s'' is not writeable!' % base_tmp_dir )
        base_tmp_dir = None
        
## 2) get from configuration file 
if not base_tmp_dir :
    ## 2) check the configuration file 
    import ostap.core.config as OCC 
    base_tmp_dir = OCC.general.get ( 'TMP_DIR' , None )
    del OCC

    if base_tmp_dir and not os.path.exists ( base_tmp_dir ) :
        base_tmp_dir = make_dir ( base_tmp_dir ) 
    if base_tmp_dir and not writeable ( base_tmp_dir ) :
        logger.warning ('Directory ``%s'' is not writeable!' % base_tmp_dir )
Exemplo n.º 3
0
groot.SetBatch(arguments.batch)
if groot.IsBatch(): logger.info('Batch processing is activated')

import ostap.fixes.fixes

# =============================================================================
# specify the build directory for ROOT
# =============================================================================
import ostap.core.build_dir
if arguments.build_dir:

    from ostap.utils.basic import good_dir, make_dir
    bdir = arguments.build_dir

    if good_dir(bdir): pass
    elif bdir and not os.path.exists(bdir): make_dir(bdir)

    if good_dir(bdir):
        ROOT.gSystem.SetBuildDir(bdir)
        logger.info('Build directory for ROOT: %s' %
                    ostap.core.build_dir.build_dir)
        ostap.core.build_dir.build_dir = bdir

    del bdir, good_dir, make_dir

# =============================================================================
## ostap startup: history, readlines, etc...
# =============================================================================
import ostap.core.startup

# =============================================================================
Exemplo n.º 4
0
    'use_build_dir'  , ## use  (temporary) build directory for ROOT    
    )
# =============================================================================
import ROOT, os, glob  
from   ostap.utils.basic import make_dir, writeable 
# =============================================================================
build_dir  = None
prefix_dir = 'ostap-build-dir-'
# =============================================================================
# 1) use environment variable 
if not build_dir :

    build_dir = os.environ.get ( 'OSTAP_BUILD_DIR' , '' )
    
    if build_dir and not os.path.exists ( build_dir ) :
        build_dir = make_dir ( build_dir ) 
    if build_dir and not writeable ( build_dir ) :
        logger.warning ('Directory %s is not writeable!' % tmp_dir )
        build_dir = None

## 2) get from configuration file 
if not build_dir :
    ## 2) check the configuration file 
    import ostap.core.config as OCC 
    build_dir = OCC.general.get ( 'BUILD_DIR' , None )
    del OCC
    
    if build_dir and not os.path.exists ( build_dir ) :
        build_dir = make_dir ( build_dir ) 
    if build_dir and not writeable ( build_dir ) :
        logger.warning ('Directory %s is not writeable!' % tmp_dir )