Skip to content

Commit

Permalink
nifstd-tools setup.py MANIFEST.in rework to include resources
Browse files Browse the repository at this point in the history
currently not including the inputs for parcellation, but am including
the inputs for neurondm since those do sort of stand alone from the
ontology in a way that the parcellation inputs currently do not

also include the rpmbuild symlinks, this should make it straight
forward to build rpms for specific release, though clearly the spec
files should be able to change independent of the release, so this is
a convenience when it works

and for a good old lolpython time, still no spaces in manifest files
apparently
  • Loading branch information
tgbugs committed Aug 28, 2020
1 parent be367c2 commit d46ef22
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 114 deletions.
26 changes: 13 additions & 13 deletions neurondm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ config.write()
config.write_python()
```

### NIF-Ontology
To work with the NIF-Ontology and build existing models
you need to clone the ontology repository and set your
SciGraph API key or set up a local SciGraph instance.

```bash
git clone https://github.com/SciCrunch/NIF-Ontology.git
ontutils set ontology-local-repo ./NIF-Ontology
pushd ./NIF-Ontology
git checkout neurons
popd
```

### SciGraph API
Set the API key in a separate terminal to avoid losing
additional history after setting the api key.
Expand All @@ -63,6 +50,19 @@ Once that is done you should be able to run the following.
python -m neurondm.models.huang2017
```

### NIF-Ontology
To work with the NIF-Ontology and build existing models
you need to clone the ontology repository and set your
SciGraph API key or set up a local SciGraph instance.

```bash
git clone https://github.com/SciCrunch/NIF-Ontology.git
ontutils set ontology-local-repo ./NIF-Ontology
pushd ./NIF-Ontology
git checkout neurons
popd
```

### Further configuration
If you need more details on configuration see the pyontutils
[configuration](https://github.com/tgbugs/pyontutils/#configuration) section.
Expand Down
12 changes: 5 additions & 7 deletions neurondm/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ def _ontology_data_files():
'ttl/phenotype-indicators.ttl',
'ttl/phenotypes.ttl',
'ttl/generated/part-of-self.ttl',]
respaths = ['26451489 table 1.csv',
'common-usage-types.csv',]
if RELEASE:
from augpathlib import RepoPath as Path
### KILL IT WITH FIRE
Expand Down Expand Up @@ -56,24 +54,23 @@ def _ontology_data_files():

resources = Path(resources)
resources.mkdir() # if we add resources to git, this will error before we delete by accident
_resources_path = Path(auth.get_path('resources'))
paths = ([olr / rp for rp in relpaths] +
[_resources_path / rp for rp in respaths])
paths = [olr / rp for rp in relpaths]
for p in paths:
p.copy_to(resources / p.name)

else:
from pathlib import Path
resources = Path(resources)
paths = [Path(rp) for rp in relpaths + respaths]
paths = [Path(rp) for rp in relpaths]

return resources.absolute(), [(resources / p.name).as_posix() for p in paths]


resources, ontology_data_files = _ontology_data_files()
print('ontology_data_files:\n\t' + '\n\t'.join(ontology_data_files))

