#NEWLINE# def add( folder , index = 1 ) : #NEWLINE# #INDENT# '\n  Adds the given folder to the python path. Supports namespaced packages.\n  By default, packages in the given folder take precedence over site-packages\n  and any previous path manipulations.\n\n  Args:\n    folder: Path to the folder containing packages, relative to ``os.getcwd()``\n    position: Where in ``sys.path`` to insert the vendor packages. By default\n      this is set to 1. It is inadvisable to set it to 0 as it will override\n      any modules in the current working directory.\n  ' #NEWLINE# site_dir = os . path . join ( folder , 'lib' , ( 'python' + sys . version [ : 3 ] ) , 'site-packages' ) #NEWLINE# if os . path . exists ( site_dir ) : #NEWLINE# #INDENT# folder = site_dir #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# folder = os . path . join ( os . path . dirname ( __file__ ) , folder ) #NEWLINE# #UNINDENT# ( sys . path , remainder ) = ( sys . path [ : 1 ] , sys . path [ 1 : ] ) #NEWLINE# site . addsitedir ( folder ) #NEWLINE# sys . path . extend ( remainder )