Skip to content
This repository has been archived by the owner on Oct 18, 2020. It is now read-only.

Commit

Permalink
Release 1.5.2.rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
scudette committed Jun 1, 2016
1 parent 43960e2 commit c21f7d9
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 24 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
include version.py
include version.yaml
include README.md
include _version.py

recursive-include resources *
recursive-include src *.c *.h *.py
recursive-include test_data *
Expand Down
101 changes: 101 additions & 0 deletions _version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@

# Machine Generated - do not edit!

# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.

def get_versions():
return tag_version_data(raw_versions(), """version.yaml""")

def raw_versions():
return json.loads("""
{
"codename": "Furka",
"version": "1.5.2",
"post": "0",
"rc": "1"
}
""")

import json
import os
import subprocess

try:
# We are looking for the git repo which contains this file.
MY_DIR = os.path.dirname(__file__)
except:
MY_DIR = None

def is_tree_dirty():
try:
return bool(subprocess.check_output(
["git", "diff", "--name-only"], stderr=subprocess.PIPE,
cwd=MY_DIR,
).splitlines())
except (OSError, subprocess.CalledProcessError):
return False

def get_version_file_path(version_file="version.yaml"):
try:
return os.path.join(subprocess.check_output(
["git", "rev-parse", "--show-toplevel"], stderr=subprocess.PIPE,
cwd=MY_DIR,
).strip(), version_file)
except (OSError, subprocess.CalledProcessError):
return None

def number_of_commit_since(version_file="version.yaml"):
"""Returns the number of commits since version.yaml was changed."""
try:
last_commit_to_touch_version_file = subprocess.check_output(
["git", "log", "--no-merges", "-n", "1", "--pretty=format:%H",
version_file], cwd=MY_DIR, stderr=subprocess.PIPE,
).strip()

all_commits = subprocess.check_output(
["git", "log", "--no-merges", "-n", "1000", "--pretty=format:%H"],
stderr=subprocess.PIPE, cwd=MY_DIR,
).splitlines()
return all_commits.index(last_commit_to_touch_version_file)
except (OSError, subprocess.CalledProcessError, ValueError):
return None


def get_current_git_hash():
try:
return subprocess.check_output(
["git", "log", "--no-merges", "-n", "1", "--pretty=format:%H"],
stderr=subprocess.PIPE, cwd=MY_DIR,
).strip()
except (OSError, subprocess.CalledProcessError):
return None

def tag_version_data(version_data, version_path="version.yaml"):
current_hash = get_current_git_hash()
# Not in a git repository.
if current_hash is None:
version_data["error"] = "Not in a git repository."

else:
version_data["revisionid"] = current_hash
version_data["dirty"] = is_tree_dirty()
version_data["dev"] = number_of_commit_since(
get_version_file_path(version_path))

# Format the version according to pep440:
pep440 = version_data["version"]
if int(version_data.get("post", 0)) > 0:
pep440 += ".post" + version_data["post"]

elif int(version_data.get("rc", 0)) > 0:
pep440 += ".rc" + version_data["rc"]

if version_data.get("dev", 0):
pep440 += ".dev" + str(version_data["dev"])

version_data["pep440"] = pep440

return version_data
16 changes: 10 additions & 6 deletions rekall-core/rekall/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ def get_versions():
def raw_versions():
return json.loads("""
{
"codename": "Furka",
"version": "1.5.1",
"post": "2"
"codename": "Furka",
"version": "1.5.2",
"post": "0",
"rc": "1"
}
""")

Expand All @@ -41,7 +42,7 @@ def get_version_file_path(version_file="version.yaml"):
try:
return os.path.join(subprocess.check_output(
["git", "rev-parse", "--show-toplevel"], stderr=subprocess.PIPE,
cwd=MY_DIR,
cwd=MY_DIR,
).strip(), version_file)
except (OSError, subprocess.CalledProcessError):
return None
Expand Down Expand Up @@ -82,13 +83,16 @@ def tag_version_data(version_data, version_path="version.yaml"):
version_data["revisionid"] = current_hash
version_data["dirty"] = is_tree_dirty()
version_data["dev"] = number_of_commit_since(
get_version_file_path(version_path))
get_version_file_path(version_path))

# Format the version according to pep440:
pep440 = version_data["version"]
if version_data.get("post"):
if int(version_data.get("post", 0)) > 0:
pep440 += ".post" + version_data["post"]

elif int(version_data.get("rc", 0)) > 0:
pep440 += ".rc" + version_data["rc"]

if version_data.get("dev", 0):
pep440 += ".dev" + str(version_data["dev"])

Expand Down
14 changes: 9 additions & 5 deletions rekall-gui/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ def raw_versions():
return json.loads("""
{
"codename": "Furka",
"version": "1.5.1",
"post": "2"
"version": "1.5.2",
"post": "0",
"rc": "1"
}
""")

