File: setup.py

package info (click to toggle)
lammps 20251210%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 465,808 kB
  • sloc: cpp: 1,031,565; python: 26,771; ansic: 8,808; f90: 7,302; sh: 5,316; perl: 4,171; fortran: 2,442; xml: 1,613; makefile: 1,119; objc: 238; lisp: 188; yacc: 58; csh: 16; awk: 14; tcl: 6; javascript: 2
file content (67 lines) | stat: -rw-r--r-- 2,137 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# this only installs the LAMMPS python package
# it assumes the LAMMPS shared library is already installed
from setuptools import setup
from setuptools.dist import Distribution
from sys import version_info
import os,time

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'], '..'))
    versionfile = os.path.join(LAMMPS_DIR, 'src', 'version.h')

def get_lammps_version():
    version_h_file = os.path.join(versionfile)
    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)

class BinaryDistribution(Distribution):
    """Wrapper to enforce creating a binary package"""
    def has_ext_modules(self):
        return True

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

with open("README", "r") as fh:
    long_description = fh.read()

libname = os.environ.get("LAMMPS_SHARED_LIB")
if libname:
    pkgdata = {'lammps': [ libname ]}
    bdist = BinaryDistribution
else:
    pkgdata = {}
    bdist = Distribution

setup(
    name = "lammps",
    version = get_lammps_version(),
    license = "GPL-2.0-only",
    author = "The LAMMPS Developers",
    author_email = "developers@lammps.org",
    url = "https://www.lammps.org",
    project_urls = {
        "Bug Tracker": "https://github.com/lammps/lammps/issues",
    },
    description = "LAMMPS Molecular Dynamics Python package",
    long_description = long_description,
    long_description_content_type = "text/plain",
    classifiers = [
        "Programming Language :: Python :: 3",
        "Development Status :: 5 - Production/Stable",
        "Environment :: Console",
        "Operating System :: OS Independent",
    ],
    packages = pkgs,
    package_data = pkgdata,
    distclass = bdist,
    python_requires = '>=3.6',
)