1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/usr/bin/python
import sys, os, urllib
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root)
# Work around http://sourceforge.net/p/docutils/bugs/214/
import docutils.utils
import admin, store, config
cfg = config.Config(root+'/config.ini')
st = store.Store(cfg)
# classifiers
for c in urllib.urlopen("http://pypi.python.org/pypi?%3Aaction=list_classifiers").read().splitlines():
admin.add_classifier(st, c)
# Demo data starts here
# an admin
otk = st.store_user('fred', 'fredpw', 'fred@python.test')
st.delete_otk(otk)
st.add_role('fred', 'Admin', None)
# an owner
otk = st.store_user('barney', 'barneypw', 'barney@python.test')
st.delete_otk(otk)
# package spam
st.set_user('barney', '127.0.0.1', True)
for version in ('0.8', '0.9', '1.0'):
st.store_package('spam', version, {
'author':'Barney Geroellheimer',
'author_email':'barney@python.test',
'homepage':'http://spam.python.test/',
'license':'GPL',
'summary':'The spam package',
'description': 'spam '*500,
'classifiers':["Development Status :: 6 - Mature",
"Programming Language :: Python :: 2"],
'_pypi_hidden':False
})
# package eggs
for version in ('0.1', '0.2', '0.3', '0.4'):
st.store_package('eggs', version, {
'author':'Barney Geroellheimer',
'author_email':'barney@python.test',
'homepage':'http://eggs.python.test/',
'license':'GPL',
'summary':'The eggs package',
'description':'Does anybody want to provide real data here?',
'classifiers':["Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3"],
'requires_dist':['spam'],
'_pypi_hidden':version!='0.4'
})
st.add_file('spam', '1.0', 'THIS IS SOME CONTENT', '12e6ed27f5a127cab06e449171b35b6d', 'sdist',
'any', '', 'demo.txt', None)
st.commit()
|