Building from sourceΒΆ

To build the msp2lib package from source using setuptools, run the following command:

$ python3 setup.py sdist bdist_wheel

setuptools is configured using the file setup.py.

Different formats are available for built distributions

Format Description Notes
gztar gzipped tar file (.tar.gz) default on Unix
bztar bzipped tar file (.tar.bz2)  
xztar bzipped tar file (.tar.bz2)  
tar tar file (.tar)  
zip zip file (.zip) default on Windows
wininst self-extracting ZIP file for Windows  
msi Microsoft Installer  

setup.py

 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
#!/usr/bin/env python
"""Setup script"""

import os
import pathlib
import sys
import warnings

from setuptools import setup, find_packages

from __pkginfo__ import (
	author, author_email, classifiers, entry_points, install_requires, license, long_description, modname, py_modules,
	short_desc, VERSION, web,
	)

if not pathlib.Path("msp2lib.1").is_file():
	warnings.warn("manpage not found. Trying to build now.")
	exit_code = os.system("./make_manpage.sh")
	if exit_code:
		sys.exit(exit_code)

setup(
		author=author,
		author_email=author_email,
		classifiers=classifiers,
		description=short_desc,
		entry_points=entry_points,
		install_requires=install_requires,
		license=license,
		long_description=long_description,
		name=modname,
		packages=find_packages(exclude=("tests",)),
		py_modules=py_modules,
		url=web,
		version=VERSION,
		package_data={modname: [
				str(pathlib.Path(".") / modname / "Dockerfile"),
				str(pathlib.Path(".") / modname / "make_nistlib.sh"),
				]},
		include_package_data=True,
		)

# TODO: include manpage in wheel and put in right place on filesystem

__pkginfo__.py

 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
68
69
70
71
72
73
74
75
76
# Copyright (C) 2019-2020 Dominic Davis-Foster <dominic@davis-foster.co.uk>
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

# This script based on https://github.com/rocky/python-uncompyle6/blob/master/__pkginfo__.py

import pathlib

copyright = """
2020 Dominic Davis-Foster <dominic@davis-foster.co.uk>
"""

VERSION = "0.1.3"

modname = "msp2lib"
py_modules = None
entry_points = {
		'console_scripts': [
				f'msp2lib=msp2lib:main',
				]
		}

license = 'LGPLv3'

short_desc = 'Convert an MSP file representing one or more Mass Spectra to a NIST MS Search user library.'

classifiers = [
		# "Development Status :: 1 - Planning",
		# "Development Status :: 2 - Pre-Alpha",
		"Development Status :: 3 - Alpha",
		# "Development Status :: 4 - Beta",
		# "Development Status :: 5 - Production/Stable",
		# "Development Status :: 6 - Mature",
		# "Development Status :: 7 - Inactive",
		
		"Environment :: Console",
		"Operating System :: POSIX :: Linux",
		
		'Intended Audience :: Developers',
		"Intended Audience :: End Users/Desktop",
		"Intended Audience :: Science/Research",
		
		"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
		
		'Programming Language :: Python',
		'Programming Language :: Python :: 3.6',
		'Programming Language :: Python :: 3.7',
		'Programming Language :: Python :: 3.8',
		
		'Topic :: Software Development :: Libraries :: Python Modules',
		]

author = "Dominic Davis-Foster"
author_email = "dominic@davis-foster.co.uk"
github_username = "domdfcoding"
web = github_url = f"https://github.com/{github_username}/{modname}"


# Get info from files; set: long_description
if pathlib.Path.cwd().name in {"doc-source", "manpage-builder"}:
	install_requires = (pathlib.Path.cwd().parent / "requirements.txt").read_text().split("\n")
	long_description = (pathlib.Path.cwd().parent / "README.rst").read_text() + '\n'
else:
	install_requires = pathlib.Path("requirements.txt").read_text().split("\n")
	long_description = pathlib.Path("README.rst").read_text() + '\n'