Commit ddccb22e authored by Matthias Putz's avatar Matthias Putz

added windows pager

parent 62834956
......@@ -3,12 +3,11 @@
<component name="ChangeListManager">
<list default="true" id="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/main.py" afterPath="$PROJECT_DIR$/main.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/project.py" afterPath="$PROJECT_DIR$/project.py" />
</list>
<ignored path="git-repo.iws" />
<ignored path=".idea/workspace.xml" />
<file path="/Dummy.txt" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363590315380" ignored="false" />
<file path="/main.py" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363598089701" ignored="false" />
<file path="/main.py" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363600781772" ignored="false" />
<file path="/portable.py" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363275619057" ignored="false" />
<file path="/a.py" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363252132925" ignored="false" />
<file path="/a.dummy" changelist="2c74b80f-dc83-420e-8ea2-4ad07fb0ac68" time="1363594579797" ignored="false" />
......@@ -80,13 +79,13 @@
<favorites_list name="git-repo" />
</component>
<component name="FileEditorManager">
<splitter split-orientation="horizontal" split-proportion="0.5163934">
<splitter split-orientation="horizontal" split-proportion="0.684111">
<split-first>
<leaf>
<file leaf-file-name="main.py" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state line="81" column="21" selection-start="2796" selection-end="2796" vertical-scroll-proportion="0.6992754">
<state line="417" column="0" selection-start="12997" selection-end="12997" vertical-scroll-proportion="0.39823008">
<folding>
<element signature="e#625#662#0" expanded="true" />
</folding>
......@@ -97,7 +96,7 @@
<file leaf-file-name="portable-pager.py" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/tests/portable-pager.py">
<provider selected="true" editor-type-id="text-editor">
<state line="70" column="6" selection-start="1497" selection-end="1497" vertical-scroll-proportion="0.0">
<state line="67" column="4" selection-start="1422" selection-end="1422" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
......@@ -184,7 +183,7 @@
<file leaf-file-name="pager.py" pinned="false" current="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/pager.py">
<provider selected="true" editor-type-id="text-editor">
<state line="55" column="4" selection-start="1423" selection-end="1423" vertical-scroll-proportion="0.3327645">
<state line="44" column="4" selection-start="1226" selection-end="1226" vertical-scroll-proportion="0.05235602">
<folding>
<element signature="e#603#640#0" expanded="true" />
</folding>
......@@ -760,7 +759,7 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="python-line">
<url>file://$PROJECT_DIR$/main.py</url>
<line>416</line>
<line>432</line>
<option name="timeStamp" value="18" />
</line-breakpoint>
<line-breakpoint enabled="true" type="python-line">
......@@ -800,12 +799,12 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="python-line">
<url>file://$PROJECT_DIR$/main.py</url>
<line>157</line>
<line>158</line>
<option name="timeStamp" value="40" />
</line-breakpoint>
<line-breakpoint enabled="true" type="python-line">
<url>file://$PROJECT_DIR$/main.py</url>
<line>410</line>
<line>414</line>
<option name="timeStamp" value="42" />
</line-breakpoint>
</breakpoints>
......@@ -913,20 +912,13 @@
</entry>
<entry file="file://$PROJECT_DIR$/pager.py">
<provider selected="true" editor-type-id="text-editor">
<state line="55" column="4" selection-start="1423" selection-end="1423" vertical-scroll-proportion="0.3327645">
<state line="44" column="4" selection-start="1226" selection-end="1226" vertical-scroll-proportion="0.05235602">
<folding>
<element signature="e#603#640#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/portable-pager.py">
<provider selected="true" editor-type-id="text-editor">
<state line="70" column="6" selection-start="1497" selection-end="1497" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/project.py">
<provider selected="true" editor-type-id="text-editor">
<state line="822" column="42" selection-start="26091" selection-end="26091" vertical-scroll-proportion="0.0">
......@@ -936,9 +928,16 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/portable-pager.py">
<provider selected="true" editor-type-id="text-editor">
<state line="67" column="4" selection-start="1422" selection-end="1422" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state line="81" column="21" selection-start="2796" selection-end="2796" vertical-scroll-proportion="0.6992754">
<state line="417" column="0" selection-start="12997" selection-end="12997" vertical-scroll-proportion="0.39823008">
<folding>
<element signature="e#625#662#0" expanded="true" />
</folding>
......
......@@ -40,6 +40,7 @@ from error import NoSuchProjectError
from error import RepoChangedException
from manifest_xml import XmlManifest
from pager import RunPager
from pager import _SelectPager
from subcmds import all_commands
......@@ -406,10 +407,25 @@ def _Debug(host, env):
sys.stderr.write("Error: you must add pydevd in a pysrc folder (e.g. in eclipse plugin) to your PYTHONPATH.\n")
sys.exit(1)
# If program runs in Windows and a Pager is required, fork has to circumvented:
# make a system call of the current script with the additional parameter '--no-pager' and
# append a pipe for the pager, e.g. '| less'
def _WindowsPager(repo):
(name, cmd, gopts, _gargs, copts, cargs, argv) = repo.config
if _UsePager(name, cmd, gopts, copts):
print("USE PAGER")
python = sys.executable
thisScript = os.path.abspath(__file__)
args = sys.argv[1:]
argsSplit = args.index('--')
args1 = args[:argsSplit]
args2 = args[argsSplit+1:]
pager = _SelectPager(cmd.manifest.globalConfig)
shellCommand = "%s %s %s -- --no-pager %s | %s" % (python, thisScript, ' '.join(args1), ' '.join(args2), pager)
print("EXECUTE: %s" % shellCommand)
os.system(shellCommand)
return True
return False
......@@ -438,8 +454,11 @@ def _Main(argv):
repo = _Repo(opt.repodir)
repo._Config(argv)
# intercept here if on Windows and Pager is required
if not portable.isLinux():
if _WindowsPager(repo):
# everything was already done; so exit
exit(0);
if opt.debug:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment