Skip to content

Commit

Permalink
Merge pull request #9 from mantidproject/repackage
Browse files Browse the repository at this point in the history
Repackage using newer tools
  • Loading branch information
peterfpeterson committed Nov 29, 2023
2 parents 4a86eed + 36a913f commit 97618c0
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 33 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
workflow_dispatch:
pull_request:
push:
branches: [main, qa, next]
tags: ['v*']

jobs:
python-build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Set up MicroMamaba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
condarc: |
channels:
- conda-forge
- mantid
- default
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
- name: Build source distribution
shell: bash -l {0}
run: | # this is used as part of making the rpm
python -m build --sdist --no-isolation
# the wheel isn't build because this is a unusual package
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Testing is described in the `test/` subdirectory.
This package uses a hand-written spec file for releasing on rpm based systems rather than the one generated by python. To run it execute

```
./rpmbuild
./rpmbuild.sh
```

And look for the results in the `dist` directory.
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dependencies:
- mantid # framework only
- pyinotify
- pre-commit
- python-build
34 changes: 20 additions & 14 deletions livereduce.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Summary: %{summary}
Name: python-%{srcname}
Version: 1.10
Version: 1.11
Release: %{release}%{?dist}
Source0: %{srcname}-%{version}.tar.gz
License: MIT
Expand All @@ -16,7 +16,8 @@ BuildArch: noarch
Vendor: Pete Peterson
Url: https://github.com/mantidproject/livereduce

BuildRequires: python%{python3_pkgversion} python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}
BuildRequires: systemd-rpm-macros

Requires: python%{python3_pkgversion}
Requires: jq
Expand All @@ -25,34 +26,39 @@ Requires: nsd-app-wrap
%description
There should be a meaningful description, but it is not needed quite yet.

%{?python_provide:%python_provide python-%{srcname}}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}

%prep
%setup -n %{srcname}-%{version} -n %{srcname}-%{version}
%setup -q -n %{srcname}-%{version} -n %{srcname}-%{version}

%build
%py3_build
# no build step

%install
%py3_install
%{__rm} -rf $RPM_BUILD_ROOT
# put things in the bin directory
%{__mkdir} -p %{buildroot}%{_bindir}/
%{__install} -m 644 scripts/livereduce.py %{buildroot}%{_bindir}/
%{__install} -m 755 scripts/livereduce.sh %{buildroot}%{_bindir}/
%{__mkdir} -p %{buildroot}%{_unitdir}/
%{__install} -m 644 livereduce.service %{buildroot}%{_unitdir}/

%check
%{__python3} setup.py test
# no test step

%clean
rm -rf $RPM_BUILD_ROOT
%{__rm} -rf $RPM_BUILD_ROOT

%post
mkdir -p /var/log/SNS_applications/
chown snsdata /var/log/SNS_applications/
chmod 1755 /var/log/SNS_applications/
%{__mkdir} -p /var/log/SNS_applications/
%{__chown} snsdata /var/log/SNS_applications/
%{__chmod} 1755 /var/log/SNS_applications/

%preun
rm -f /var/log/SNS_applications/livereduce.log*
%{__rm} -f /var/log/SNS_applications/livereduce.log*

%files
%doc README.md
%{python3_sitelib}/*
%{_bindir}/livereduce.py
%{_bindir}/livereduce.sh
%{_prefix}/lib/systemd/system/livereduce.service
%{_unitdir}/livereduce.service
31 changes: 31 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[project]
name = "livereduce"
description = "Daemon for running live data reduction with systemd"
version="1.11"
#dynamic = ["version"]
requires-python = ">=3.9"
license = { text = "MIT License" }
authors = [{name="Pete Peterson",email="petersonpf@ornl.gov"}]

[project.urls]
Homepage = "https://github.com/mantidproject/livereduce"

[build-system]
requires = [
"setuptools",
"wheel",
"toml"
]
build-backend = "setuptools.build_meta"

[tool.setuptools]
include-package-data=true

[tool.setuptools.packages.find]
where = ["."]
exclude = ["test"]

[tool.setuptools.package-data]
"*" = ["*.sh", "*.service"]

#TODO define entrypoints
2 changes: 1 addition & 1 deletion rpmbuild → rpmbuild.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
rm -rf dist livereduce.egg-info
python setup.py sdist
python -m build --sdist --no-isolation
cp dist/livereduce-*.tar.gz ~/rpmbuild/SOURCES/
rpmbuild -ba livereduce.spec
cp ~/rpmbuild/RPMS/noarch/python-livereduce-*-*.*.noarch.rpm dist/
Expand Down
17 changes: 0 additions & 17 deletions setup.py

This file was deleted.

0 comments on commit 97618c0

Please sign in to comment.