mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-03 05:45:34 +08:00
Fix setup to allow installing from PyPI
≈ Fix setup to allow installing from PyPi Another attempt at fixing the setuptools problem Fix pip incantation Fix typo Try updating setuptools too Try upgrading pip and setuptools after venv install Rule out install_requires as the source of the problem Try just requiring the ones that can be built from source Use explicit install_requires and move version checks to after setup runs Clean up installation for PyPI compatiblity Dead end commit Fix travis to match new installation procedure Put build_versions check after install Fix travis syntax Switch to lower-case cython in version check Another attempt Another fix Fix syntax error Make header executable Build inplace on py27 Fix finding of source code version in sphinx Fix travis syntax Import setuptools after install Fix the version check in sphinx Work around setuptools bug in 2.7 Fix handling of Cython requirement and update release notes Switch to one Appveyor build and update build method Add cython back to install_requires Remove debug lines Another try for appveyor install Another attempt at setuptools and Appveyor Do not let intermittent apt-get failures crash the build Fix typo Another appveyor attempt More fixes for setuptools and Appveyor Yet another setuptools/appveyor attempt Put requirements.txt back in order Fix typo Fix readlines function call Try not using a venv for python 2.7 Fix syntax Try the provided venv for py27 Remove --user Remove debug info Another try for python27 fix Try again Do not use install_requires with numpy/scipy Try just avoiding scipy Try removing scipy (numpy was before) Avoid both scipy and numpy Fix qt install on 27 Fix qt install on 27 agin Revert the scripts to their previous condition Revert file permission changes Undo changes to requirements.txt
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@ python:
|
||||
- 3.4
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update
|
||||
- sudo apt-get update; true
|
||||
- source tools/travis_before_install.sh
|
||||
|
||||
- which python; python --version
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ How to make a new release of ``skimage``
|
||||
3. Copy ``doc/release/release_template.txt`` to
|
||||
``doc/release/release_dev.txt`` for the next release.
|
||||
|
||||
- Update the version number in ``setup.py`` and ``bento.info`` and commit
|
||||
- Update the version number in ``skimage/__init__.py`` and ``bento.info`` and commit
|
||||
|
||||
- Update the docs:
|
||||
|
||||
|
||||
+10
-9
@@ -13,17 +13,18 @@ environment:
|
||||
PYTHON_VERSION: "2.7"
|
||||
PYTHON_ARCH: "32"
|
||||
|
||||
- PYTHON: "C:\\Python27_64"
|
||||
PYTHON_VERSION: "2.7"
|
||||
PYTHON_ARCH: "64"
|
||||
# disable other builds until they can be run in parallel
|
||||
#- PYTHON: "C:\\Python27_64"
|
||||
# PYTHON_VERSION: "2.7"
|
||||
# PYTHON_ARCH: "64"
|
||||
|
||||
- PYTHON: "C:\\Python34_32"
|
||||
PYTHON_VERSION: "3.4.2"
|
||||
PYTHON_ARCH: "32"
|
||||
#- PYTHON: "C:\\Python34_32"
|
||||
# PYTHON_VERSION: "3.4.2"
|
||||
# PYTHON_ARCH: "32"
|
||||
|
||||
- PYTHON: "C:\\Python24_64"
|
||||
PYTHON_VERSION: "3.4.2"
|
||||
PYTHON_ARCH: "64"
|
||||
#- PYTHON: "C:\\Python24_64"
|
||||
# PYTHON_VERSION: "3.4.2"
|
||||
# PYTHON_ARCH: "64"
|
||||
|
||||
install:
|
||||
# Install Python (from the official .msi of http://python.org) and pip when
|
||||
|
||||
+2
-2
@@ -68,10 +68,10 @@ copyright = '2013, the scikit-image team'
|
||||
#
|
||||
# The short X.Y version.
|
||||
|
||||
setup_lines = open('../../setup.py').readlines()
|
||||
setup_lines = open('../../skimage/__init__.py').readlines()
|
||||
version = 'vUndefined'
|
||||
for l in setup_lines:
|
||||
if l.startswith('VERSION'):
|
||||
if l.startswith('__version__'):
|
||||
version = l.split("'")[1]
|
||||
break
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ if __name__ == '__main__':
|
||||
|
||||
installed_version = V(module.__version__)
|
||||
|
||||
setup_lines = open('../setup.py').readlines()
|
||||
source_lines = open('../skimage/__init__.py').readlines()
|
||||
version = 'vUndefined'
|
||||
for l in setup_lines:
|
||||
if l.startswith('VERSION'):
|
||||
for l in source_lines:
|
||||
if l.startswith('__version__'):
|
||||
source_version = V(l.split("'")[1])
|
||||
break
|
||||
|
||||
|
||||
@@ -17,28 +17,41 @@ MAINTAINER_EMAIL = 'stefan@sun.ac.za'
|
||||
URL = 'http://scikit-image.org'
|
||||
LICENSE = 'Modified BSD'
|
||||
DOWNLOAD_URL = 'http://github.com/scikit-image/scikit-image'
|
||||
VERSION = '0.12dev'
|
||||
PYTHON_VERSION = (2, 6)
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import setuptools
|
||||
from distutils.command.build_py import build_py
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
|
||||
# These are manually checked.
|
||||
# These packages are sometimes installed outside of the setuptools scope
|
||||
DEPENDENCIES = {}
|
||||
with open('requirements.txt', 'rb') as fid:
|
||||
data = fid.read().decode('utf-8', 'replace')
|
||||
for line in data.splitlines():
|
||||
pkg, _, version_info = line.replace('==', '>=').partition('>=')
|
||||
# Only require Cython if we have a developer checkout
|
||||
if pkg.lower() == 'cython' and not VERSION.endswith('dev'):
|
||||
continue
|
||||
DEPENDENCIES[str(pkg).lower()] = str(version_info)
|
||||
with open('skimage/__init__.py') as fid:
|
||||
for line in fid:
|
||||
if line.startswith('__version__'):
|
||||
VERSION = line.strip().split()[-1][1:-1]
|
||||
break
|
||||
|
||||
with open('requirements.txt') as fid:
|
||||
INSTALL_REQUIRES = [l.strip() for l in fid.readlines() if l]
|
||||
|
||||
# development versions do not have the cythonized files
|
||||
if VERSION.endswith('dev'):
|
||||
SETUP_REQUIRES = [r for r in INSTALL_REQUIRES if r.startswith('cython')]
|
||||
else:
|
||||
INSTALL_REQUIRES = [r for r in INSTALL_REQUIRES
|
||||
if not r.startswith('cython')]
|
||||
SETUP_REQUIRES = []
|
||||
|
||||
|
||||
# list requirements for PyPI
|
||||
REQUIRES = [r.replace('>=', ' (>= ') + ')'
|
||||
for r in INSTALL_REQUIRES + SETUP_REQUIRES]
|
||||
REQUIRES = [r.replace('==', ' (== ') for r in REQUIRES]
|
||||
|
||||
|
||||
# do not attempt to install numpy and scipy until they have eggs available
|
||||
INSTALL_REQUIRES = [r for r in INSTALL_REQUIRES
|
||||
if not r.startswith(('scipy', 'numpy'))]
|
||||
|
||||
|
||||
def configuration(parent_package='', top_path=None):
|
||||
@@ -59,72 +72,11 @@ def configuration(parent_package='', top_path=None):
|
||||
return config
|
||||
|
||||
|
||||
def write_version_py(filename='skimage/version.py'):
|
||||
template = """# THIS FILE IS GENERATED FROM THE SKIMAGE SETUP.PY
|
||||
version='%s'
|
||||
"""
|
||||
|
||||
try:
|
||||
vfile = open(os.path.join(os.path.dirname(__file__),
|
||||
filename), 'w')
|
||||
vfile.write(template % VERSION)
|
||||
|
||||
except IOError:
|
||||
raise IOError("Could not open/write to skimage/version.py - did you "
|
||||
"install using sudo in the past? If so, run\n"
|
||||
"sudo chown -R your_username ./*\n"
|
||||
"from package root to fix permissions, and try again.")
|
||||
|
||||
finally:
|
||||
vfile.close()
|
||||
|
||||
|
||||
def get_package_version(package):
|
||||
for version_attr in ('__version__', 'VERSION', 'version'):
|
||||
version_info = getattr(package, version_attr, None)
|
||||
if version_info and str(version_attr) == version_attr:
|
||||
return str(version_info)
|
||||
|
||||
|
||||
def check_requirements():
|
||||
if sys.version_info < PYTHON_VERSION:
|
||||
raise SystemExit('You need Python version %d.%d or later.' \
|
||||
% PYTHON_VERSION)
|
||||
for (package_name, min_version) in DEPENDENCIES.items():
|
||||
if package_name == 'cython':
|
||||
package_name = 'Cython'
|
||||
dep_error = ''
|
||||
if package_name.lower() == 'pillow':
|
||||
package_name = 'PIL.Image'
|
||||
min_version = '1.1.7'
|
||||
try:
|
||||
package = __import__(package_name,
|
||||
fromlist=[package_name.rpartition('.')[0]])
|
||||
except ImportError:
|
||||
dep_error = ('You need `%s` version %s or later.'
|
||||
% (package_name, min_version))
|
||||
else:
|
||||
if package_name == 'PIL':
|
||||
package_version = package.PILLOW_VERSION
|
||||
else:
|
||||
package_version = get_package_version(package)
|
||||
|
||||
if LooseVersion(min_version) > LooseVersion(package_version):
|
||||
dep_error = ('You need `%s` version %s or later,'
|
||||
'found version %s.'
|
||||
% (package_name, min_version,
|
||||
package_version))
|
||||
if dep_error:
|
||||
raise ImportError(dep_error)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
check_requirements()
|
||||
|
||||
write_version_py()
|
||||
|
||||
# purposely fail loudly if numpy or scipy are not available
|
||||
from numpy.distutils.core import setup
|
||||
import scipy
|
||||
|
||||
setup(
|
||||
name=DISTNAME,
|
||||
description=DESCRIPTION,
|
||||
@@ -153,7 +105,9 @@ if __name__ == "__main__":
|
||||
],
|
||||
|
||||
configuration=configuration,
|
||||
install_requires=[dep for dep in DEPENDENCIES],
|
||||
setup_requires=SETUP_REQUIRES,
|
||||
install_requires=INSTALL_REQUIRES,
|
||||
requires=REQUIRES,
|
||||
packages=setuptools.find_packages(exclude=['doc']),
|
||||
include_package_data=True,
|
||||
zip_safe=False, # the package can run out of an .egg file
|
||||
|
||||
+1
-7
@@ -64,13 +64,7 @@ import warnings as _warnings
|
||||
pkg_dir = _osp.abspath(_osp.dirname(__file__))
|
||||
data_dir = _osp.join(pkg_dir, 'data')
|
||||
|
||||
try:
|
||||
from .version import version as __version__
|
||||
except ImportError:
|
||||
__version__ = "unbuilt-dev"
|
||||
else:
|
||||
del version
|
||||
|
||||
__version__ = '0.12dev'
|
||||
|
||||
try:
|
||||
_imp.find_module('nose')
|
||||
|
||||
@@ -36,19 +36,16 @@ if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
sed -i 's/cython>=/cython==/g' requirements.txt
|
||||
sed -i 's/networkx>=/networkx==/g' requirements.txt
|
||||
sed -i '/pillow/d' requirements.txt
|
||||
sudo apt-get install --reinstall python-pkg-resources
|
||||
else
|
||||
virtualenv -p python --system-site-packages ~/venv
|
||||
fi
|
||||
|
||||
source ~/venv/bin/activate
|
||||
retry pip install wheel flake8 coveralls nose sphinx
|
||||
retry pip install wheel flake8 coveralls nose
|
||||
|
||||
# install system tk for matplotlib
|
||||
sudo apt-get install python-tk
|
||||
|
||||
# try to solve #1426
|
||||
sudo apt-get install --reinstall python-pkg-resources
|
||||
|
||||
# on Python 3.2, use matplotlib 1.3.1
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 3.2 ]]; then
|
||||
|
||||
Reference in New Issue
Block a user