Expand All @@ -41,7 +42,7 @@ def get_version_file_path(version_file="version.yaml"):
try:
return os.path.join(subprocess.check_output(
["git", "rev-parse", "--show-toplevel"], stderr=subprocess.PIPE,
cwd=MY_DIR,
cwd=MY_DIR,
).strip(), version_file)
except (OSError, subprocess.CalledProcessError):
return None
Expand Down Expand Up @@ -82,13 +83,16 @@ def tag_version_data(version_data, version_path="version.yaml"):
version_data["revisionid"] = current_hash
version_data["dirty"] = is_tree_dirty()
version_data["dev"] = number_of_commit_since(
get_version_file_path(version_path))
get_version_file_path(version_path))

# Format the version according to pep440:
pep440 = version_data["version"]
if version_data.get("post"):
if int(version_data.get("post", 0)) > 0:
pep440 += ".post" + version_data["post"]

elif int(version_data.get("rc", 0)) > 0:
pep440 += ".rc" + version_data["rc"]

if version_data.get("dev", 0):
pep440 += ".dev" + str(version_data["dev"])

Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
from setuptools.command.install import install as _install
from setuptools.command.develop import develop as _develop

ENV = {"__file__": __file__}
exec open("rekall-core/rekall/_version.py").read() in ENV
VERSION = ENV["get_versions"]()
import _version
VERSION = _version.get_versions()

rekall_description = "Rekall Memory Forensic Framework"

Expand Down
14 changes: 9 additions & 5 deletions tools/layout_expert/layout_expert/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ def raw_versions():
return json.loads("""
{
"codename": "Furka",
"version": "1.5.1",
"post": "2"
"version": "1.5.2",
"post": "0",
"rc": "1"
}
""")

Expand All @@ -41,7 +42,7 @@ def get_version_file_path(version_file="version.yaml"):
try:
return os.path.join(subprocess.check_output(
["git", "rev-parse", "--show-toplevel"], stderr=subprocess.PIPE,
cwd=MY_DIR,
cwd=MY_DIR,
).strip(), version_file)
except (OSError, subprocess.CalledProcessError):
return None
Expand Down Expand Up @@ -82,13 +83,16 @@ def tag_version_data(version_data, version_path="version.yaml"):
version_data["revisionid"] = current_hash
version_data["dirty"] = is_tree_dirty()
version_data["dev"] = number_of_commit_since(
get_version_file_path(version_path))
get_version_file_path(version_path))

# Format the version according to pep440:
pep440 = version_data["version"]
if version_data.get("post"):
if int(version_data.get("post", 0)) > 0:
pep440 += ".post" + version_data["post"]

elif int(version_data.get("rc", 0)) > 0:
pep440 += ".rc" + version_data["rc"]

if version_data.get("dev", 0):
pep440 += ".dev" + str(version_data["dev"])

Expand Down
16 changes: 13 additions & 3 deletions version.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_version_file_path(version_file="version.yaml"):
try:
return os.path.join(subprocess.check_output(
["git", "rev-parse", "--show-toplevel"], stderr=subprocess.PIPE,
cwd=MY_DIR,
cwd=MY_DIR,
).strip(), version_file)
except (OSError, subprocess.CalledProcessError):
return None
Expand Down Expand Up @@ -76,13 +76,16 @@ def tag_version_data(version_data, version_path="version.yaml"):
version_data["revisionid"] = current_hash
version_data["dirty"] = is_tree_dirty()
version_data["dev"] = number_of_commit_since(
get_version_file_path(version_path))
get_version_file_path(version_path))
# Format the version according to pep440:
pep440 = version_data["version"]
if version_data.get("post"):
if int(version_data.get("post", 0)) > 0:
pep440 += ".post" + version_data["post"]
elif int(version_data.get("rc", 0)) > 0:
pep440 += ".rc" + version_data["rc"]
if version_data.get("dev", 0):
pep440 += ".dev" + str(version_data["dev"])
Expand Down Expand Up @@ -135,6 +138,7 @@ def escape_string(instr):
def update(args):
if (args.version is None and
args.post is None and
args.rc is None and
args.codename is None):
raise AttributeError("You must set something in this release.")

Expand All @@ -146,6 +150,9 @@ def update(args):
if args.post:
version_data["post"] = args.post

if args.rc:
version_data["rc"] = args.rc

if args.codename:
version_data["codename"] = args.codename

Expand Down Expand Up @@ -184,6 +191,9 @@ def main():
update_parser.add_argument(
"--post", help="Set to this new post release.")

update_parser.add_argument(
"--rc", help="Set to this new release candidate.")

update_parser.add_argument(
"--codename", help="Set to this new codename.")

Expand Down
6 changes: 4 additions & 2 deletions version.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
dependent_versions:
- _version.py
- rekall-core/rekall/_version.py
- rekall-gui/_version.py
- tools/layout_expert/layout_expert/_version.py
version_data:
codename: Furka
post: '2'
version: 1.5.1
post: '0'
rc: '1'
version: 1.5.2

0 comments on commit c21f7d9

Please sign in to comment.