Added exception handling into the metadata format checking function.
[mediagoblin.git] / setup.py
CommitLineData
8e1e744d 1# GNU MediaGoblin -- federated, autonomous media hosting
7f4ebeed 2# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
e5572c60
ML
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU Affero General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Affero General Public License for more details.
13#
14# You should have received a copy of the GNU Affero General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
c1b342ba 17from setuptools import setup, find_packages
cf37fffc
WKG
18import os
19import re
20
21READMEFILE = "README"
22VERSIONFILE = os.path.join("mediagoblin", "_version.py")
23VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
24
25
26def get_version():
27 verstrline = open(VERSIONFILE, "rt").read()
28 mo = re.search(VSRE, verstrline, re.M)
29 if mo:
30 return mo.group(1)
31 else:
243c3843
NY
32 raise RuntimeError("Unable to find version string in %s." %
33 VERSIONFILE)
cf37fffc 34
26990bc0
AL
35try:
36 setup(
243c3843
NY
37 name="mediagoblin",
38 version=get_version(),
c1b342ba 39 packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
31a8ff42 40 zip_safe=False,
d595374d 41 include_package_data = True,
0c04118b 42 # scripts and dependencies
243c3843 43 install_requires=[
0c04118b 44 'setuptools',
edb55f7f 45 'python-dateutil',
0c04118b 46 'PasteScript',
0c04118b 47 'wtforms',
6755f50e 48 'py-bcrypt',
cd1fda4d 49 'pytest>=2.3.1',
39a71c09 50 'pytest-xdist',
df7e06c4 51 'werkzeug>=0.7',
6a01fafc 52 'celery>=3.0',
904caab6 53 'kombu',
132a68b5
CAW
54 'jinja2',
55 'sphinx',
5d044693 56 'Babel>=1.0',
029cad45 57 'argparse',
db9ab08a 58 'webtest<2',
f970e6e5 59 'ConfigObj',
44e2da2f 60 'Markdown',
157794d7 61 'sqlalchemy<0.9.0, >0.8.0',
b19491c5
CAW
62 # newer sqlalchemy-migrate requires pbr which BREAKS EVERYTHING AND IS
63 # TERRIBLE AND IS THE END OF ALL THINGS
64 # I'd love to remove this restriction.
65 'sqlalchemy-migrate<0.8',
394a4a37 66 'mock',
c7424612 67 'itsdangerous',
f1c3807d 68 'pytz',
ec5a385a 69 'six>=1.4.1',
6b61a51e 70 'oauthlib==0.5.0',
2636dddf 71 'unidecode',
ec5a385a 72 'jsonschema',
052d3d98 73 'ExifRead',
9caaff48
CAW
74
75 # PLEASE change this when we can; a dependency is forcing us to set this
76 # specific number and it is breaking setup.py develop
77 'six==1.5.2'
0b3b9a29 78
cebd1ad7
CAW
79 ## Annoying. Please remove once we can! We only indirectly
80 ## use pbr, and currently it breaks things, presumably till
81 ## their next release.
82 # 'pbr==0.5.22',
83
e535b9b3
CAW
84 ## This is optional!
85 # 'translitcodec',
d45e3966
CAW
86 ## For now we're expecting that users will install this from
87 ## their package managers.
88 # 'lxml',
33e902e3 89 # 'PIL',
0c04118b 90 ],
1b766201 91 # requires=['gst'],
4b5f4e87 92 test_suite='nose.collector',
243c3843 93 entry_points="""\
b7e57b1f
WKG
94 [console_scripts]
95 gmg = mediagoblin.gmg_commands:main_cli
fbeeacd7 96 pybabel = mediagoblin.babel.messages.frontend:main
029cad45 97
b7e57b1f
WKG
98 [paste.app_factory]
99 app = mediagoblin.app:paste_app_factory
df0953ce 100
72ae87af
CAW
101 [paste.filter_app_factory]
102 errors = mediagoblin.errormiddleware:mgoblin_error_middleware
103
b7e57b1f
WKG
104 [zc.buildout]
105 make_user_dev_dirs = mediagoblin.buildout_recipes:MakeUserDevDirs
84d4f04e 106
b7e57b1f
WKG
107 [babel.extractors]
108 jinja2 = jinja2.ext:babel_extract
109 """,
b7e57b1f
WKG
110 license='AGPLv3',
111 author='Free Software Foundation and contributors',
112 author_email='cwebber@gnu.org',
113 url="http://mediagoblin.org/",
114 download_url="http://mediagoblin.org/download/",
cf37fffc 115 long_description=open(READMEFILE).read(),
b7e57b1f
WKG
116 classifiers=[
117 "Development Status :: 3 - Alpha",
118 "Environment :: Web Environment",
1ac1f00e 119 "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
b7e57b1f
WKG
120 "Operating System :: OS Independent",
121 "Programming Language :: Python",
3031764d
WKG
122 'Programming Language :: Python :: 2.6',
123 'Programming Language :: Python :: 2.7',
b7e57b1f
WKG
124 "Topic :: Internet :: WWW/HTTP :: Dynamic Content"
125 ],
31a8ff42 126 )
26990bc0
AL
127except TypeError, e:
128 # Check if the problem is caused by the sqlalchemy/setuptools conflict
129 msg_as_str = str(e)
130 if not (msg_as_str == 'dist must be a Distribution instance'):
131 raise
132
133 # If so, tell the user it is OK to just run the script again.
134 print "\n\n---------- NOTE ----------"
135 print "The setup.py command you ran failed."
136 print ""
137 print ("It is a known possible failure. Just run it again. It works the "
138 "second time.")
139 import sys
140 sys.exit(1)