Skip to content

Commit 8e8096e

Browse files
committed
Fix creating RPM packages (#248)
* update the build-script to allow parallel builds Well, doesn't really do much right now since it's just one file being compiled - but maybe it will matter in the future. Also make it so the "install" command doesn't actually build anything, and just installs. Update the README to promote usage of the build.sh script Also remove the installation instruction for PyPi - it's not up there yet. * fix bdist_rpm not including pyslurm.pyx Just do a recursive include of all .pyx .pxd .pxi .h files
1 parent 3ba8c02 commit 8e8096e

File tree

5 files changed

+38
-34
lines changed

5 files changed

+38
-34
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ graft tests
55
graft doc
66
graft pyslurm/slurm
77
graft pyslurm/pydefines
8-
include pyslurm/alps_cray.h
8+
recursive-include pyslurm *.pyx *.px[di] *.h

README.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,18 @@ By default, it is searched inside `/usr/include` for the Header files and in
2121
For Slurm installations in different locations, you will need to provide
2222
the corresponding paths to the necessary files.
2323

24-
You can specify these Paths with environment variables, for example:
24+
You can specify these Paths with environment variables (recommended), for example:
2525

2626
```shell
2727
export SLURM_INCLUDE_DIR=/opt/slurm/21.08/include
2828
export SLURM_LIB_DIR=/opt/slurm/21.08/lib
2929
```
3030

31-
Then you can proceed to install PySlurm, for example:
32-
33-
```shell
34-
pip install pyslurm==21.08.0
35-
```
36-
37-
Or by cloning the repository:
31+
Then you can proceed to install PySlurm, for example by cloning the Repository:
3832

3933
```shell
4034
git clone https://github.com/PySlurm/pyslurm.git && cd pyslurm
41-
python setup.py install
35+
scripts/build.sh
4236

4337
# Or simply with pip
4438
pip install .

scripts/build.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
#!/bin/bash
22
set -e
33

4-
###################################
5-
# Build PySlurm
6-
###################################
4+
usage() { echo "Usage: $0 [-j jobs]" 1>&2; exit 1; }
75

8-
cd pyslurm
9-
echo "---> Building PySlurm..."
10-
python$PYTHON setup.py build
6+
# Option to allow parallel build
7+
OPT_JOBS=1
118

12-
echo "---> Installing PySlurm..."
13-
python$PYTHON setup.py install
9+
PYTHON_VERSION=3
10+
11+
while getopts ":j:" o; do
12+
case "${o}" in
13+
j)
14+
OPT_JOBS=${OPTARG}
15+
;;
16+
*)
17+
usage
18+
;;
19+
esac
20+
done
21+
22+
shift $((OPTIND-1))
23+
24+
python"$PYTHON_VERSION" setup.py build -j "$OPT_JOBS"
25+
python"$PYTHON_VERSION" setup.py install

setup.cfg

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,12 @@ docs=build_sphinx
55
[bdist_rpm]
66
release = 1
77
packager = Giovanni Torres <giovtorres@users.noreply.github.com>
8-
doc_files = CONTRIBUTORS.rst
9-
README.rst
10-
THANKS.rst
8+
doc_files = README.md
119
doc/
1210
examples/
13-
build_requires = python-devel >= 2.7
14-
Cython >= 0.19
15-
python-sphinx >= 1.1
16-
slurm-devel >= 17.11.5
17-
python-nose
18-
requires = slurm-slurmd slurm-slurmdbd
11+
build_requires = python3-devel >= 3.6
12+
slurm-devel >= 21.08.0
13+
requires = slurm
1914
use_bzip2 = 1
2015

2116
[build_sphinx]

setup.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,8 @@ def parse_setuppy_commands():
300300
cleanup_build()
301301
return False
302302

303-
build_cmd = ('install', 'sdist', 'build', 'build_ext', 'build_py',
304-
'build_clib', 'build_scripts', 'bdist_wheel', 'bdist_rpm',
305-
'build_src', 'bdist_egg', 'develop')
303+
build_cmd = ('build', 'build_ext', 'build_py', 'build_clib',
304+
'build_scripts', 'bdist_wheel', 'build_src', 'bdist_egg', 'develop')
306305

307306
for cmd in build_cmd:
308307
if cmd in args:
@@ -318,10 +317,14 @@ def setup_package():
318317
build_it = parse_setuppy_commands()
319318

320319
if build_it:
321-
if "sdist" not in sys.argv:
322-
parse_slurm_args()
323-
slurm_sanity_checks()
324-
cythongen()
320+
parse_slurm_args()
321+
slurm_sanity_checks()
322+
cythongen()
323+
324+
if "install" in sys.argv:
325+
parse_slurm_args()
326+
slurm_sanity_checks()
327+
metadata["ext_modules"] = make_extensions()
325328

326329
setup(**metadata)
327330

0 commit comments

Comments
 (0)