Skip to content
Permalink
Browse files

update project

  • Loading branch information...
sdpython committed Mar 21, 2019
1 parent 16766e7 commit fe52e4f674fbbdf7668ab16bcb20d6a68f4a2d8d
@@ -15,6 +15,7 @@ virtualenv:
# Dependencies to install.
install:
- $PYINT -c "from pip._internal import main;main(\"install --no-cache-dir --no-deps --index http://localhost:8067/simple/ jyquickhelper tkinterquickhelper --extra-index-url=https://pypi.python.org/simple/\".split())"
- $PYINT -c "from pip._internal import main;main(\"install --no-cache-dir --no-deps --index http://localhost:8067/simple/ pyrsslocal --no-deps --extra-index-url=https://pypi.python.org/simple/\".split())"
- $PYINT -c "from pip._internal import main;main(\"install -r requirements.txt\".split())"
- $PYINT --version
- $PYINT -m pip uninstall -y pyquickhelper
@@ -341,7 +341,7 @@ def zz_st_jconvert_sequence_into_batch_file(self, platform):
$PYINT --version
if [ $? -ne 0 ]; then exit $?; fi
$PYINT -m pip uninstall -y pyquickhelper
if [ $? -ne 0 ]; then exit $?; fi
if [ $? -ne 0 ]; then exit $?; fi
$PYINT -c "from pip._internal import main;main([\\"freeze\\"])"
if [ $? -ne 0 ]; then exit $?; fi
export JOB_NAME=UT
@@ -105,4 +105,5 @@ def _private_test_style_test(fLOG, run_lint, verbose=False, pattern=".*[.]py$"):
"Unable to import 'pyquickhelper",
"No name 'sphinxm_mock_app' in module 'pyquickhelper.helpgen'",
"test_yaml.py:333: [E501]",
"test_yaml.py:337: [E501]",
])
@@ -159,6 +159,33 @@ def shorten(t):
inter = []
reg = re.compile('\\"(([a-zA-Z]:)?[^:]*?[.]py)\\"')

def handle_filename(name, root_source_dup, begin, root_source, slash):
exp = name
name = name.groups()[0]
if not name.startswith(begin) and ':' not in name:
if not slash:
co = Counter(name)
if co.get('\\', 0) > 0 and co.get('\\\\', 0) == 0:
name = name.replace("\\", "\\\\")
name = "{0}{1}{2}".format(root_source_dup, begin, name)
if not name.startswith(root_source_dup):
end = root_source_dup.split(begin)[-1]
spl = name.split(end)
found = None
for i in range(len(spl) - 1, 0, -1):
last = begin.join(spl[i:]).lstrip(begin)
found = "{0}{1}{2}".format(
root_source_dup, begin, last)
if os.path.exists(found.replace("\\\\", "\\")):
break
if found is None:
mes = "Unable to handle one file.\nroot_source='{0}'\nroot_source_dup='{1}'\nname='{2}'\nbegin='{3}'\n{4}\n{5}"
raise ValueError(mes.format(
root_source, root_source_dup, name, begin, exp.groups(), end))
name = found

return '"{0}"'.format(name)

def copy_replace(source, dest, root_source):
with open(source, "r") as f:
content = f.read()
@@ -177,34 +204,8 @@ def copy_replace(source, dest, root_source):
root_source_dup = root_source.replace("\\", "\\\\")

if absolute_path:

def handle_filename(name):
name = name.groups()[0]
if not name.startswith(begin) and ':' not in name:
if not slash:
co = Counter(name)
if co.get('\\', 0) > 0 and co.get('\\\\', 0) == 0:
name = name.replace("\\", "\\\\")
name = "{0}{1}{2}".format(root_source_dup, begin, name)
if not name.startswith(root_source_dup):
end = root_source_dup.split(begin)[-1]
spl = name.split(end)
found = None
for i in range(len(spl) - 1, 0, -1):
last = begin.join(spl[i:]).lstrip(begin)
found = "{0}{1}{2}".format(
root_source_dup, begin, last)
if os.path.exists(found.replace("\\\\", "\\")):
break
if found is None:
mes = "Unable to handle one file.\nroot_source='{0}'\nroot_source_dup='{1}'\nname='{2}'\nbegin='{3}'"
raise ValueError(mes.format(
root_source, root_source_dup, name, begin))
name = found

return '"{0}"'.format(name)

content = reg.sub(handle_filename, content)
content = reg.sub(lambda name: handle_filename(name, root_source_dup, begin, root_source, slash),
content)

with open(dest, "w") as f:
f.write(content)
@@ -94,7 +94,8 @@ def run(self):
out, err = run_script(
name, fLOG=noLOG, wait=True, change_path=path)
if err:
out = "--OUT--\n{0}\n--ERR--\n{1}".format(out, err)
out = "--SCRIPT--{}\n--OUT--\n{}\n--ERR--\n{}\n--PATH--\n{}".format(
name, out, err, path)
content = "python " + name
cont += nodes.paragraph('<<<', '<<<')
pout = nodes.literal_block(content, content)

0 comments on commit fe52e4f

Please sign in to comment.
You can’t perform that action at this time.