Skip to content

Commit

Permalink
Remove plugins install
Browse files Browse the repository at this point in the history
  • Loading branch information
GILIYAR RADHAKRISHNA Chaithya committed Jan 19, 2024
1 parent f48245d commit 49a3a6a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 69 deletions.
3 changes: 0 additions & 3 deletions plugins.txt

This file was deleted.

2 changes: 1 addition & 1 deletion pysap/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Module current version
version_major = 0
version_minor = 2
version_micro = 0
version_micro = 1

# Expected by setup.py: string of form "X.Y.Z"
__version__ = '{0}.{1}.{2}'.format(version_major, version_minor, version_micro)
Expand Down
66 changes: 1 addition & 65 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
os.path.join('pysap', 'apps', 'pysapview3')
]

# Source PySAP plug-ins
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'plugins.txt')) as f:
pysap_plugins = f.read().splitlines()

# Workaround
rm_args = []
Expand Down Expand Up @@ -77,66 +73,6 @@
sys.argv.remove(arg)


def check_plugins(plugin_list):
"""Check if requested plug-ins exist."""

if not isinstance(plugin_list, list):
raise TypeError('Plug-in list must be of type list.')

plugins_dict = dict([
_plugin.split('==') for _plugin in pysap_plugins
])
allowed_plugins = plugins_dict.keys()

only_pinned = []
for plugin in plugin_list:
if plugin not in allowed_plugins:
raise ValueError(
'"{0}" is not currently a valid PySAP plug-in'.format(plugin)
+ '\nAvailable PySAP plug-ins are: '
+ '{0}\n'.format(list(allowed_plugins))
)
only_pinned.append(
'{0}=={1}'.format(plugin, plugins_dict[plugin])
)

return only_pinned


def pipinstall(package_list):
"""Pip install PyPi packages."""

if not isinstance(package_list, list):
raise TypeError('Pre-install inputs must be of type list.')

for package in package_list:
subprocess.check_call(
[sys.executable, '-m', 'pip', 'install', package]
)


def install_plugins():
"""Install Plug-Ins."""

plugin_list = pysap_plugins
if only_plugins:
plugin_list = check_plugins(only_plugins)
elif no_plugins:
plugin_list = []

pipinstall(plugin_list)

print('\nPySAP plug-ins installed: {0}\n'.format(plugin_list))


class CustomInstall(install):
"""Custom Install Class."""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
atexit.register(install_plugins)


class CMakeExtension(Extension):
"""Use absolute path in setuptools extension."""
def __init__(self, name, sourcedir=''):
Expand Down Expand Up @@ -254,7 +190,7 @@ def run(self):

# Set default values for ext_modules and cmdclass
ext_modules = None
cmdclass = {'install': CustomInstall}
cmdclass = {'install': install}

# Add Sparse2D build commands
if build_sparse2d:
Expand Down

0 comments on commit 49a3a6a

Please sign in to comment.