Skip to content

Commit 3fd900d

Browse files
committed
Use setup.cfg and make setup.py only contain programmatic overrides
1 parent e698194 commit 3fd900d

File tree

2 files changed

+68
-78
lines changed

2 files changed

+68
-78
lines changed

setup.cfg

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[metadata]
2+
name = labscript_devices
3+
description = Device drivers for hardware controlled by the labscript suite
4+
long_description = file: README.md
5+
long_description_content_type = text/markdown
6+
author = The labscript suite community
7+
author_email = labscriptsuite@googlegroups.com
8+
url = http://labscriptsuite.org
9+
project_urls =
10+
Source Code=https://github.com/labscript-suite/labscript-devices
11+
Download=https://github.com/labscript-suite/labscript-devices/releases
12+
Tracker=https://github.com/labscript-suite/labscript-devices/issues
13+
keywords = experiment control automation
14+
license = BSD
15+
classifiers =
16+
License :: OSI Approved :: BSD License
17+
Programming Language :: Python :: 2.7
18+
Programming Language :: Python :: 3.6
19+
Programming Language :: Python :: 3.7
20+
Programming Language :: Python :: 3.8
21+
22+
[options]
23+
zip_safe = False
24+
include_package_data = True
25+
packages = find:
26+
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5
27+
install_requires =
28+
blacs>=2.7.0
29+
labscript>=2.6.0
30+
labscript_utils>=2.13.2
31+
numpy>=1.15.1
32+
pillow
33+
PyDAQmx
34+
PyNIVision
35+
pyserial
36+
qtutils>=2.2.3
37+
spinapi
38+
zprocess>=2.18.0
39+
setup_requires =
40+
setuptools_scm
41+
42+
[dist_conda]
43+
pythons = 3.6, 3.7, 3.8
44+
platforms = linux-64,win-32,win-64,osx-64
45+
force_conversion = True

setup.py

Lines changed: 23 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,34 @@
1-
# USAGE NOTES
2-
#
3-
# Make a PyPI release tarball with:
4-
#
5-
# python setup.py sdist
6-
#
7-
# Upload to test PyPI with:
8-
#
9-
# twine upload --repository-url https://test.pypi.org/legacy/ dist/*
10-
#
11-
# Install from test PyPI with:
12-
#
13-
# pip install --index-url https://test.pypi.org/simple/ labscript_devices
14-
#
15-
# Upload to real PyPI with:
16-
#
17-
# twine upload dist/*
18-
#
19-
# Build conda packages for all platforms (in a conda environment with setuptools_conda
20-
# installed) with:
21-
#
22-
# python setup.py dist_conda
23-
#
24-
# Upoad to your own account (for testing) on anaconda cloud (in a conda environment with
25-
# anaconda-client installed) with:
26-
#
27-
# anaconda upload --skip-existing conda_packages/*/*
28-
#
29-
# (Trickier on Windows, as it won't expand the wildcards)
30-
#
31-
# Upoad to the labscript-suite organisation's channel on anaconda cloud (in a
32-
# conda environment with anaconda-client installed) with:
33-
#
34-
# anaconda upload -u labscript-suite --skip-existing conda_packages/*/*
35-
#
36-
# If you need to rebuild the same version of the package for conda due to a packaging
37-
# issue, you must increment CONDA_BUILD_NUMBER in order to create a unique version on
38-
# anaconda cloud. When subsequently releasing a new version of the package,
39-
# CONDA_BUILD_NUMBER should be reset to zero.
40-
411
import os
422
from setuptools import setup
3+
from setuptools.dist import Distribution
434

445
try:
456
from setuptools_conda import dist_conda
7+
CMDCLASS = {"dist_conda": dist_conda}
468
except ImportError:
47-
dist_conda = None
9+
CMDCLASS = {}
10+
11+
if "CONDA_BUILD" not in os.environ:
12+
dist = Distribution()
13+
dist.parse_config_files()
14+
INSTALL_REQUIRES = dist.install_requires
15+
else:
16+
INSTALL_REQUIRES = []
4817

49-
SETUP_REQUIRES = ['setuptools', 'setuptools_scm']
18+
VERSION_SCHEME = {}
19+
VERSION_SCHEME["version_scheme"] = os.environ.get(
20+
"SCM_VERSION_SCHEME", "guess-next-dev"
21+
)
22+
VERSION_SCHEME["local_scheme"] = os.environ.get("SCM_LOCAL_SCHEME", "node-and-date")
5023

51-
INSTALL_REQUIRES = [
52-
"labscript_utils >= 2.13.2",
53-
"blacs >= 2.7.0",
54-
"labscript >= 2.6.0",
55-
"qtutils >=2.2.3",
56-
"zprocess >=2.18.0",
57-
"numpy >=1.15.1",
58-
"pyserial",
59-
"pillow",
60-
"PyDAQmx",
61-
"PyNIVision",
62-
"spinapi",
63-
]
24+
VERSION_SCHEME = {}
25+
VERSION_SCHEME["version_scheme"] = os.environ.get(
26+
"SCM_VERSION_SCHEME", "release-branch-semver"
27+
)
28+
VERSION_SCHEME["local_scheme"] = os.environ.get("SCM_LOCAL_SCHEME", "node-and-date")
6429

6530
setup(
66-
name='labscript_devices',
67-
use_scm_version=True,
68-
description="Device drivers for the labscript suite",
69-
long_description=open('README.md').read(),
70-
long_description_content_type='text/markdown',
71-
author='The labscript suite community',
72-
author_email='labscriptsuite@googlegroups.com ',
73-
url='http://labscriptsuite.org',
74-
license="BSD",
75-
packages=["labscript_devices"],
76-
zip_safe=False,
77-
setup_requires=SETUP_REQUIRES,
78-
include_package_data=True,
79-
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5",
80-
install_requires=INSTALL_REQUIRES if 'CONDA_BUILD' not in os.environ else [],
81-
cmdclass={'dist_conda': dist_conda} if dist_conda is not None else {},
82-
command_options={
83-
'dist_conda': {
84-
'pythons': (__file__, ['3.6', '3.7', '3.8']),
85-
'platforms': (__file__, ['linux-64', 'win-32', 'win-64', 'osx-64']),
86-
'force_conversion': (__file__, True),
87-
},
88-
},
31+
use_scm_version=VERSION_SCHEME,
32+
cmdclass=CMDCLASS,
33+
install_requires=INSTALL_REQUIRES
8934
)

0 commit comments

Comments
 (0)