refactor python module wheel building and installation to be less prone to race conditions
This commit is contained in:
@ -4,17 +4,15 @@ from setuptools import setup
|
||||
from setuptools.dist import Distribution
|
||||
from sys import version_info
|
||||
import os,time
|
||||
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):
|
||||
versionfile = os.environ.get("LAMMPS_VERSION_FILE")
|
||||
if not versionfile:
|
||||
# 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')
|
||||
versionfile = os.path.join(LAMMPS_DIR, 'src', 'version.h')
|
||||
|
||||
def get_lammps_version():
|
||||
version_h_file = os.path.join(LAMMPS_SOURCE_DIR, 'version.h')
|
||||
version_h_file = os.path.join(versionfile)
|
||||
with open(version_h_file, 'r') as f:
|
||||
line = f.readline()
|
||||
start_pos = line.find('"')+1
|
||||
|
||||
Reference in New Issue
Block a user