Content-Length: 327989 | pFad | http://github.com/thelxinoe/nipype/commit/f550c81d342f5ebdcdb2609c76b593b191d52dd2

D8 fix: install to work with pip · thelxinoe/nipype@f550c81 · GitHub
Skip to content

Commit

Permalink
fix: install to work with pip
Browse files Browse the repository at this point in the history
  • Loading branch information
satra committed Mar 30, 2014
1 parent 07143af commit f550c81
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 16 deletions.
5 changes: 3 additions & 2 deletions nipype/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def get_nipype_gitversion():
MICRO = _version_micro
ISRELEASE = _version_extra == ''
VERSION = __version__
REQUIRES = ["nibabel (>=1.0)", "networkx (>=1.0)", "numpy (>=1.3)",
"scipy (>=0.7)", "traits (>=4.0)"]
REQUIRES = ["nibabel>=1.0", "networkx>=1.0", "numpy>=1.3",
"python-dateutil>1.0", "scipy>=0.7", "traits>=4.0",
"nose>=1.0"]
STATUS = 'stable'
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ numpy>=1.3
scipy>=0.7
networkx>=1.0
traits>=4.0
dateutil>=1.5
python-dateutil>=1.5
nibabel>=1.0
nose>=1.0
74 changes: 61 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,69 @@

import sys
from glob import glob
from os.path import join as pjoin

# Import build helpers
try:
from nisext.sexts import package_check, get_comrec_build
from ConfigParser import ConfigParser
except ImportError:
raise RuntimeError('Need nisext package from nibabel installation'
' - please install nibabel first')
from configparser import ConfigParser

from distutils.command.build_py import build_py

def get_comrec_build(pkg_dir, build_cmd=build_py):
""" Return extended build command class for recording commit
The extended command tries to run git to find the current commit, getting
the empty string if it fails. It then writes the commit hash into a file
in the `pkg_dir` path, named ``COMMIT_INFO.txt``.
In due course this information can be used by the package after it is
installed, to tell you what commit it was installed from if known.
To make use of this system, you need a package with a COMMIT_INFO.txt file -
e.g. ``myproject/COMMIT_INFO.txt`` - that might well look like this::
# This is an ini file that may contain information about the code state
[commit hash]
# The line below may contain a valid hash if it has been substituted
during 'git archive' archive_subst_hash=$Format:%h$
# This line may be modified by the install process
install_hash=
The COMMIT_INFO file above is also designed to be used with git substitution
- so you probably also want a ``.gitattributes`` file in the root directory
of your working tree that contains something like this::
myproject/COMMIT_INFO.txt export-subst
That will cause the ``COMMIT_INFO.txt`` file to get filled in by ``git
archive`` - useful in case someone makes such an archive - for example with
via the github 'download source' button.
Although all the above will work as is, you might consider having something
like a ``get_info()`` function in your package to display the commit
information at the terminal. See the ``pkg_info.py`` module in the nipy
package for an example.
"""
class MyBuildPy(build_cmd):
''' Subclass to write commit data into installation tree '''
def run(self):
build_cmd.run(self)
import subprocess
proc = subprocess.Popen('git rev-parse HEAD',
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True)
repo_commit, _ = proc.communicate()
# Fix for python 3
repo_commit = str(repo_commit)
# We write the installation commit even if it's empty
cfg_parser = ConfigParser()
cfg_parser.read(pjoin(pkg_dir, 'COMMIT_INFO.txt'))
cfg_parser.set('commit hash', 'install_hash', repo_commit)
out_pth = pjoin(self.build_lib, pkg_dir, 'COMMIT_INFO.txt')
cfg_parser.write(open(out_pth, 'wt'))
return MyBuildPy

from build_docs import cmdclass, INFO_VARS

Expand Down Expand Up @@ -55,12 +111,6 @@ def configuration(parent_package='',top_path=None):
if not 'extra_setuptools_args' in globals():
extra_setuptools_args = dict()

# Hard and soft dependency checking
package_check('networkx', INFO_VARS['NETWORKX_MIN_VERSION'])
package_check('nibabel', INFO_VARS['NIBABEL_MIN_VERSION'])
package_check('numpy', INFO_VARS['NUMPY_MIN_VERSION'])
package_check('scipy', INFO_VARS['SCIPY_MIN_VERSION'])
package_check('traits', INFO_VARS['TRAITS_MIN_VERSION'])

################################################################################
# Import the documentation building classes.
Expand Down Expand Up @@ -91,13 +141,11 @@ def main(**extra_args):
author_email=INFO_VARS['AUTHOR_EMAIL'],
platforms=INFO_VARS['PLATFORMS'],
version=INFO_VARS['VERSION'],
requires=INFO_VARS['REQUIRES'],
install_requires=INFO_VARS['REQUIRES'],
configuration = configuration,
cmdclass = cmdclass,
scripts = glob('bin/*'),
**extra_args)



if __name__ == "__main__":
main(**extra_setuptools_args)

0 comments on commit f550c81

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/thelxinoe/nipype/commit/f550c81d342f5ebdcdb2609c76b593b191d52dd2

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy