1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 00:07:14 +03:00

Revert "Don't generate .pyc/.pyo files for plugins"

since this breaks __file__ for the plugin. Document removal of .pyc/.pyo files instead.

Reverts b8d252a.
This commit is contained in:
Jonathan Harris 2017-08-17 10:11:55 +01:00
parent b8d252ae25
commit a2ce9da44e
2 changed files with 4 additions and 1 deletions

View File

@ -170,6 +170,8 @@ To package your plugin for distribution simply create a `.zip` archive of your p
If there are any external dependencies then include them in the plugin's folder.
Optionally, for tidiness delete any `.pyc` and `.pyo` files in the archive.
# Disable a plugin
EDMC now lets you disable a plugin without deleting it, simply rename the plugin folder to append ".disabled". Eg,

View File

@ -41,7 +41,8 @@ class Plugin(object):
if loadfile:
sys.stdout.write('loading plugin %s from "%s"\n' % (name, loadfile.encode('utf-8')))
with open(loadfile, 'rb') as plugfile:
module = imp.load_module('plugin_%s' % name, plugfile, '', ('.py', 'r', imp.PY_SOURCE))
module = imp.load_module('plugin_%s' % name, plugfile, loadfile.encode(sys.getfilesystemencoding()),
('.py', 'r', imp.PY_SOURCE))
newname = module.plugin_start()
self.name = newname and unicode(newname) or name
self.module = module