Skip to content

Commit

Permalink
Fixes #239.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneBachmann committed Jun 9, 2018
1 parent 642d9a1 commit d737033
Show file tree
Hide file tree
Showing 5 changed files with 388 additions and 375 deletions.
11 changes: 5 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
RELEASE = "1.6.1"
COMPATIBILITY_LEVEL = "3.4"

print("sys.argv is %r" % sys.argv)
readmeFile = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'README.md')
if 'build' in sys.argv:
if os.environ.get("CI", "False").lower() != "true":
if os.environ.get("CI", "False").lower() != "true": # code only run locally, not on CI
print("Transpiling Coconut files to Python...")
cmd = "-develop" if 0 == subprocess.Popen("coconut-develop --help", shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE, bufsize = 1000000).wait() and os.getenv("NODEV", "false").strip().lower() != "true" else ""
if "--mypy" in sys.argv:
Expand All @@ -21,7 +20,6 @@
if "--force" in sys.argv: sys.argv.remove('--force')

if os.path.exists(".git"): # must be local development, but ignored
print("Preparing documentation for PyPI by converting from Markdown to reStructuredText via pandoc")
try:
so, se = subprocess.Popen("git describe --always", shell = sys.platform != 'win32', bufsize = 1, stdout = subprocess.PIPE).communicate() # use tag or hash
extra = so.strip().decode(sys.stdout.encoding).replace("\n", "-")
Expand All @@ -38,15 +36,16 @@
__version__ = r'{fullName}'
__release_version__ = '{release}'""".format(version = version, fullName = versionString + "-" + extra, release = RELEASE))

README = "\n".join(["# SOS v%s #" % RELEASE] + open(readmeFile, "r").read().split("\n")[1:]) # replace title in original README file
README = "\n".join(["# SOS v%s #" % RELEASE] + open(readmeFile, "r").read().split("\n")[1:]) # replace title in original README.md file
with open(readmeFile, "wb") as fd: fd.write(README.encode("UTF-8").replace(b"\r", b""))
print("Preparing documentation for PyPI by converting from Markdown to reStructuredText via pandoc")
if 0 != os.system("pandoc --from=markdown --to=rst --output=README.rst README.md"): print("Warning: Cannot run pandoc")
if not os.path.exists("README.rst"): shutil.copy("README.md", "README.rst") # just to continue

import sos.sos as sos

if 'test' in sys.argv:
import logging
import logging # manual setup of logger in current main thread
logging.basicConfig(level = logging.DEBUG, stream = sys.stderr, format = "%(asctime)-23s %(levelname)-8s %(name)s:%(lineno)d | %(message)s" if '--log' in sys.argv else "%(message)s")
sys.argv.append("--verbose")
import sos.sos as sos
Expand Down Expand Up @@ -112,7 +111,7 @@
license = 'MPL-2.0',
packages = find_packages(), # should return ["sos"], but returns []
package_dir = {"sos": "sos"},
package_data = {"": ["../LICENSE", "../README.md", "../README.rst", "*.coco"]},
package_data = {"": ["../LICENSE", "../*.md", "../README.rst", "*.coco"]}, # *.py is included in any case
include_package_data = False, # if True, will *NOT* package the data!
zip_safe = False, # TODO re-add and test extras section for backport = enum34
extras_require = { ':python_version < "3.5"': 'typing >= 3.5.3' },
Expand Down
2 changes: 2 additions & 0 deletions sos/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import sos
sos.main()
7 changes: 6 additions & 1 deletion sos/sos.coco
Original file line number Diff line number Diff line change
Expand Up @@ -922,14 +922,19 @@ def log(options:str[] = [], cwd:str? = None):
last:Dict[str,PathInfo] = {} # path infos from previous revision
commit:CommitInfo
n:Metadata = Metadata() # used for reading parent branch information
indicator:ProgressIndicator? = ProgressIndicator(PROGRESS_MARKER[1 if m.c.useUnicodeFont else 0]) if '--all' not in options and maxi > number_ ?? m.c.logLines else None
digits:int? = pure.requiredDecimalDigits(maxi) if indicator else None
lastno:int = max(0, maxi + 1 - (number_ ?? m.c.logLines))
for no in range(maxi + 1):
if indicator: printo(" %%s %%0%dd" % digits % (indicator.getIndicator(), no), nl = "\r")
if no in m.commits: commit = m.commits[no]
else:
if n.branch != n.getParentBranch(m.branch, no): n.loadBranch(n.getParentBranch(m.branch, no))
commit = n.commits[no]
nxts:Dict[str,PathInfo] = next(changesetIterator)
news:FrozenSet[str] = frozenset(nxts.keys())
if "--all" in options or no >= max(0, maxi + 1 - (number_ ?? m.c.logLines)):
if "--all" in options or no >= lastno:
if no >= lastno: indicator = None
_add:FrozenSet[str] = news - olds
_del:FrozenSet[str] = olds - news
# _mod_:Dict[str,PathInfo] = {k: nxts[k] for k in news - _add - _del}
Expand Down
Loading

0 comments on commit d737033

Please sign in to comment.