提交 6e1aaa8a authored 作者: Frédéric Bastien's avatar Frédéric Bastien 提交者: GitHub

Merge pull request #6415 from abergeron/conda_pkgs

Add the setup to build conda packages
version: 2
jobs:
build_pkgs:
docker:
- image: milaudem/theano:0
steps:
- checkout
- run:
name: "Checkout Merge Commit"
command: |
if [[ -n "${CIRCLE_PR_NUMBER}" ]]
then
git fetch -u origin "+refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge"
git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge"
fi
- run:
name: "Build Recipe"
command: |
export THEANO_VERSION=`python -c 'import versioneer; print(versioneer.get_version())'`
conda build conda
- run:
name: "Upload Tagged Versions"
command: |
if [[ -n "${CIRCLE_TAG}" ]]
then
anaconda -t $BINSTAR_TOKEN upload --user=mila-udem /miniconda/conda-bld/noarch/theano*
fi
- store_artifacts:
path: /miniconda/conda-bld/noarch
workflows:
version: 2
build_and_test:
jobs:
- build_pkgs:
filters:
tags:
only: /.*/
\ No newline at end of file
theano/_version.py export-subst
...@@ -11,3 +11,5 @@ include bin/theano-cache ...@@ -11,3 +11,5 @@ include bin/theano-cache
include bin/theano-nose include bin/theano-nose
prune .jenkins prune .jenkins
prune .travis prune .travis
include versioneer.py
include theano/_version.py
{% set version = "0.10.0beta1" %}
package: package:
name: theano name: theano
version: {{ version }} version: {{ environ.get('THEANO_VERSION') }}
source: source:
git_url: https://github.com/Theano/Theano.git path: ../
git_tag: rel-{{ version }}
build: build:
noarch: python noarch: python
...@@ -14,15 +11,9 @@ build: ...@@ -14,15 +11,9 @@ build:
requirements: requirements:
build: build:
- m2-filesystem [win]
- m2-git [win]
- git [not win]
- python - python
- setuptools - setuptools
- six >=1.9.0 - six >=1.9.0
- numpy >=1.9.1
- scipy >=0.14.0
- pygpu >=0.6,<0.7
run: run:
- python - python
- mkl-service - mkl-service
...@@ -31,7 +22,7 @@ requirements: ...@@ -31,7 +22,7 @@ requirements:
- six >=1.9.0 - six >=1.9.0
- numpy >=1.9.1 - numpy >=1.9.1
- scipy >=0.14.0 - scipy >=0.14.0
- pygpu >=0.6,<0.7 - {{ pin_compatible('pygpu', '0.7', max_pin='0.8') }} # [not osx]
test: test:
requires: requires:
......
...@@ -26,6 +26,7 @@ import theano ...@@ -26,6 +26,7 @@ import theano
theano_path = os.path.join(os.path.dirname(__file__), os.pardir) theano_path = os.path.join(os.path.dirname(__file__), os.pardir)
sys.path.append(os.path.abspath(theano_path)) sys.path.append(os.path.abspath(theano_path))
import versioneer
# General configuration # General configuration
# --------------------- # ---------------------
...@@ -71,10 +72,17 @@ copyright = '2008--2017, LISA lab' ...@@ -71,10 +72,17 @@ copyright = '2008--2017, LISA lab'
# The default replacements for |version| and |release|, also used in various # The default replacements for |version| and |release|, also used in various
# other places throughout the built documents. # other places throughout the built documents.
# #
# The short X.Y version.
version = '0.10' # We need this hokey-pokey because versioneer needs the current
# directory to be the root of the project to work.
_curpath = os.getcwd()
os.chdir(os.path.dirname(os.path.dirname(__file__)))
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.10.0beta2' release = versioneer.get_version()
# The short X.Y version.
version = '.'.join(release.split('.')[:2])
os.chdir(_curpath)
del _curpath
# There are two options for replacing |today|: either, you set today to some # There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used: # non-false value, then it is used:
......
...@@ -28,14 +28,8 @@ It does not have to be in your PYTHONPATH. ...@@ -28,14 +28,8 @@ It does not have to be in your PYTHONPATH.
Update the version number Update the version number
========================= =========================
Edit ``setup.py`` to contain the newest version number ::
cd Theano-0.X
vi setup.py # Edit the MAJOR, MINOR, MICRO and SUFFIX
``Theano/doc/conf.py`` should be updated in the following ways: ``Theano/doc/conf.py`` should be updated in the following ways:
* Change the ``version`` and ``release`` variables to new version number.
* Change the upper copyright year to the current year if necessary. * Change the upper copyright year to the current year if necessary.
Update the year in the ``Theano/LICENSE.txt`` file too, if necessary. Update the year in the ``Theano/LICENSE.txt`` file too, if necessary.
...@@ -54,11 +48,14 @@ You will need to commit the previous changes, tag the resulting version, and ...@@ -54,11 +48,14 @@ You will need to commit the previous changes, tag the resulting version, and
push that into the original repository. The syntax is something like the push that into the original repository. The syntax is something like the
following:: following::
git commit -m "Modifications for 0.X.Y release" setup.py doc/conf.py NEWS.txt HISTORY.txt theano/configdefaults.py doc/library/config.txt git commit -m "Modifications for 0.X.Y release" doc/conf.py NEWS.txt HISTORY.txt theano/configdefaults.py doc/library/config.txt
git tag -a rel-0.X.Y git tag -a rel-0.X.Y
git push git push
git push --tags git push --tags
This will trigger and build and upload of the conda package to the
mila-udem channel.
The documentation will be automatically regenerated in the next few hours. The documentation will be automatically regenerated in the next few hours.
Generate and upload the package Generate and upload the package
......
...@@ -4,3 +4,10 @@ nocapture=1 ...@@ -4,3 +4,10 @@ nocapture=1
[flake8] [flake8]
ignore=E501,E123,E133,FI12,FI14,FI15,FI50,FI51,FI53 ignore=E501,E123,E133,FI12,FI14,FI15,FI50,FI51,FI53
[versioneer]
VCS = git
style = pep440
versionfile_source = theano/_version.py
versionfile_build = theano/_version.py
tag_prefix = rel-
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
import os import os
import subprocess
import codecs import codecs
from fnmatch import fnmatchcase from fnmatch import fnmatchcase
from distutils.util import convert_path from distutils.util import convert_path
...@@ -15,6 +14,8 @@ try: ...@@ -15,6 +14,8 @@ try:
except ImportError: except ImportError:
from distutils.core import setup from distutils.core import setup
import versioneer
CLASSIFIERS = """\ CLASSIFIERS = """\
Development Status :: 4 - Beta Development Status :: 4 - Beta
...@@ -35,6 +36,7 @@ Programming Language :: Python :: 2.7 ...@@ -35,6 +36,7 @@ Programming Language :: Python :: 2.7
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
""" """
NAME = 'Theano' NAME = 'Theano'
MAINTAINER = "LISA laboratory, University of Montreal" MAINTAINER = "LISA laboratory, University of Montreal"
...@@ -50,13 +52,6 @@ CLASSIFIERS = [_f for _f in CLASSIFIERS.split('\n') if _f] ...@@ -50,13 +52,6 @@ CLASSIFIERS = [_f for _f in CLASSIFIERS.split('\n') if _f]
AUTHOR = "LISA laboratory, University of Montreal" AUTHOR = "LISA laboratory, University of Montreal"
AUTHOR_EMAIL = "theano-dev@googlegroups.com" AUTHOR_EMAIL = "theano-dev@googlegroups.com"
PLATFORMS = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"] PLATFORMS = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"]
MAJOR = 0
MINOR = 10
MICRO = 0
SUFFIX = "beta2" # Should be blank except for rc's, betas, etc.
ISRELEASED = False
VERSION = '%d.%d.%d%s' % (MAJOR, MINOR, MICRO, SUFFIX)
def find_packages(where='.', exclude=()): def find_packages(where='.', exclude=()):
...@@ -67,91 +62,17 @@ def find_packages(where='.', exclude=()): ...@@ -67,91 +62,17 @@ def find_packages(where='.', exclude=()):
for name in os.listdir(where): for name in os.listdir(where):
fn = os.path.join(where, name) fn = os.path.join(where, name)
if ('.' not in name and os.path.isdir(fn) and if ('.' not in name and os.path.isdir(fn) and
os.path.isfile(os.path.join(fn, '__init__.py')) os.path.isfile(os.path.join(fn, '__init__.py'))):
): out.append(prefix + name)
out.append(prefix+name) stack.append((fn, prefix + name + '.'))
stack.append((fn, prefix+name+'.'))
for pat in list(exclude) + ['ez_setup', 'distribute_setup']: for pat in list(exclude) + ['ez_setup', 'distribute_setup']:
out = [item for item in out if not fnmatchcase(item, pat)] out = [item for item in out if not fnmatchcase(item, pat)]
return out return out
def git_version():
"""
Return the sha1 of local git HEAD as a string.
"""
# josharian: I doubt that the minimal environment stuff here is
# still needed; it is inherited. This was originally
# an hg_version function borrowed from NumPy's setup.py.
# I'm leaving it in for now because I don't have enough other
# environments to test in to be confident that it is safe to remove.
def _minimal_ext_cmd(cmd):
# 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(['git', 'rev-parse', 'HEAD'])
git_revision = out.strip().decode('ascii')
except OSError:
git_revision = "unknown-git"
return git_revision
def write_text(filename, text):
try:
with open(filename, 'w') as a:
a.write(text)
except Exception as e:
print(e)
def write_version_py(filename=os.path.join('theano', 'generated_version.py')):
cnt = """
# THIS FILE IS GENERATED FROM THEANO SETUP.PY
short_version = '%(version)s'
version = '%(version)s'
git_revision = '%(git_revision)s'
full_version = '%(version)s.dev-%%(git_revision)s' %% {
'git_revision': git_revision}
release = %(isrelease)s
if not release:
version = full_version
"""
FULL_VERSION = VERSION
if os.path.isdir('.git'):
GIT_REVISION = git_version()
elif os.path.exists(filename):
# must be a source distribution, use existing version file
GIT_REVISION = "RELEASE"
else:
GIT_REVISION = "unknown-git"
FULL_VERSION += '.dev-' + GIT_REVISION
text = cnt % {'version': VERSION,
'full_version': FULL_VERSION,
'git_revision': GIT_REVISION,
'isrelease': str(ISRELEASED)}
write_text(filename, text)
def do_setup(): def do_setup():
write_version_py()
setup(name=NAME, setup(name=NAME,
version=VERSION, version=versioneer.get_version(),
description=DESCRIPTION, description=DESCRIPTION,
long_description=LONG_DESCRIPTION, long_description=LONG_DESCRIPTION,
classifiers=CLASSIFIERS, classifiers=CLASSIFIERS,
...@@ -161,6 +82,7 @@ def do_setup(): ...@@ -161,6 +82,7 @@ def do_setup():
license=LICENSE, license=LICENSE,
platforms=PLATFORMS, platforms=PLATFORMS,
packages=find_packages(), packages=find_packages(),
cmdclass=versioneer.get_cmdclass(),
install_requires=['numpy>=1.9.1', 'scipy>=0.14', 'six>=1.9.0'], install_requires=['numpy>=1.9.1', 'scipy>=0.14', 'six>=1.9.0'],
# pygments is a dependency for Sphinx code highlight # pygments is a dependency for Sphinx code highlight
extras_require={ extras_require={
...@@ -171,7 +93,7 @@ def do_setup(): ...@@ -171,7 +93,7 @@ def do_setup():
'': ['*.txt', '*.rst', '*.cu', '*.cuh', '*.c', '*.sh', '*.pkl', '': ['*.txt', '*.rst', '*.cu', '*.cuh', '*.c', '*.sh', '*.pkl',
'*.h', '*.cpp', 'ChangeLog', 'c_code/*'], '*.h', '*.cpp', 'ChangeLog', 'c_code/*'],
'theano.misc': ['*.sh'], 'theano.misc': ['*.sh'],
'theano.d3viz' : ['html/*','css/*','js/*'] 'theano.d3viz': ['html/*', 'css/*', 'js/*']
}, },
entry_points={ entry_points={
'console_scripts': ['theano-cache = bin.theano_cache:main', 'console_scripts': ['theano-cache = bin.theano_cache:main',
...@@ -182,5 +104,7 @@ def do_setup(): ...@@ -182,5 +104,7 @@ def do_setup():
'numpy', 'gpu', 'autodiff', 'differentiation' 'numpy', 'gpu', 'autodiff', 'differentiation'
]), ]),
) )
if __name__ == "__main__": if __name__ == "__main__":
do_setup() do_setup()
...@@ -245,3 +245,7 @@ def sparse_grad(var): ...@@ -245,3 +245,7 @@ def sparse_grad(var):
__import__('theano.tensor.shared_randomstreams') __import__('theano.tensor.shared_randomstreams')
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
差异被折叠。
...@@ -87,6 +87,7 @@ def init_dev(dev, name=None, preallocate=None): ...@@ -87,6 +87,7 @@ def init_dev(dev, name=None, preallocate=None):
context = pygpu.init( context = pygpu.init(
dev, dev,
sched=config.gpuarray.sched, sched=config.gpuarray.sched,
single_stream=config.gpuarray.single_stream,
**args) **args)
context.dev = dev context.dev = dev
init_dev.devmap[dev] = context init_dev.devmap[dev] = context
......
...@@ -34,8 +34,8 @@ ignore = ('E501', 'E123', 'E133', 'FI12', 'FI14', 'FI15', 'FI16', 'FI17', ...@@ -34,8 +34,8 @@ ignore = ('E501', 'E123', 'E133', 'FI12', 'FI14', 'FI15', 'FI16', 'FI17',
'FI50', 'FI51', 'FI53') 'FI50', 'FI51', 'FI53')
whitelist_flake8 = [ whitelist_flake8 = [
"compat/six.py", # This is bundled code that will be deleted, don't fix it
"__init__.py", "__init__.py",
"_version.py", # This is generated by versioneer
"tests/__init__.py", "tests/__init__.py",
"compile/__init__.py", "compile/__init__.py",
"compile/sandbox/__init__.py", "compile/sandbox/__init__.py",
......
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
from theano._version import get_versions
info = get_versions()
full_version = info['version']
git_revision = info['full-revisionid']
del info, get_versions
short_version = full_version.split('+')[0]
# This tries to catch a tag like beta2, rc1, ...
try: try:
from theano.generated_version import * # noqa int(short_version.split('.')[2])
except ImportError: release = True
short_version = 'unknown' except ValueError:
version = 'unknown'
git_revision = 'unknown'
full_version = 'unknown'
release = False release = False
if release:
version = short_version
else:
version = full_version
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论