Skip to content

Fix creating RPM packages #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ graft tests
graft doc
graft pyslurm/slurm
graft pyslurm/pydefines
include pyslurm/alps_cray.h
recursive-include pyslurm *.pyx *.px[di] *.h
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,18 @@ By default, it is searched inside `/usr/include` for the Header files and in
For Slurm installations in different locations, you will need to provide
the corresponding paths to the necessary files.

You can specify these Paths with environment variables, for example:
You can specify these Paths with environment variables (recommended), for example:

```shell
export SLURM_INCLUDE_DIR=/opt/slurm/22.05/include
export SLURM_LIB_DIR=/opt/slurm/22.05/lib
```

Then you can proceed to install PySlurm, for example:

```shell
pip install pyslurm==22.05.0
```

Or by cloning the repository:
Then you can proceed to install PySlurm, for example by cloning the Repository:

```shell
git clone https://github.com/PySlurm/pyslurm.git && cd pyslurm
python setup.py install
scripts/build.sh

# Or simply with pip
pip install .
Expand Down
28 changes: 20 additions & 8 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
#!/bin/bash
set -e

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

cd pyslurm
echo "---> Building PySlurm..."
python$PYTHON setup.py build
# Option to allow parallel build
OPT_JOBS=1

echo "---> Installing PySlurm..."
python$PYTHON setup.py install
PYTHON_VERSION=3

while getopts ":j:" o; do
case "${o}" in
j)
OPT_JOBS=${OPTARG}
;;
*)
usage
;;
esac
done

shift $((OPTIND-1))

python"$PYTHON_VERSION" setup.py build -j "$OPT_JOBS"
python"$PYTHON_VERSION" setup.py install
13 changes: 4 additions & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ docs=build_sphinx
[bdist_rpm]
release = 1
packager = Giovanni Torres <giovtorres@users.noreply.github.com>
doc_files = CONTRIBUTORS.rst
README.rst
THANKS.rst
doc_files = README.md
doc/
examples/
build_requires = python-devel >= 2.7
Cython >= 0.19
python-sphinx >= 1.1
slurm-devel >= 17.11.5
python-nose
requires = slurm-slurmd slurm-slurmdbd
build_requires = python3-devel >= 3.6
slurm-devel >= 22.05.0
requires = slurm
use_bzip2 = 1

[build_sphinx]
Expand Down
17 changes: 10 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,8 @@ def parse_setuppy_commands():
cleanup_build()
return False

build_cmd = ('install', 'sdist', 'build', 'build_ext', 'build_py',
'build_clib', 'build_scripts', 'bdist_wheel', 'bdist_rpm',
'build_src', 'bdist_egg', 'develop')
build_cmd = ('build', 'build_ext', 'build_py', 'build_clib',
'build_scripts', 'bdist_wheel', 'build_src', 'bdist_egg', 'develop')

for cmd in build_cmd:
if cmd in args:
Expand All @@ -318,10 +317,14 @@ def setup_package():
build_it = parse_setuppy_commands()

if build_it:
if "sdist" not in sys.argv:
parse_slurm_args()
slurm_sanity_checks()
cythongen()
parse_slurm_args()
slurm_sanity_checks()
cythongen()

if "install" in sys.argv:
parse_slurm_args()
slurm_sanity_checks()
metadata["ext_modules"] = make_extensions()

setup(**metadata)

Expand Down