<commit_before>#!/usr/bin/env python

# Copyright (c) 2010-2015, <NAME> and CONTRIBUTORS
#
# The AEGeAn Toolkit is distributed under the ISC License. See
# the 'LICENSE' file in the AEGeAn source code distribution or
# online at https://github.com/standage/AEGeAn/blob/master/LICENSE.

import re
import subprocess
import sys

with open("VERSION", "r") as vfile:
  semverstr = vfile.read().replace('\n', '')
  semver, stability = semverstr.split(' ')

logproc = subprocess.Popen(["git", "log"], stdout=subprocess.PIPE,
                                           stderr=subprocess.PIPE)
logout, logerr = logproc.communicate()
if logerr:
  sha1 = ""
  sha1slug = ""
  link = "https://github.com/standage/AEGeAn/releases/tag/"+ semver
  year = "2014"
else:
  sha1match = re.search("commit (\S+)", logout)
  assert sha1match, "could not find latest commit SHA1 hash"
  sha1 = sha1match.group(1)
  sha1slug = sha1[:10]
  link = "https://github.com/standage/AEGeAn/tree/"+ sha1
  
  yearmatch = re.search("Date:\s+.+(\d{4}) ", logout)
  assert yearmatch, "could not find year of latest commit"
  year = yearmatch.group(1)

print '#ifndef AEGEAN_VERSION_H'
print '#define AEGEAN_VERSION_H'
print '#define AGN_SEMANTIC_VERSION  "%s"' % semver
print '#define AGN_VERSION_STABILITY "%s"' % stability
print '#define AGN_VERSION_HASH      "%s"' % sha1
print '#define AGN_VERSION_HASH_SLUG "%s"' % sha1slug<commit_msg>allow building without Git installed<commit_after>#!/usr/bin/env python

# Copyright (c) 2010-2015, <NAME> and CONTRIBUTORS
#
# The AEGeAn Toolkit is distributed under the ISC License. See
# the 'LICENSE' file in the AEGeAn source code distribution or
# online at https://github.com/standage/AEGeAn/blob/master/LICENSE.

import re
import subprocess
import sys

with open("VERSION", "r") as vfile:
  semverstr = vfile.read().replace('\n', '')
  semver, stability = semverstr.split(' ')

try:
  logproc = subprocess.Popen(["git", "log"], stdout=subprocess.PIPE,
                                             stderr=subprocess.PIPE)
  logout, logerr = logproc.communicate()
except:
  logerr = True

if logerr:
  sha1 = ""
  sha1slug = ""
  link = "https://github.com/standage/AEGeAn/releases/tag/"+ semver
  year = "2014"
else:
  sha1match = re.search("commit (\S+)", logout)
  assert sha1match, "could not find latest commit SHA1 hash"
  sha1 = sha1match.group(1)
  sha1slug = sha1[:10]
  link = "https://github.com/standage/AEGeAn/tree/"+ sha1

  yearmatch = re.search("Date:\s+.+(\d{4}) ", logout)
  assert yearmatch, "could not find year of latest commit"
  year = yearmatch.group(1)

print '#ifndef AEGEAN_VERSION_H'
print '#define AEGEAN_VERSION_H'
print '#define AGN_SEMANTIC_VERSION  "%s"' % semver
print '#define AGN_VERSION_STABILITY "%s"' % stability
print '#define AGN_VERSION_HASH      "%s"' % sha1
print '#define AGN_VERSION_HASH_SLUG "%s"' % sha1slug
{'fraction_non_alphanumeric': 0.13926701570680627, 'fraction_numerical': 0.02024432809773124, 'mean_word_length': 3.9328743545611013, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1322763', 'n_tokens_mistral': 1029, 'n_tokens_neox': 979, 'n_words': 257}