#NEWLINE# def setUpModule( ) : #NEWLINE# #INDENT# engine = create_engine ( settings ) #NEWLINE# populate ( engine , interactive = False ) #NEWLINE# session = DBSession ( ) #NEWLINE# admin_user = User . by_login ( session , 'admin' ) #NEWLINE# local_user = User ( login = 'local_user' , password = 'secret' , local = True , firstname = 'Local' , lastname = 'User' ) #NEWLINE# local_user . groups . append ( Group . by_name ( session , 'developer' ) ) #NEWLINE# jdo = User ( login = 'johndo' , local = False ) #NEWLINE# jdoe = User ( login = 'janedoe' , local = False ) #NEWLINE# session . add ( local_user ) #NEWLINE# session . add ( jdoe ) #NEWLINE# session . add ( local_user ) #NEWLINE# classifiers_names = [ 'Programming Language :: Python' , 'Programming Language :: Python :: 2.6' , 'Programming Language :: Python :: 2.7' , 'Topic :: Software Development' , 'Topic :: System :: Archiving :: Mirroring' , 'Topic :: System :: Archiving :: Packaging' , 'Intended Audience :: Developers' , 'Intended Audience :: System Administrators' ] #NEWLINE# classifiers = [ Classifier . by_name ( session , name = c , create_if_not_exists = True ) for c in classifiers_names ] #NEWLINE# pack1 = Package ( name = 'mirrored_package1' ) #NEWLINE# pack1 . owners . append ( jdo ) #NEWLINE# pack1 . owners . append ( jdoe ) #NEWLINE# pack1 . downloads = 7 #NEWLINE# session . add ( pack1 ) #NEWLINE# release1 = Release ( package = pack1 , version = '0.1' , summary = 'Common Usage Library' , author = jdoe ) #NEWLINE# for c in classifiers [ : 3 ] : #NEWLINE# #INDENT# release1 . classifiers . append ( c ) #NEWLINE# #UNINDENT# session . add ( release1 ) #NEWLINE# release1 . files . append ( ReleaseFile ( filename = 'mirrored_package1-0.1.tar.gz' , package_type = 'sdist' ) ) #NEWLINE# session . add ( release1 ) #NEWLINE# release2 = Release ( package = pack1 , version = '0.2' , summary = 'Common Usage Library' ) #NEWLINE# for c in classifiers [ : 5 ] : #NEWLINE# #INDENT# release2 . classifiers . append ( c ) #NEWLINE# #UNINDENT# release2 . files . append ( ReleaseFile ( filename = 'mirrored_package1-0.2.tar.gz' , package_type = 'sdist' ) ) #NEWLINE# release2 . files . append ( ReleaseFile ( filename = 'mirrored_package1-0.2.egg' , package_type = 'bdist_egg' ) ) #NEWLINE# session . add ( release2 ) #NEWLINE# pack2 = Package ( name = 'mirrored_package2' ) #NEWLINE# pack2 . owners . append ( jdo ) #NEWLINE# pack2 . maintainers . append ( jdoe ) #NEWLINE# pack2 . downloads = 1 #NEWLINE# session . add ( pack2 ) #NEWLINE# release3 = Release ( package = pack2 , version = '1.0' , summary = 'Web Framework For Everybody' ) #NEWLINE# for c in ( classifiers [ : 3 ] + classifiers [ ( - 2 ) : ( - 2 ) ] ) : #NEWLINE# #INDENT# release3 . classifiers . append ( c ) #NEWLINE# #UNINDENT# session . add ( release3 ) #NEWLINE# release3 . files . append ( ReleaseFile ( filename = 'mirrored_package2-1.0.tar.gz' , package_type = 'sdist' ) ) #NEWLINE# session . add ( release3 ) #NEWLINE# pack3 = Package ( name = 'local_package1' , local = True ) #NEWLINE# pack3 . owners . append ( local_user ) #NEWLINE# pack3 . owners . append ( admin_user ) #NEWLINE# session . add ( pack3 ) #NEWLINE# release4 = Release ( package = pack3 , version = '0.1' , summary = 'Pet Shop Application' ) #NEWLINE# for c in classifiers : #NEWLINE# #INDENT# release4 . classifiers . append ( c ) #NEWLINE# #UNINDENT# release4 . files . append ( ReleaseFile ( filename = 'local_package1-0.1.tar.gz' , package_type = 'sdist' ) ) #NEWLINE# session . add ( release4 ) #NEWLINE# session . commit ( )