tests_require = ['pytest']
models_require = ['nifstd-tools>=0.0.6']
tests_require = ['pytest'] + models_require
try:
setup(
name='neurondm',
Expand Down Expand Up @@ -104,6 +101,7 @@ def _ontology_data_files():
],
extras_require={'dev': ['pytest-cov', 'wheel'],
'test': tests_require,
'models': models_require,
'notebook': ['jupyter'],
},
entry_points={
Expand Down
12 changes: 12 additions & 0 deletions nifstd/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,19 @@ recursive-exclude scigraph *
recursive-exclude * *.pyc
recursive-exclude * *.swp
recursive-exclude * *.swo
recursive-exclude * *.rpm
recursive-include resources *.confd
recursive-include resources *.rc
recursive-include resources *.socket
recursive-include resources *.service
recursive-include resources *.spec
recursive-include resources *.el
recursive-include resources *.yaml
recursive-include resources/sparc_term_versions *
include resources/ontree.tmp
include resources/neuron_phenotype.csv
include resources/26451489*
include resources/neuron_phenotype.csv
include resources/common-usage-types.csv
include resources/neuron_phenotype_edges.csv
recursive-exclude resources/rpmbuild/BUILD *
91 changes: 91 additions & 0 deletions nifstd/resources/nifstd-tools.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# you must build this with --nodeps if you are not on a RHEL alike
%define _unitdir /lib/systemd/system
%define _etcdir /etc/systemd/system

# building on gentoo makes this /var/lib for some reason :/
%define _localstatedir /var

%define nt_user nifstd-tools
%define nt_group %{nifstd-tools}
%define nt_home %{_localstatedir}/lib/nifstd-tools
%define nt_log %{_localstatedir}/log/nifstd-tools

%define name nifstd-tools
%define version 9999
Name: %{name}
Version: %{version}
Release: 0
Summary: utilities for working with the NIF ontology
License: MIT
Url: https://github.com/tgbugs/pyontutils/tree/nifstd
BuildArch: noarch
BuildRequires: systemd
BuildRequires: git
Requires: gcc
Requires: bash
Requires: nginx
Requires: python3
Requires: python3-devel
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd

Source1: ontree.socket
Source2: ontree.service
Source3: ontree.confd
Source4: ontree.tmp

%description
curation workflow automation and coordination

%prep

if [[ ! -d %{buildroot} ]]; then
mkdir %{buildroot};
fi

%define gitroot pyontutils
if [[ ! -d %{gitroot} ]]; then
git clone https://github.com/tgbugs/pyontutils.git
fi

%build
#pushd %{gitroot}
#python3 setup.py bdist_wheel
#%py3_build

%install
install -p -D -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}/ontree.socket
install -p -D -m 644 %{SOURCE2} %{buildroot}/%{_unitdir}/ontree.service
install -p -D -m 600 %{SOURCE3} %{buildroot}/%{_etcdir}/ontree.service.d/env.conf
install -p -D -m 644 %{SOURCE4} %{buildroot}/etc/tmpfiles.d/ontree.conf
#%py3_install

%pre
getent group %{nt_group} > /dev/null || groupadd -r %{nt_group}
getent passwd %{nt_user} > /dev/null || \
useradd -r -m -d %{nt_home} -g %{nt_group} \
-s /bin/bash -c "nifstd-tools services" %{nt_user}
if [[ ! -d %{ontree_log} ]]; then
mkdir %{ontree_log} # owner?
chown %{nt_user}:%{nt_group} %{ontree_log}
fi

%post
systemd-tmpfiles --create
systemctl enable ontree
#systemctl enable nginx

%clean
rm -rf %{buildroot}

%files
%{_unitdir}/ontree.socket
%{_unitdir}/ontree.service
%{_etcdir}/ontree.service.d/env.conf
/etc/tmpfiles.d/ontree.conf
#/etc/nginx/nginx.conf
#/etc/nginx/scibot.conf

%changelog
# skip this for now
1 change: 1 addition & 0 deletions nifstd/resources/rpmbuild/SOURCES/ontree.confd
1 change: 1 addition & 0 deletions nifstd/resources/rpmbuild/SOURCES/ontree.service
1 change: 1 addition & 0 deletions nifstd/resources/rpmbuild/SOURCES/ontree.socket
1 change: 1 addition & 0 deletions nifstd/resources/rpmbuild/SOURCES/ontree.tmp
91 changes: 0 additions & 91 deletions nifstd/resources/rpmbuild/SPECS/nifstd-tools.spec

This file was deleted.

1 change: 1 addition & 0 deletions nifstd/resources/rpmbuild/SPECS/nifstd-tools.spec
10 changes: 7 additions & 3 deletions nifstd/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re
from pathlib import Path
from setuptools import setup


Expand Down Expand Up @@ -46,7 +47,7 @@ def find_version(filename):
'networkx',
'psutil',
'pymysql',
'pyontutils>=0.1.25',
'pyontutils>=0.1.26',
'sqlalchemy',
],
extras_require={'dev': ['mysql-connector',
Expand All @@ -67,5 +68,8 @@ def find_version(filename):
],
},
data_files=[('share/nifstd/resources/sparc_term_versions/',
['resources/sparc_term_versions/sparc_terms2-mod.txt'])]
)
['resources/sparc_term_versions/sparc_terms2-mod.txt']),
('share/nifstd/resources/',
[p.as_posix() for p in Path('resources').iterdir()
if p.is_file() and p.suffix[1:] not in
('confd', 'rc', 'service', 'socket', 'tmp', 'spec')],)])

0 comments on commit d46ef22

Please sign in to comment.