From 3f1bbf7c7187ea9d002437490272fb3dd2fa4e82 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 2 Jun 2021 11:46:48 -0400 Subject: [PATCH] Add support for building wheels with pip --- python/.gitignore | 1 + python/setup.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/python/.gitignore b/python/.gitignore index 796b96d1c4..9c07c51c3c 100644 --- a/python/.gitignore +++ b/python/.gitignore @@ -1 +1,2 @@ /build +/*.egg-info diff --git a/python/setup.py b/python/setup.py index 2ccbb373e3..1ae423d59f 100644 --- a/python/setup.py +++ b/python/setup.py @@ -8,8 +8,14 @@ LAMMPS_PYTHON_DIR = os.path.dirname(os.path.realpath(__file__)) LAMMPS_DIR = os.path.dirname(LAMMPS_PYTHON_DIR) LAMMPS_SOURCE_DIR = os.path.join(LAMMPS_DIR, 'src') +if not os.path.exists(LAMMPS_SOURCE_DIR): + # allows installing and building wheel from current directory + LAMMPS_DIR = os.path.realpath(os.path.join(os.environ['PWD'], '..')) + LAMMPS_SOURCE_DIR = os.path.join(LAMMPS_DIR, 'src') + def get_lammps_version(): - with open(os.path.join(LAMMPS_SOURCE_DIR, 'version.h'), 'r') as f: + version_h_file = os.path.join(LAMMPS_SOURCE_DIR, 'version.h') + with open(version_h_file, 'r') as f: line = f.readline() start_pos = line.find('"')+1 end_pos = line.find('"', start_pos)