Commit 2263c33a authored by Joanne Hugé's avatar Joanne Hugé

debug py3 egg

parent 0fc6e204
...@@ -21,6 +21,7 @@ Authenticated communication: ...@@ -21,6 +21,7 @@ Authenticated communication:
import base64, hmac, hashlib, http.client, inspect, json, logging import base64, hmac, hashlib, http.client, inspect, json, logging
import mailbox, os, platform, random, select, smtplib, socket, sqlite3 import mailbox, os, platform, random, select, smtplib, socket, sqlite3
import string, sys, threading, time, weakref, zlib import string, sys, threading, time, weakref, zlib
from collections import defaultdict, deque from collections import defaultdict, deque
from datetime import datetime from datetime import datetime
from http.server import HTTPServer, BaseHTTPRequestHandler from http.server import HTTPServer, BaseHTTPRequestHandler
......
import subprocess as _S dirty = 0
import os.path as _P
_d = _P.realpath(_P.dirname(_P.dirname(__file__)))
def _git_call(*args):
return _S.call(("git", "-c", "safe.directory=" + _d) + args, cwd=_d)
def _git_output(*args):
p = _S.Popen(
("git", "-c", "safe.directory=" + _d) + args,
cwd=_d,
stdout=_S.PIPE,
stderr=_S.PIPE)
out, err = p.communicate()
if p.returncode:
raise _S.CalledProcessError(p.returncode, "git", err)
return out.strip()
_git_call("update-index", "-q", "--refresh")
dirty = _git_call("diff-index", "--quiet", "HEAD", "--")
if dirty not in (0, 1):
raise _S.CalledProcessError(dirty, "git")
try:
revision = int(_git_output("rev-list", "--count", "HEAD"))
except _S.CalledProcessError: # BBB: Git too old
revision = len(_git_output("rev-list", "HEAD").split())
short = _git_output("rev-parse", "--short", "HEAD")
version = "0-%s.g%s" % (revision, short)
if dirty:
version += ".dirty"
# Because the software could be forked or have local changes/commits, above
# properties can't be used to decide whether a peer runs an appropriate version:
# they are intended to the network admin.
# Only 'protocol' is important and it must be increased whenever they would be
# a wish to force an update of nodes.
protocol = 8
min_protocol = 1 min_protocol = 1
protocol = 8
if __name__ == "__main__": revision = 632
print(version) short = '3b67c53'
version = '0-632.g3b67c53'
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