Python eggs
Main problem with this extension on Windows OS was external dependency Markdown and unlike on Ubuntu you cannot execute apt-get python-markdown in your shell. TortoiseHG has bundled python and you cannot simply add egg inside dist-packages. I look at source and find out, that original way for Windows user was uncomment and edit line sys.path.append("c:/python27/Lib/site-packages/markdown-2.2.0-py2.7.egg") but nothing was in documentation about it.So I decide to rewrite this mechanism in fallback style: first we try to load markdown package and if failed, lookup using path from config (python can transparently lookup files in zip archives):
try:
from markdown import Markdown
except ImportError:
dir = os.path.dirname(os.path.realpath(__file__))
md = ui.config("web", "markdown.egg", "Markdown-2.3.1")
ui.debug("Markdown not found search for egg in local dir %s for %s.zip\n" % (dir, md))
sys.path.append(os.path.join(dir, "%s.zip\%s" % (md, md)))
try:
from markdown import Markdown
except ImportError:
ui.error("Unable to locate markdown in path %s" % sys.path)
global Markdown
this is final version corrected by Chris Eldredge. Now you can download markdown package and put it in extension folder.
Relative paths
![]() | |
Rendering comparison BitBucket vs hgext.markdown |