Skip to content

Commit

Permalink
Bump version to 2.9; add global version file (#1524)
Browse files Browse the repository at this point in the history
* add a version file

use version file for deb and python pakcages
print version number in minimega

* remove original debian control file

* fix typo in detecting python install

* fix versioning in other scripts
  • Loading branch information
jacdavi authored Jan 4, 2024
1 parent 81db32c commit 1a428a9
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 15 deletions.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION=2.9
2 changes: 1 addition & 1 deletion cmd/miniccc/main_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func main() {
flag.Parse()

if *f_version {
fmt.Println("miniccc", version.Revision, version.Date)
fmt.Println("miniccc", version.Version, version.Revision, version.Date)
fmt.Println(version.Copyright)
os.Exit(0)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/minimega/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func main() {
}

if *f_version {
fmt.Println("minimega", version.Revision, version.Date)
fmt.Println("minimega", version.Version, version.Revision, version.Date)
fmt.Println(version.Copyright)
os.Exit(0)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/minimega/misc_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func cliDebug(ns *Namespace, c *minicli.Command, resp *minicli.Response) error {
}

func cliVersion(ns *Namespace, c *minicli.Command, resp *minicli.Response) error {
resp.Response = fmt.Sprintf("minimega %v %v", version.Revision, version.Date)
resp.Response = fmt.Sprintf("minimega %v %v %v", version.Version, version.Revision, version.Date)
return nil
}

Expand Down
1 change: 1 addition & 0 deletions lib/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include VERSION
7 changes: 4 additions & 3 deletions lib/setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import os
import shutil
from distutils.core import setup


with open("README", "r") as readme_file:
readme_content = readme_file.read()

with open("VERSION", "r") as version_file:
version = version_file.read().split('=')[1].strip()

setup(
name='minimega',
description="Python API for minimega",
Expand All @@ -14,7 +15,7 @@
long_description=readme_content,
license="GPLv3",
url="https://minimega.org",
version="2.7",
version=version,
py_modules=["minimega"],
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
6 changes: 6 additions & 0 deletions packaging/debian/build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ cp -r $MM/LICENSES $DOCS/

echo COPIED FILES

# substitute version for control file
source $MM/VERSION
sed -e 's/${version}/'"$VERSION"'/g' minimega/DEBIAN/control.base > minimega/DEBIAN/control

echo BUILDING PACKAGE...
(cd $SCRIPT_DIR && fakeroot dpkg-deb -b minimega)
rm minimega/DEBIAN/control
echo DONE

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: minimega
Version: 2.8
Version: ${version}
Section: utils
Priority: extra
Architecture: amd64
Expand Down
17 changes: 13 additions & 4 deletions scripts/build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ ROOT_DIR="$( cd ${SCRIPT_DIR}/.. && pwd )"
. $SCRIPT_DIR/env.bash

# set the version from the repo
VERSION=`git --git-dir $ROOT_DIR/.git rev-parse HEAD`
source $ROOT_DIR/VERSION
REVISION=`git --git-dir $ROOT_DIR/.git rev-parse HEAD`
DATE=`date --rfc-3339=date`
echo "package version
var (
Revision = \"$VERSION\"
Version = \"$VERSION\"
Revision = \"$REVISION\"
Date = \"$DATE\"
)" > $ROOT_DIR/internal/version/version.go

Expand Down Expand Up @@ -63,12 +65,19 @@ $ROOT_DIR/bin/pyapigen -out $ROOT_DIR/lib/minimega.py $ROOT_DIR/bin/minimega

# If python is installed, build a source distribution for the
# minimega Python bindings.
if [ -x "$(command -v python)" ]; then
py_path=$(command -v python3)
if [ -z "$py_path" ]; then
py_path=$(command -v python)
fi
if [ ! -z "$py_path" ]; then
echo "BUILD PYTHON DIST"
cp $ROOT_DIR/README $ROOT_DIR/lib/
cp $ROOT_DIR/VERSION $ROOT_DIR/lib/
pushd $ROOT_DIR/lib
python setup.py --quiet sdist
$py_path setup.py --quiet sdist
popd
rm $ROOT_DIR/lib/README
rm $ROOT_DIR/lib/VERSION
fi

unset GOOS
6 changes: 4 additions & 2 deletions scripts/check.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ ROOT_DIR="$( cd ${SCRIPT_DIR}/.. && pwd )"
. $SCRIPT_DIR/env.bash

# set the version from the repo
VERSION=`git --git-dir $ROOT_DIR/.git rev-parse HEAD`
source $ROOT_DIR/VERSION
REVISION=`git --git-dir $ROOT_DIR/.git rev-parse HEAD`
DATE=`date --rfc-3339=date`
echo "package version
var (
Revision = \"$VERSION\"
Version = \"$VERSION\"
Revision = \"$REVISION\"
Date = \"$DATE\"
)" > $ROOT_DIR/internal/version/version.go

Expand Down
6 changes: 4 additions & 2 deletions scripts/test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ ROOT_DIR="$( cd ${SCRIPT_DIR}/.. && pwd )"
. $SCRIPT_DIR/env.bash

# set the version from the repo
VERSION=`git --git-dir $ROOT_DIR/.git rev-parse HEAD`
source $ROOT_DIR/VERSION
REVISION=`git --git-dir $ROOT_DIR/.git rev-parse HEAD`
DATE=`date --rfc-3339=date`
echo "package version
var (
Revision = \"$VERSION\"
Version = \"$VERSION\"
Revision = \"$REVISION\"
Date = \"$DATE\"
)" > $ROOT_DIR/internal/version/version.go

Expand Down

0 comments on commit 1a428a9

Please sign in to comment.