Fix PyPI packages.

It was broken by b1db15c056.
This commit is contained in:
Valentin Lorentz 2019-02-21 22:34:31 +01:00
parent 61f03ff0ed
commit b882d1cc00

View File

@ -48,7 +48,10 @@ if debug:
if path: if path:
os.chdir(path) os.chdir(path)
VERSION_FILE = os.path.join('src', 'version.py') if os.path.isdir('src'):
VERSION_FILE = os.path.join('src', 'version.py')
else:
VERSION_FILE = os.path.join('supybot', 'version.py')
version = None version = None
try: try:
if 'SOURCE_DATE_EPOCH' in os.environ: if 'SOURCE_DATE_EPOCH' in os.environ:
@ -64,7 +67,7 @@ try:
time.strptime(time.asctime(time.gmtime(date)))[:3]) time.strptime(time.asctime(time.gmtime(date)))[:3])
except: except:
if os.path.isfile(VERSION_FILE): if os.path.isfile(VERSION_FILE):
from src.version import version from supybot.version import version
else: else:
version = 'installed on ' + time.strftime("%Y-%m-%dT%H-%M-%S", time.gmtime()) version = 'installed on ' + time.strftime("%Y-%m-%dT%H-%M-%S", time.gmtime())
try: try:
@ -72,7 +75,7 @@ try:
except OSError: # Does not exist except OSError: # Does not exist
pass pass
if version: if version:
fd = open(os.path.join('src', 'version.py'), 'a') fd = open(VERSION_FILE, 'a')
fd.write("version = '%s'\n" % version) fd.write("version = '%s'\n" % version)
fd.write('try: # For import from setup.py\n') fd.write('try: # For import from setup.py\n')
fd.write(' import supybot.utils.python\n') fd.write(' import supybot.utils.python\n')