Skip to content

Commit

Permalink
Fix setup information.
Browse files Browse the repository at this point in the history
  • Loading branch information
BenediktBurger committed Jan 25, 2024
1 parent 207baec commit f6d1747
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 3 deletions.
3 changes: 2 additions & 1 deletion plugin_info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ package-url = 'https://github.com/BenediktBurger/pymodaq_plugins_basler'
description = 'PyMoDAQ plugins for cameras of Basler'

author = 'Benedikt Burger'
author-email = "Benedikt.Burger@physik.tu-darmstadt.de"
license = 'MIT'

[plugin-install]
#packages required for your plugin:
packages-required = [
'pymodaq>=4.1.0',
'pymodaq>=4.0.0',
'numpy', # for Basler camera
'pypylon',
]
Expand Down
71 changes: 69 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,71 @@
from pymodaq.resources.setup_plugin import setup

from pathlib import Path

setup(Path(__file__).parent)
try:
from pymodaq.resources.setup_plugin import setup as _setup
except ModuleNotFoundError:
fallback = True
from setuptools import setup as _setup, find_packages
import toml
else:
fallback = False


def setup():
if not fallback:
return _setup()

config = toml.load('./plugin_info.toml')
SHORT_PLUGIN_NAME = config['plugin-info']['SHORT_PLUGIN_NAME']
PLUGIN_NAME = f"pymodaq_plugins_{SHORT_PLUGIN_NAME}"

if not SHORT_PLUGIN_NAME.isidentifier():
raise ValueError("'SHORT_PLUGIN_NAME = %s' is not a valid python identifier." % SHORT_PLUGIN_NAME)

version_file = Path(__file__).parent.joinpath(f'src/{PLUGIN_NAME}/resources/VERSION') # new location of the version file
if not version_file.is_file():
version_file = Path(__file__).parent.joinpath(f'src/{PLUGIN_NAME}/VERSION')

with open(str(version_file), 'r') as fvers:
version = fvers.read().strip()


with open('README.rst') as fd:
long_description = fd.read()

setupOpts = dict(
name=PLUGIN_NAME,
description=config['plugin-info']['description'],
long_description=long_description,
license=config['plugin-info']['license'],
url=config['plugin-info']['package-url'],
author=config['plugin-info']['author'],
author_email=config['plugin-info']['author-email'],
classifiers=[
"Programming Language :: Python :: 3",
"Development Status :: 5 - Production/Stable",
"Environment :: Other Environment",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Human Machine Interfaces",
"Topic :: Scientific/Engineering :: Visualization",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: User Interfaces",
], )


return _setup(
version=version,
packages=find_packages(where='./src'),
package_dir={'': 'src'},
include_package_data=True,
entry_points={'pymodaq.plugins': f'{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}',
'pymodaq.pid_models': f"{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}",
'pymodaq.extensions': f"{SHORT_PLUGIN_NAME} = {PLUGIN_NAME}"},
install_requires=['toml', ]+config['plugin-install']['packages-required'],
**setupOpts
)


setup()

0 comments on commit f6d1747

Please sign in to comment.