From a40f4f0ca2f9a2e653335328053c50d93526cf4d Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauld.mccarthy@gmail.com>
Date: Thu, 30 Mar 2017 15:20:39 +0100
Subject: [PATCH] fslpy is now apache2

---
 COPYRIGHT |  1 +
 LICENSE   | 69 ++++++-----------------------------------
 setup.py  | 91 +++----------------------------------------------------
 3 files changed, 16 insertions(+), 145 deletions(-)
 create mode 100644 COPYRIGHT

diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 100644
index 000000000..f452935cb
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1 @@
+Copyright 2016-2017 University of Oxford, Oxford, UK
diff --git a/LICENSE b/LICENSE
index fa8032154..f972f2530 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,64 +1,15 @@
 The fslpy library
 
+Copyright 2016-2017 University of Oxford, Oxford, UK.
 
-Part of FSL - FMRIB's Software Library
-http://www.fmrib.ox.ac.uk/fsl
-fsl@fmrib.ox.ac.uk
+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
+    http://www.apache.org/licenses/LICENSE-2.0
 
-
-LICENCE
-
-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
-University").
-
-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:
-Innovation@innovation.ox.ac.uk 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,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/setup.py b/setup.py
index 6c3d036f6..e8d2bb2ac 100644
--- a/setup.py
+++ b/setup.py
@@ -5,88 +5,10 @@
 # Author: Paul McCarthy <pauldmccarthy@gmail.com>
 #
 
-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)
-        try:
-            del(os.link)
-        except:
-            pass
-        
-        sdist.make_distribution(self)
-
-        if link is not None:
-            os.link = 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):
-            return
-
-        with open(licence, 'rt') as f:
-            licence = f.read()
-
-        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 = f.read().split('\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:
-            f.writelines(lines)
-
+from setuptools import setup
+from setuptools import find_packages
 
 
 # The directory in which this setup.py file is contained.
@@ -123,16 +45,16 @@ setup(
 
     author_email='pauldmccarthy@gmail.com',
 
-    license='FMRIB',
+    license='Apache License Version 2.0',
 
     classifiers=[
         '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')),
+    packages=find_packages(exclude=('doc', 'tests')),
 
     install_requires=install_requires,
     dependency_links=dependency_links,
@@ -141,9 +63,6 @@ setup(
     tests_require=['pytest', 'pytest-runner'],
     test_suite='tests',
 
-
-    cmdclass={'fsl_sdist' : fsl_sdist},
-
     entry_points={
         'console_scripts' : [
             'fslpy_imcp = fsl.scripts.imcp:main',
-- 
GitLab