Commit a40f4f0c authored by Paul McCarthy's avatar Paul McCarthy
Browse files

fslpy is now apache2

parent e3e4ccb5
Copyright 2016-2017 University of Oxford, Oxford, UK
The fslpy library
Copyright 2016-2017 University of Oxford, Oxford, UK.
Part of FSL - FMRIB's Software Library
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
Imaging of the Brain), Department of Clinical Neurology, Oxford
University, Oxford, UK
FMRIB Software Library, Release 5.0 (c) 2012, The University of
Oxford (the "Software")
The Software remains the property of the University of Oxford ("the
The Software is distributed "AS IS" under this Licence solely for
non-commercial use in the hope that it will be useful, but in order
that the University as a charitable foundation protects its assets for
the benefit of its educational and research purposes, the University
makes clear that no condition is made or to be implied, nor is any
warranty given or to be implied, as to the accuracy of the Software,
or that it will be suitable for any particular purpose or for use
under any specific conditions. Furthermore, the University disclaims
all responsibility for the use which is made of the Software. It
further disclaims any liability for the outcomes arising from using
the Software.
The Licensee agrees to indemnify the University and hold the
University harmless from and against any and all claims, damages and
liabilities asserted by third parties (including claims for
negligence) which arise directly or indirectly from the use of the
Software or the sale of any products based on the Software.
No part of the Software may be reproduced, modified, transmitted or
transferred in any form or by any means, electronic or mechanical,
without the express permission of the University. The permission of
the University is not required if the said reproduction, modification,
transmission or transference is done without financial return, the
conditions of this Licence are imposed upon the receiver of the
product, and all original and amended source code is included in any
transmitted product. You may be held legally responsible for any
copyright infringement that is caused or encouraged by your failure to
abide by these terms and conditions.
You are not permitted under this Licence to use this Software
commercially. Use for which any financial return is received shall be
defined as commercial use, and includes (1) integration of all or part
of the source code or the Software into a product for sale or license
by or on behalf of Licensee to third parties or (2) use of the
Software or any derivative of it for research with the final aim of
developing software products for sale or license to a third party or
(3) use of the Software or any derivative of it for research with the
final aim of developing non-software products for sale or license to a
third party, or (4) use of the Software to provide any service to an
external organisation for which payment is received. If you are
interested in using the Software commercially, please contact Isis
Innovation Limited ("Isis"), the technology transfer company of the
University, to negotiate a licence. Contact details are: quoting reference DE/9564.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
......@@ -5,88 +5,10 @@
# Author: Paul McCarthy <>
import os
import os.path as op
from setuptools import setup
from setuptools import find_packages
from setuptools.command.sdist import sdist
class fsl_sdist(sdist):
"""Custom sdist command which inserts the LICENSE text at the
beginning of every source file.
def make_distribution(self):
# Force distutils.command.sdist to copy
# files instead of hardlinking them. This
# hack is performed by setuptools >= 24.3.0,
# but is not done by earlier versions.
link = getattr(os, 'link', None)
if link is not None: = link
def make_release_tree(self, base_dir, files):
# Make the release tree
sdist.make_release_tree(self, base_dir, files)
licence = op.abspath('LICENSE')
if not op.exists(licence):
with open(licence, 'rt') as f:
licence =
patchfuncs = {
'.py' : self.__patch_py_file,
# Walk through the release
# tree, and patch the license
# into every relevant file.
for root, dirs, files in os.walk(base_dir):
for filename in files:
filename = op.join(root, filename)
ext = op.splitext(filename)[1]
patchfunc = patchfuncs.get(ext)
if patchfunc is not None:
patchfunc(filename, licence)
def __patch_py_file(self, filename, licence):
licence = licence.split('\n')
licence = ['# {0}'.format(l) for l in licence]
with open(filename, 'rt') as f:
lines ='\n')
# Remove any existing hashbang line
if len(lines) > 0 and lines[0].startswith('#!'):
lines = lines[1:]
# Insert the fsl hashbang and the licence
lines = ['#!/usr/bin/env fslpython'] + ['#'] + licence + lines
lines = ['{0}\n'.format(l) for l in lines]
with open(filename, 'wt') as f:
from setuptools import setup
from setuptools import find_packages
# The directory in which this file is contained.
......@@ -123,16 +45,16 @@ setup(
license='Apache License Version 2.0',
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: Free for non-commercial use',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 2.7',
'Topic :: Software Development :: Libraries :: Python Modules'],
packages=find_packages(exclude=('doc', 'tests')),
......@@ -141,9 +63,6 @@ setup(
tests_require=['pytest', 'pytest-runner'],
cmdclass={'fsl_sdist' : fsl_sdist},
'console_scripts' : [
'fslpy_imcp = fsl.scripts.imcp:main',
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment