提交 3911f7a9 authored 作者: David Warde-Farley's avatar David Warde-Farley

Brand-spanking new setup.py file.

上级 8da50633
...@@ -2,20 +2,130 @@ ...@@ -2,20 +2,130 @@
# #
# TODO: # TODO:
# * Figure out how to compile and install documentation automatically # * Figure out how to compile and install documentation automatically
# * Add back in installation requirements
# * Add download_url # * Add download_url
import os
import subprocess
from distutils.core import setup CLASSIFIERS = """\
Development Status :: 4 - Beta
Intended Audience :: Science/Research
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Programming Language :: Python
Topic :: Software Development :: Code Generators
Topic :: Software Development :: Compilers
Topic :: Scientific/Engineering :: Mathematics
Operating System :: Microsoft :: Windows
Operating System :: POSIX
Operating System :: Unix
Operating System :: MacOS
"""
NAME = 'Theano'
MAINTAINER = "LISA laboratory, University of Montreal"
MAINTAINER_EMAIL = "theano-dev@googlegroups.com"
DESCRIPTION = 'Optimizing compiler for mathematical expressions'
LONG_DESCRIPTION = ""
URL = "http://deeplearning.net/software/theano/"
DOWNLOAD_URL = ""
LICENSE = 'BSD'
CLASSIFIERS = filter(None, CLASSIFIERS.split('\n'))
AUTHOR = "LISA laboratory, University of Montreal"
AUTHOR_EMAIL = "thaeno-dev@googlegroups.com"
PLATFORMS = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"]
MAJOR = 0
MINOR = 3
MICRO = 0
ISRELEASED = False
setup(name='Theano', if MICRO > 0:
version='hg', VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
description='Optimizing compiler for mathematical expressions', else:
author='LISA laboratory, University of Montreal', VERSION = "%d.%d" % (MAJOR, MINOR)
author_email='theano-dev@googlegroups.com',
url='http://www.deeplearning.net/software/theano', # Return the hg revision as a string -- borrowed from hg_version in NumPy's
packages=['theano', 'theano.tensor', 'theano.gof', # setup.py file
'theano.compile', 'theano.misc', 'theano.scalar', def hg_version():
'theano.sparse', def _minimal_ext_cmd(cmd):
'theano.tensor.nnet', 'theano.tensor.signal'], # construct minimal environment
env = {}
for k in ['SYSTEMROOT', 'PATH', 'PYTHONPATH']:
v = os.environ.get(k)
if v is not None:
env[k] = v
# LANGUAGE is used on win32
env['LANGUAGE'] = 'C'
env['LANG'] = 'C'
env['LC_ALL'] = 'C'
out = subprocess.Popen(
cmd,
stdout = subprocess.PIPE,
env=env
).communicate()[0]
return out
try:
out = _minimal_ext_cmd(['hg', '-q', 'id'])
HG_REVISION = out.strip().decode('ascii')
except OSError:
HG_REVISION = "unknown-hg"
return HG_REVISION
def write_version_py(filename='theano/version.py'):
cnt = """
# THIS FILE IS GENERATED FROM THEANO SETUP.PY
short_version = '%(version)s'
version = '%(version)s'
hg_revision = '%(hg_revision)s'
full_version = '%(version)s.dev-%%(hg_revision)s' %% {'hg_revision': hg_revision}
release = %(isrelease)s
if not release:
version = full_version
"""
FULL_VERSION = VERSION
if not ISRELEASED:
if os.path.exists('.hg'):
HG_REVISION = hg_version()
elif os.path.exists(filename):
# must be a source distribution, use existing version file
from theano.version import hg_revision as HG_REVISION
else:
HG_REVISION = "unknown-hg"
FULL_VERSION += '.dev-' + HG_REVISION
a = open(filename, 'w')
try:
a.write(cnt % {'version': VERSION,
'full_version' : FULL_VERSION,
'hg_revision' : HG_REVISION,
'isrelease': str(ISRELEASED)})
except Exception, e:
print e
finally:
a.close()
def do_setup():
write_version_py()
from setuptools import setup, find_packages
setup(name=NAME,
version=VERSION,
description=DESCRIPTION,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
license=LICENSE,
packages=find_packages(),
install_requires=['numpy>=1.3.0', 'scipy>=0.7.0'],
package_data={
'': ['*.txt', '*.rst', '*.cu', '*.cuh', '*.sh'],
'theano.misc': ['*.sh']
},
keywords=' '.join([
'theano', 'math', 'numerical', 'symbolic', 'blas',
'numpy', 'gpu', 'autodiff', 'differentiation'
])
) )
if __name__ == "__main__":
do_setup()
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论