Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
Latest commit
60 lines (49 loc) · 2.18 KB
/
Copy pathsetup.py
File metadata and controls
60 lines (49 loc) · 2.18 KB
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
#!/usr/bin/env python
# Fill out this template to enable setuptools installation of your plugin as a
# Python package, i.e. `python setup.py develop` or `python setup.py install`.
# This script it set up to additionally register the plugin with PYME in a post-
# install command by running the included `install_plugin.py` script. You can
# get arbitrarily fancy there if you like in terms of configuring your plugin.
# Replace 'package_name' with the name of your plugin. This must be importable,
# and will point towards the directory by the same name in your repository. For
# example you might call your repository directory 'pyme-plugin' but the
# directory inside of it which stores all of your installable python code should
# be called 'pyme_plugin'.
PACKAGE_NAME='package_name'
# Set your version, as a string. Something like YY.MM.DD works well here
PACKAGE_VERSION='00.00.00'
# Include a short description of your package. This might eventually get
# displayed in e.g. Anaconda cloud if you build/upload packages, etc.
PACKAGE_DESCRIPTION='What your plugin does'
# -------- If you filled in everything up to here you should be set ------------
fromsetuptoolsimportsetup, find_packages
fromsetuptools.command.developimportdevelop
fromsetuptools.command.installimportinstall
definstall_pyme_plugin():
importsys
importsubprocess
importos
plugin_install_path=os.path.join(os.path.dirname(__file__), PACKAGE_NAME,
'install_plugin.py')
subprocess.Popen('%s %s'% (sys.executable, plugin_install_path),
shell=True)
classDevelopModuleAndInstallPlugin(develop):
"""Post-installation for development mode."""
defrun(self):
develop.run(self)
install_pyme_plugin()
classInstallModuleAndInstallPlugin(install):
"""Post-installation for installation mode."""
defrun(self):
install.run(self)
install_pyme_plugin()
setup(
name=PACKAGE_NAME,
version=PACKAGE_VERSION,
description=PACKAGE_DESCRIPTION,
packages=find_packages(),
cmdclass={
'develop': DevelopModuleAndInstallPlugin,
'install': InstallModuleAndInstallPlugin,
},
)