mirror of https://github.com/m-labs/artiq.git
afws: nix requires full Git commit hash
This commit is contained in:
parent
833acb6925
commit
cc69482dad
|
@ -26,14 +26,7 @@ def get_artiq_rev():
|
|||
import artiq
|
||||
except ImportError:
|
||||
return None
|
||||
version = artiq.__version__
|
||||
if version.endswith(".beta"):
|
||||
version = version[:-5]
|
||||
version = version.split(".")
|
||||
if len(version) != 3:
|
||||
return None
|
||||
major, minor, rev = version
|
||||
return rev
|
||||
return artiq._version.get_rev()
|
||||
|
||||
|
||||
def zip_unarchive(data, directory):
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
artiqVersionMinor = self.sourceInfo.revCount or 0;
|
||||
artiqVersionId = self.sourceInfo.shortRev or "unknown";
|
||||
artiqVersion = (builtins.toString artiqVersionMajor) + "." + (builtins.toString artiqVersionMinor) + "." + artiqVersionId + ".beta";
|
||||
artiqRev = self.sourceInfo.rev or "unknown";
|
||||
|
||||
rustManifest = pkgs.fetchurl {
|
||||
url = "https://static.rust-lang.org/dist/2021-01-29/channel-rust-nightly.toml";
|
||||
|
@ -148,7 +149,11 @@
|
|||
version = artiqVersion;
|
||||
src = self;
|
||||
|
||||
preBuild = "export VERSIONEER_OVERRIDE=${version}";
|
||||
preBuild =
|
||||
''
|
||||
export VERSIONEER_OVERRIDE=${version}
|
||||
export VERSIONEER_REV=${artiqRev}
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
|
||||
# keep llvm_x and lld_x in sync with llvmlite
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
|
||||
VERSION_FILE = """
|
||||
def get_version():
|
||||
return "{version}"
|
||||
|
||||
def get_rev():
|
||||
return "{rev}"
|
||||
"""
|
||||
|
||||
def get_version():
|
||||
|
@ -18,10 +22,13 @@ def get_version():
|
|||
version += ".beta"
|
||||
return version
|
||||
|
||||
def write_to_version_file(filename, version):
|
||||
def get_rev():
|
||||
return os.getenv("VERSIONEER_REV", default="unknown")
|
||||
|
||||
def write_to_version_file(filename, version, rev):
|
||||
os.unlink(filename)
|
||||
with open(filename, "w") as f:
|
||||
f.write(VERSION_FILE.format(version=version))
|
||||
f.write(VERSION_FILE.format(version=version, rev=rev))
|
||||
|
||||
|
||||
def get_cmdclass():
|
||||
|
@ -36,11 +43,12 @@ def get_cmdclass():
|
|||
class cmd_build_py(_build_py):
|
||||
def run(self):
|
||||
version = get_version()
|
||||
rev = get_rev()
|
||||
_build_py.run(self)
|
||||
target_versionfile = os.path.join(self.build_lib,
|
||||
"artiq", "_version.py")
|
||||
print("UPDATING %s" % target_versionfile)
|
||||
write_to_version_file(target_versionfile, version)
|
||||
write_to_version_file(target_versionfile, version, rev)
|
||||
cmds["build_py"] = cmd_build_py
|
||||
|
||||
|
||||
|
@ -54,6 +62,7 @@ def get_cmdclass():
|
|||
def run(self):
|
||||
version = get_version()
|
||||
self._versioneer_generated_version = version
|
||||
self._versioneer_rev = get_rev()
|
||||
# unless we update this, the command will keep using the old
|
||||
# version
|
||||
self.distribution.metadata.version = version
|
||||
|
@ -64,7 +73,8 @@ def get_cmdclass():
|
|||
target_versionfile = os.path.join(base_dir, "artiq", "_version.py")
|
||||
print("UPDATING %s" % target_versionfile)
|
||||
write_to_version_file(target_versionfile,
|
||||
self._versioneer_generated_version)
|
||||
self._versioneer_generated_version,
|
||||
self._versioneer_rev)
|
||||
cmds["sdist"] = cmd_sdist
|
||||
|
||||
return cmds
|
||||
|
|
Loading…
Reference in New Issue