Commit 605dbfc9 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix up some version numbers

- Add a pyston micro version
- Move to the convention of "current version number is for the next release",
  instead of "previous release".  I think this is more standard?
- Get rid of our PYTHON_VERSION_MAJOR/MINOR/MICRO flags, and instead use CPython's
  versions.  We in theory had the ability to target different micro versions at
  runtime, but we never made use of this.  Having the two sets of flags isn't
  very sensible either.
parent dc03095e
......@@ -31,10 +31,6 @@ GTEST_DIR := $(DEPS_DIR)/gtest-1.7.0
USE_DEBUG_LIBUNWIND := 0
PYTHON_MAJOR_VERSION := 2
PYTHON_MINOR_VERSION := 7
PYTHON_MICRO_VERSION := 3
MAX_MEM_KB := 500000
MAX_DBG_MEM_KB := 500000
......@@ -147,7 +143,6 @@ else
endif
COMMON_CXXFLAGS += -DGITREV=$(shell git rev-parse HEAD | head -c 12) -DLLVMREV=$(LLVM_REVISION)
COMMON_CXXFLAGS += -DDEFAULT_PYTHON_MAJOR_VERSION=$(PYTHON_MAJOR_VERSION) -DDEFAULT_PYTHON_MINOR_VERSION=$(PYTHON_MINOR_VERSION) -DDEFAULT_PYTHON_MICRO_VERSION=$(PYTHON_MICRO_VERSION)
# Use our "custom linker" that calls gold if available
COMMON_LDFLAGS := -B$(TOOLS_DIR)/build_system -L/usr/local/lib -lpthread -lm -lunwind -llzma -L$(DEPS_DIR)/gcc-4.8.2-install/lib64 -lreadline -lgmp -lssl -lcrypto -lsqlite3
......@@ -476,7 +471,6 @@ quick_check:
Makefile.local:
echo "Creating default Makefile.local"
python -c 'import sys; v = sys.version_info; print "PYTHON_MAJOR_VERSION:=%d\nPYTHON_MINOR_VERSION:=%d\nPYTHON_MICRO_VERSION:=%d" % (v[0], v[1], v[2])' > Makefile.local || (rm $@; false)
which ninja-build >/dev/null && echo "NINJA := ninja-build" >> Makefile.local
llvm_up:
......
......@@ -780,7 +780,7 @@ static void raiseNameForcingSyntaxError(const char* msg, ScopingAnalysis::ScopeN
syntaxElemMsg = "import * is not allowed in function '%s' because it %s";
lineno = usage->nameForcingNodeImportStar->lineno;
} else {
if (PYTHON_VERSION_MAJOR == 2 && PYTHON_VERSION_MINOR == 7 && PYTHON_VERSION_MICRO < 8)
if (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7 && PY_MICRO_VERSION < 8)
syntaxElemMsg = "unqualified exec is not allowed in function '%.100s' it %s";
else
syntaxElemMsg = "unqualified exec is not allowed in function '%.100s' because it %s";
......
......@@ -72,7 +72,7 @@ FutureFlags getFutureFlags(std::vector<AST_stmt*> const& body, const char* file)
// Set the defaults for the future flags depending on what version we are
for (const std::pair<std::string, FutureOption>& p : future_options) {
if (PYTHON_VERSION_HEX >= p.second.mandatory_version_hex) {
if (PY_VERSION_HEX >= p.second.mandatory_version_hex) {
ff |= p.second.ff_mask;
}
}
......@@ -101,7 +101,7 @@ FutureFlags getFutureFlags(std::vector<AST_stmt*> const& body, const char* file)
raiseFutureImportErrorNotFound(file, alias, option_name.c_str());
} else {
const FutureOption& fo = iter->second;
if (PYTHON_VERSION_HEX >= fo.optional_version_hex) {
if (PY_VERSION_HEX >= fo.optional_version_hex) {
ff |= fo.ff_mask;
} else {
raiseFutureImportErrorNotFound(file, alias, option_name.c_str());
......
......@@ -19,13 +19,8 @@ namespace pyston {
int GLOBAL_VERBOSITY = 0;
int PYSTON_VERSION_MAJOR = 0;
int PYSTON_VERSION_MINOR = 3;
int PYTHON_VERSION_MAJOR = DEFAULT_PYTHON_MAJOR_VERSION;
int PYTHON_VERSION_MINOR = DEFAULT_PYTHON_MINOR_VERSION;
int PYTHON_VERSION_MICRO = DEFAULT_PYTHON_MICRO_VERSION;
int PYTHON_VERSION_HEX = version_hex(PYTHON_VERSION_MAJOR, PYTHON_VERSION_MINOR, PYTHON_VERSION_MICRO);
int PYSTON_VERSION_MINOR = 4;
int PYSTON_VERSION_MICRO = 0;
int MAX_OPT_ITERATIONS = 1;
......
......@@ -21,9 +21,7 @@ extern "C" {
extern int GLOBAL_VERBOSITY;
#define VERBOSITY(x) pyston::GLOBAL_VERBOSITY
extern int PYSTON_VERSION_MAJOR, PYSTON_VERSION_MINOR;
// Version number we're targeting:
extern int PYTHON_VERSION_MAJOR, PYTHON_VERSION_MINOR, PYTHON_VERSION_MICRO, PYTHON_VERSION_HEX;
extern int PYSTON_VERSION_MAJOR, PYSTON_VERSION_MINOR, PYSTON_VERSION_MICRO;
inline int version_hex(int major, int minor, int micro, int level = 0, int serial = 0) {
return (major << 24) | (minor << 16) | (micro << 8) | (level << 4) | (serial << 0);
......
......@@ -31,6 +31,7 @@
#include "llvm/Support/Signals.h"
#include "osdefs.h"
#include "patchlevel.h"
#include "asm_writing/disassemble.h"
#include "capi/types.h"
......@@ -507,8 +508,9 @@ static int main(int argc, char** argv) {
if (!v)
PyErr_Clear();
printf("Pyston v%d.%d (rev " STRINGIFY(GITREV) ")", PYSTON_VERSION_MAJOR, PYSTON_VERSION_MINOR);
printf(", targeting Python %d.%d.%d\n", PYTHON_VERSION_MAJOR, PYTHON_VERSION_MINOR, PYTHON_VERSION_MICRO);
printf("Pyston v%d.%d.%d (rev " STRINGIFY(GITREV) ")", PYSTON_VERSION_MAJOR, PYSTON_VERSION_MINOR,
PYSTON_VERSION_MICRO);
printf(", targeting Python %d.%d.%d\n", PY_MAJOR_VERSION, PY_MINOR_VERSION, PY_MICRO_VERSION);
Py_InspectFlag = 0;
......
......@@ -256,9 +256,9 @@ public:
static std::string generateVersionString() {
std::ostringstream oss;
oss << PYTHON_VERSION_MAJOR << '.' << PYTHON_VERSION_MINOR << '.' << PYTHON_VERSION_MICRO;
oss << PY_MAJOR_VERSION << '.' << PY_MINOR_VERSION << '.' << PY_MICRO_VERSION;
oss << '\n';
oss << "[Pyston " << PYSTON_VERSION_MAJOR << '.' << PYSTON_VERSION_MINOR << "]";
oss << "[Pyston " << PYSTON_VERSION_MAJOR << '.' << PYSTON_VERSION_MINOR << '.' << PYSTON_VERSION_MICRO << "]";
return oss.str();
}
......
......@@ -5347,12 +5347,12 @@ Box* getitemInternal(Box* target, Box* slice, GetitemRewriteArgs* rewrite_args)
rewrite_args = NULL;
// different versions of python give different error messages for this:
if (PYTHON_VERSION_MAJOR == 2 && PYTHON_VERSION_MINOR < 7) {
if (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 7) {
if (S == CAPI)
PyErr_Format(TypeError, "'%s' object is unsubscriptable", getTypeName(target)); // tested on 2.6.6
else
raiseExcHelper(TypeError, "'%s' object is unsubscriptable", getTypeName(target)); // tested on 2.6.6
} else if (PYTHON_VERSION_MAJOR == 2 && PYTHON_VERSION_MINOR == 7 && PYTHON_VERSION_MICRO < 3) {
} else if (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7 && PY_MICRO_VERSION < 3) {
if (S == CAPI)
PyErr_Format(TypeError, "'%s' object is not subscriptable", getTypeName(target)); // tested on 2.7.1
else
......
......@@ -204,7 +204,7 @@ Box* callCLFunc(CLFunction* f, CallRewriteArgs* rewrite_args, int num_output_arg
Box** oargs) noexcept(S == CAPI);
static const char* objectNewParameterTypeErrorMsg() {
if (PYTHON_VERSION_HEX >= version_hex(2, 7, 4)) {
if (PY_VERSION_HEX >= version_hex(2, 7, 4)) {
return "object() takes no parameters";
} else {
return "object.__new__() takes no parameters";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment