Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
fslpy
Commits
b6870cf1
You need to sign in or sign up before continuing.
Commit
b6870cf1
authored
8 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Licence updates. New setuptools fsl_sdist command which inserts licence
and hashbang into every .py file.
parent
64ac4c25
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
LICENSE
+17
-2
17 additions, 2 deletions
LICENSE
MANIFEST.in
+4
-0
4 additions, 0 deletions
MANIFEST.in
fsl/__init__.py
+1
-2
1 addition, 2 deletions
fsl/__init__.py
setup.py
+88
-4
88 additions, 4 deletions
setup.py
with
110 additions
and
8 deletions
LICENSE
+
17
−
2
View file @
b6870cf1
fslpy library, (c) 2016, The University of Oxford (the "Software")
The fslpy library
Part of FSL - FMRIB's Software Library
http://www.fmrib.ox.ac.uk/fsl
fsl@fmrib.ox.ac.uk
Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
Imaging of the Brain), Department of Clinical Neurology, Oxford
University, Oxford, UK
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").
...
...
@@ -46,4 +61,4 @@ 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:
i
nnovation@i
sis
.ox.ac.uk quoting reference
BS
/9564.
I
nnovation@i
nnovation
.ox.ac.uk quoting reference
DE
/9564.
This diff is collapsed.
Click to expand it.
MANIFEST.in
+
4
−
0
View file @
b6870cf1
include LICENSE
include README.md
include requirements.txt
recursive-include doc *
This diff is collapsed.
Click to expand it.
fsl/__init__.py
+
1
−
2
View file @
b6870cf1
#!/usr/bin/env python
#
# __init__.py - Front end to fslpy. The entry point is main(), defined
# at the bottom.
# __init__.py - The fslpy library.
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
88
−
4
View file @
b6870cf1
...
...
@@ -5,13 +5,91 @@
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import
os
import
os.path
as
op
from
setuptools
import
setup
from
setuptools
import
find_packages
from
setuptools
import
setup
from
setuptools
import
find_packages
from
setuptools.command.sdist
import
sdist
# The directory in whihc this setup.py file is contained.
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
=
[
'
# {}
'
.
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
=
[
'
{}
\n
'
.
format
(
l
)
for
l
in
lines
]
with
open
(
filename
,
'
wt
'
)
as
f
:
f
.
writelines
(
lines
)
# The directory in which this setup.py file is contained.
basedir
=
op
.
dirname
(
__file__
)
...
...
@@ -21,7 +99,10 @@ basedir = op.dirname(__file__)
# version number.
version
=
{}
with
open
(
op
.
join
(
basedir
,
"
fsl
"
,
"
version.py
"
))
as
f
:
exec
(
f
.
read
(),
version
)
for
line
in
f
:
if
line
.
startswith
(
'
__version__
'
):
exec
(
line
,
version
)
break
install_requires
=
open
(
op
.
join
(
basedir
,
'
requirements.txt
'
),
'
rt
'
).
readlines
()
...
...
@@ -60,6 +141,9 @@ setup(
tests_require
=
[
'
pytest
'
,
'
pytest-runner
'
],
test_suite
=
'
tests
'
,
cmdclass
=
{
'
fsl_sdist
'
:
fsl_sdist
},
entry_points
=
{
'
console_scripts
'
:
[
'
fslpy_imcp = fsl.scripts.imcp:main
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment