File: setup.py

package info (click to toggle)
lammps 20220106.git7586adbb6a%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 348,064 kB
  • sloc: cpp: 831,421; python: 24,896; xml: 14,949; f90: 10,845; ansic: 7,967; sh: 4,226; perl: 4,064; fortran: 2,424; makefile: 1,501; objc: 238; lisp: 163; csh: 16; awk: 14; tcl: 6
file content (39 lines) | stat: -rw-r--r-- 1,343 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# this only installs the LAMMPS python package
# it assumes the LAMMPS shared library is already installed
from distutils.core import setup
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):
    # 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():
    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)
        t = time.strptime("".join(line[start_pos:end_pos].split()), "%d%b%Y")
        return "{}.{}.{}".format(t.tm_year,t.tm_mon,t.tm_mday)

if version_info.major >= 3:
    pkgs = ['lammps', 'lammps.mliap']
else:
    pkgs = ['lammps']

setup(
    name = "lammps",
    version = get_lammps_version(),
    author = "Steve Plimpton",
    author_email = "sjplimp@sandia.gov",
    url = "https://www.lammps.org",
    description = "LAMMPS Molecular Dynamics Python package",
    license = "GPL",
    packages=pkgs,
)