<s> """<STR_LIT>""" <EOL> from distutils . core import setup <EOL> import json <EOL> import os <EOL> info = json . load ( open ( "<STR_LIT>" ) ) <EOL> def convert_to_str ( d ) : <EOL> """<STR_LIT>""" <EOL> d2 = { } <EOL> for k , v in d . items ( ) : <EOL> k = str ( k ) <EOL> if type ( v ) in [ list , tuple ] : <EOL> d2 [ k ] = [ str ( a ) for a in v ] <EOL> elif type ( v ) is dict : <EOL> d2 [ k ] = convert_to_str ( v ) <EOL> else : <EOL> d2 [ k ] = str ( v ) <EOL> return d2 <EOL> info = convert_to_str ( info ) <EOL> NAMESPACE_PACKAGES = [ ] <EOL> def generate_namespaces ( package ) : <EOL> new_package = "<STR_LIT:.>" . join ( package . split ( "<STR_LIT:.>" ) [ <NUM_LIT:0> : - <NUM_LIT:1> ] ) <EOL> if new_package . count ( "<STR_LIT:.>" ) > <NUM_LIT:0> : <EOL> generate_namespaces ( new_package ) <EOL> NAMESPACE_PACKAGES . append ( new_package ) <EOL> generate_namespaces ( info [ "<STR_LIT:name>" ] ) <EOL> if os . path . exists ( "<STR_LIT>" ) : <EOL> os . unlink ( "<STR_LIT>" ) <EOL> packages , data_files = [ ] , [ ] <EOL> root_dir = os . path . dirname ( __file__ ) <EOL> if root_dir : <EOL> os . chdir ( root_dir ) <EOL> def build_package ( dirpath , dirnames , filenames ) : <EOL> for i , dirname in enumerate ( dirnames ) : <EOL> if dirname . startswith ( '<STR_LIT:.>' ) : <EOL> del dirnames [ i ] <EOL> if '<STR_LIT>' in filenames and '<STR_LIT>' not in filenames : <EOL> pkg = dirpath . replace ( os . path . sep , '<STR_LIT:.>' ) <EOL> if os . path . altsep : <EOL> pkg = pkg . replace ( os . path . altsep , '<STR_LIT:.>' ) <EOL> packages . append ( pkg ) <EOL> prefix = dirpath [ len ( info [ "<STR_LIT:name>" ] ) + <NUM_LIT:1> : ] <EOL> for f in filenames : <EOL> if f == '<STR_LIT>' or not ( f . startswith ( "<STR_LIT:.>" ) or <EOL> f . endswith ( "<STR_LIT>" ) or <EOL> f . endswith ( "<STR_LIT>" ) ) : <EOL> data_files . append ( os . path . join ( prefix , f ) ) <EOL> [ build_package ( dirpath , dirnames , filenames ) for dirpath , dirnames , filenames <EOL> in os . walk ( info [ "<STR_LIT:name>" ] . replace ( "<STR_LIT:.>" , "<STR_LIT:/>" ) ) ] <EOL> setup_kwargs = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:url>" : "<STR_LIT>" % info [ "<STR_LIT:name>" ] , <EOL> "<STR_LIT>" : packages , <EOL> "<STR_LIT>" : { info [ "<STR_LIT:name>" ] : data_files , } , <EOL> "<STR_LIT>" : NAMESPACE_PACKAGES , <EOL> "<STR_LIT>" : [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> } <EOL> setup_kwargs . update ( info ) <EOL> setup ( ** setup_kwargs ) </s>
