Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deploy/packaging/debian/python.noarch
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
./usr/local/mdsplus/python/MDSplus/modpython.py
./usr/local/mdsplus/python/MDSplus/scope.py
./usr/local/mdsplus/python/MDSplus/setup.py
./usr/local/mdsplus/python/MDSplus/pyproject.toml
./usr/local/mdsplus/python/MDSplus/tests/__init__.py
./usr/local/mdsplus/python/MDSplus/tests/_common.py
./usr/local/mdsplus/python/MDSplus/tests/connection_case.py
Expand Down
1 change: 1 addition & 0 deletions deploy/packaging/redhat/python.noarch
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
./usr/local/mdsplus/python/MDSplus/modpython.py
./usr/local/mdsplus/python/MDSplus/scope.py
./usr/local/mdsplus/python/MDSplus/setup.py
./usr/local/mdsplus/python/MDSplus/pyproject.toml
./usr/local/mdsplus/python/MDSplus/tests
./usr/local/mdsplus/python/MDSplus/tests/__init__.py
./usr/local/mdsplus/python/MDSplus/tests/_common.py
Expand Down
2 changes: 1 addition & 1 deletion deploy/packaging/windows/mdsplus.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ SectionGroup /e "!APIs" apis
Section "!MDSplus package" python_cp
SectionIn 1 2
SetOutPath "$INSTDIR\python\MDSplus"
File /x modpython.py /x setup.py python/MDSplus/*.py
File /x modpython.py /x setup.py python/MDSplus/*.py python/MDSplus/pyproject.toml
File /workspace/releasebld/64/python/MDSplus/_version.py
SectionEnd ; python_cp
Section "tests" python_tst
Expand Down
4 changes: 2 additions & 2 deletions macosx/scripts/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ fi

date > /var/log/mdsplus_postinstall
pushd ${MDSPLUS_DIR}/python/MDSplus >> /var/log/mdsplus_postinstall 2>&1
python setup.py install >>/var/log/mdsplus_postinstall 2>&1
python -m pip install . >>/var/log/mdsplus_postinstall 2>&1
popd >> /var/log/mdsplus_postinstall 2>&1
pushd ${MDSPLUS_DIR}/tdi/MitDevices >> /var/log/mdsplus_postinstall 2>&1
python setup.py install >>/var/log/mdsplus_postinstall 2>&1
python -m pip install . >>/var/log/mdsplus_postinstall 2>&1
popd >> /var/log/mdsplus_postinstall 2>&1
exit 0
57 changes: 57 additions & 0 deletions python/MDSplus/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[build-system]
requires = ["setuptools>=44.1.1", "wheel"] # python2.7 support
build-backend = "setuptools.build_meta"

[project]
name='MDSplus'
authors = [
{name = "MDSplus Development Team", email = "twf@www.mdsplus.org"},
Comment thread
dgarnier marked this conversation as resolved.
Outdated
]
license = {text = "MIT License"}
description = "MDSplus Python Object interface"
classifiers = [
"Programming Language :: Python",
"Intended Audience :: Science/Research",
"Environment :: Console",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: MIT License",
]
keywords=['physics', 'mdsplus']
dynamic = ["version"]
dependencies = [
'numpy',
]

[project.urls]
Homepage = "http://www.mdsplus.org/"
Repository = "https://github.com/MDSplus/mdsplus"
Issues = "https://github.com/MDSplus/mdsplus/issues"

[project.optional-dependencies]
widgets = ["gtk", "gobject"]

[tool.setuptools]
packages = [
'MDSplus',
'MDSplus.widgets',
'MDSplus.wsgi',
'MDSplus.tests',
]
include-package-data = false # use package-data below

[tool.setuptools.package-dir]
'MDSplus' = '.'
'MDSplus.widgets' = 'widgets'
'MDSplus.wsgi' = 'wsgi'
'MDSplus.tests' = 'tests'

[tool.setuptools.package-data]
'MDSplus.wsgi' = [
'html/*',
'conf/*',
'js/*',
'*.tbl',
]

[tool.setuptools.dynamic]
version = {attr = '_version.version'}
107 changes: 59 additions & 48 deletions python/MDSplus/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,80 +23,91 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

import sys
import os

import setuptools
from setuptools import setup


def setupkw():
try:
version = ()
loc = {}
mod_dir = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(mod_dir, '_version.py')) as f:
exec(f.read())
with open(os.path.join(mod_dir, "_version.py")) as f:
exec(f.read(), None, loc)
version = loc["version"]
release = "%d.%d.%d" % version
release_tag = loc["release_tag"]

except Exception:
release = '0.0.0'
release_tag = 'Unknown'
release = "0.0.0"
release_tag = "Unknown"
pth_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
return dict(
name='MDSplus',
extra_path=('mdsplus', pth_dir),
name="MDSplus",
extra_path=("mdsplus", pth_dir),
version=release,
description='MDSplus Python Objects - '+release_tag,
description="MDSplus Python Objects - " + release_tag,
long_description=(
"This module provides all of the functionality of MDSplus TDI natively in python.\n"
"All of the MDSplus data types such as signal are represented as python classes.\n"
),
author='MDSplus Development Team',
author_email='twf@www.mdsplus.org',
url='http://www.mdsplus.org/',
license='MIT',
author="MDSplus Development Team",
author_email="twf@www.mdsplus.org",
Comment thread
dgarnier marked this conversation as resolved.
Outdated
url="http://www.mdsplus.org/",
license="MIT",
classifiers=[
'Programming Language :: Python',
'Intended Audience :: Science/Research',
'Environment :: Console',
'Topic :: Scientific/Engineering',
"Programming Language :: Python",
"Intended Audience :: Science/Research",
"Environment :: Console",
"Topic :: Scientific/Engineering",
],
keywords=[
"physics",
"mdsplus",
],
keywords=['physics', 'mdsplus', ],
)


def use_distutils():
from distutils.core import setup
from distutils.cmd import Command

class TestCommand(Command):
user_options = []
if setuptools.__version__ < "60.0.0":
# assume that setuptools can't directly use pyproject.toml
# for the [project] section, so need the old setup.py

def initialize_options(self):
"""nothing to do."""
print(sys.argv)
if "develop" in sys.argv:
# old setuptools can't have both --editable and --user
# but it defaults to user anyway!
if "--user" in sys.argv:
import site

def finalize_options(self):
"""nothing to do."""
print("Removing --user")
argv = sys.argv
argv.remove("--user")
argv.append("--install-dir")
argv.append(site.getusersitepackages())
sys.argv = argv

def run(self):
import subprocess
raise SystemExit(
subprocess.call([sys.executable, '-m', 'tests.__init__']))

setup(cmdclass={'test': TestCommand}, **setupkw())


def use_setuptools():
from setuptools import setup
setup(
include_package_data=True,
test_suite='tests.test_all',
test_suite="tests.test_all",
zip_safe=False,
packages=["MDSplus",
"MDSplus.wsgi",
"MDSplus.widgets",
"MDSplus.tests"],
package_dir={"MDSplus": ".",
"MDSplus.widgets":"widgets",
"MDSplus.wsgi":"wsgi",
"MDSplus.tests":"tests"},
package_data={"MDSplus.wsgi":[
'html/*',
'conf/*',
'js/*',
'*.tbl']},
**setupkw()
)


if __name__ == '__main__':
if 'pip-egg-info' in sys.argv:
print("When using pip to install MDSplus use 'pip install -e <dir>'")
sys.exit(1)
try:
use_setuptools()
except (ImportError, RuntimeError):
use_distutils()
else:
# setuptools can use pyproject.toml
setup()