<s> from __future__ import print_function , division , absolute_import <EOL> import os <EOL> import sys <EOL> from os . path import abspath , expanduser , isdir , join <EOL> from conda . config import subdir as cc_platform <EOL> from conda . install import yield_lines <EOL> import constructor . fcp as fcp <EOL> import constructor . construct as construct <EOL> def get_output_filename ( info ) : <EOL> try : <EOL> return info [ '<STR_LIT>' ] <EOL> except KeyError : <EOL> pass <EOL> osname , arch = info [ '<STR_LIT>' ] . split ( '<STR_LIT:->' ) <EOL> os_map = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> arch_name_map = { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } <EOL> ext = '<STR_LIT>' if osname == '<STR_LIT>' else '<STR_LIT>' <EOL> return '<STR_LIT>' % ( '<STR_LIT>' % info , <EOL> os_map . get ( osname , osname ) , <EOL> arch_name_map . get ( arch , arch ) , <EOL> ext ) <EOL> def main_build ( dir_path , output_dir = '<STR_LIT:.>' , platform = cc_platform , verbose = True ) : <EOL> print ( '<STR_LIT>' % platform ) <EOL> try : <EOL> osname , unused_arch = platform . split ( '<STR_LIT:->' ) <EOL> except ValueError : <EOL> sys . exit ( "<STR_LIT>" % platform ) <EOL> if osname in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> if sys . platform == '<STR_LIT:win32>' : <EOL> sys . exit ( "<STR_LIT>" ) <EOL> from constructor . shar import create <EOL> elif osname == '<STR_LIT>' : <EOL> if sys . platform != '<STR_LIT:win32>' : <EOL> sys . exit ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> from constructor . winexe import create <EOL> else : <EOL> sys . exit ( "<STR_LIT>" % osname ) <EOL> construct_path = join ( dir_path , '<STR_LIT>' ) <EOL> info = construct . parse ( construct_path , platform ) <EOL> construct . verify ( info ) <EOL> info [ '<STR_LIT>' ] = platform <EOL> info [ '<STR_LIT>' ] = join ( expanduser ( '<STR_LIT>' ) , '<STR_LIT>' , '<STR_LIT>' , <EOL> platform ) <EOL> if verbose : <EOL> print ( '<STR_LIT>' % info [ '<STR_LIT>' ] ) <EOL> for key in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ) : <EOL> if key in info : <EOL> info [ key ] = abspath ( join ( dir_path , info [ key ] ) ) <EOL> for key in '<STR_LIT>' , '<STR_LIT>' : <EOL> if key not in info : <EOL> continue <EOL> if isinstance ( info [ key ] , str ) : <EOL> info [ key ] = list ( yield_lines ( join ( dir_path , info [ key ] ) ) ) <EOL> for key in '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' : <EOL> if key in info : <EOL> info [ key ] = [ line . strip ( ) for line in info [ key ] ] <EOL> fcp . main ( info , verbose = verbose ) <EOL> info [ '<STR_LIT>' ] = join ( output_dir , get_output_filename ( info ) ) <EOL> create ( info ) <EOL> print ( "<STR_LIT>" % info ) <EOL> def main ( ) : <EOL> from optparse import OptionParser <EOL> p = OptionParser ( <EOL> usage = "<STR_LIT>" , <EOL> description = "<STR_LIT>" ) <EOL> p . add_option ( '<STR_LIT>' , <EOL> action = "<STR_LIT:store_true>" ) <EOL> p . add_option ( '<STR_LIT>' , <EOL> action = "<STR_LIT:store>" , <EOL> default = os . getcwd ( ) , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> metavar = '<STR_LIT>' ) <EOL> p . add_option ( '<STR_LIT>' , <EOL> action = "<STR_LIT:store>" , <EOL> default = cc_platform , <EOL> help = "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> p . add_option ( '<STR_LIT>' , <EOL> help = "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" ) <EOL> p . add_option ( '<STR_LIT>' , '<STR_LIT>' , <EOL> action = "<STR_LIT:store_true>" ) <EOL> p . add_option ( '<STR_LIT>' , '<STR_LIT>' , <EOL> help = "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" ) <EOL> opts , args = p . parse_args ( ) <EOL> if opts . version : <EOL> from constructor import __version__ <EOL> print ( '<STR_LIT>' , __version__ ) <EOL> return <EOL> if opts . test : <EOL> import constructor . tests <EOL> constructor . tests . main ( ) <EOL> return <EOL> if opts . debug : <EOL> import logging <EOL> logging . basicConfig ( level = logging . DEBUG ) <EOL> if len ( args ) != <NUM_LIT:1> : <EOL> p . error ( "<STR_LIT>" ) <EOL> dir_path = args [ <NUM_LIT:0> ] <EOL> if not isdir ( dir_path ) : <EOL> p . error ( "<STR_LIT>" % dir_path ) <EOL> main_build ( dir_path , output_dir = opts . output_dir , platform = opts . platform , <EOL> verbose = opts . verbose ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
