1# this only installs the LAMMPS python package 2# it assumes the LAMMPS shared library is already installed 3from distutils.core import setup 4from sys import version_info 5import os,time 6 7LAMMPS_PYTHON_DIR = os.path.dirname(os.path.realpath(__file__)) 8LAMMPS_DIR = os.path.dirname(LAMMPS_PYTHON_DIR) 9LAMMPS_SOURCE_DIR = os.path.join(LAMMPS_DIR, 'src') 10 11if not os.path.exists(LAMMPS_SOURCE_DIR): 12 # allows installing and building wheel from current directory 13 LAMMPS_DIR = os.path.realpath(os.path.join(os.environ['PWD'], '..')) 14 LAMMPS_SOURCE_DIR = os.path.join(LAMMPS_DIR, 'src') 15 16def get_lammps_version(): 17 version_h_file = os.path.join(LAMMPS_SOURCE_DIR, 'version.h') 18 with open(version_h_file, 'r') as f: 19 line = f.readline() 20 start_pos = line.find('"')+1 21 end_pos = line.find('"', start_pos) 22 t = time.strptime("".join(line[start_pos:end_pos].split()), "%d%b%Y") 23 return "{}.{}.{}".format(t.tm_year,t.tm_mon,t.tm_mday) 24 25if version_info.major >= 3: 26 pkgs = ['lammps', 'lammps.mliap'] 27else: 28 pkgs = ['lammps'] 29 30setup( 31 name = "lammps", 32 version = get_lammps_version(), 33 author = "Steve Plimpton", 34 author_email = "sjplimp@sandia.gov", 35 url = "https://www.lammps.org", 36 description = "LAMMPS Molecular Dynamics Python package", 37 license = "GPL", 38 packages=pkgs, 39) 40