summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Python.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2016-12-09 15:18:08 -0800
committerMark Spruiell <mes@zeroc.com>2016-12-09 15:18:08 -0800
commit3b7e9f99b61538e0bbd6f07deeb7f7cb12013ed5 (patch)
treea8edbf5d1043527cc50880b34ee83458ed7e4855 /cpp/src/Slice/Python.cpp
parentMerge remote-tracking branch 'origin/3.6' (diff)
downloadice-3b7e9f99b61538e0bbd6f07deeb7f7cb12013ed5.tar.bz2
ice-3b7e9f99b61538e0bbd6f07deeb7f7cb12013ed5.tar.xz
ice-3b7e9f99b61538e0bbd6f07deeb7f7cb12013ed5.zip
ICE-7138 - new Python AMI mapping based on futures and modified AMD mapping
Diffstat (limited to 'cpp/src/Slice/Python.cpp')
-rw-r--r--cpp/src/Slice/Python.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/cpp/src/Slice/Python.cpp b/cpp/src/Slice/Python.cpp
index cf46117d345..b602b09a1c0 100644
--- a/cpp/src/Slice/Python.cpp
+++ b/cpp/src/Slice/Python.cpp
@@ -401,10 +401,7 @@ usage(const string& n)
"--all Generate code for Slice definitions in included files.\n"
"--checksum Generate checksums for Slice definitions.\n"
"--prefix PREFIX Prepend filenames of Python modules with PREFIX.\n"
- "--ice Allow reserved Ice prefix in Slice identifiers\n"
- " deprecated: use instead [[\"ice-prefix\"]] metadata.\n"
- "--underscore Allow underscores in Slice identifiers\n"
- " deprecated: use instead [[\"underscore\"]] metadata.\n"
+ "--python3 Generate code for the Python 3 mapping.\n"
;
}
@@ -432,6 +429,7 @@ Slice::Python::compile(const vector<string>& argv)
opts.addOpt("", "build-package");
opts.addOpt("", "checksum");
opts.addOpt("", "prefix", IceUtilInternal::Options::NeedArg);
+ opts.addOpt("", "python3");
vector<string> args;
try
@@ -502,6 +500,8 @@ Slice::Python::compile(const vector<string>& argv)
string prefix = opts.optArg("prefix");
+ bool python3 = opts.isSet("python3");
+
if(args.empty())
{
getErrorStream() << argv[0] << ": error: no input file" << endl;
@@ -661,15 +661,17 @@ Slice::Python::compile(const vector<string>& argv)
FileTracker::instance()->addFile(file);
//
- // Python magic comment to set the file encoding, it must be first or second line
+ // Emit a Python magic comment to set the file encoding.
+ // It must be the first or second line.
//
out << "# -*- coding: utf-8 -*-\n";
printHeader(out);
printGeneratedHeader(out, base + ".ice", "#");
+
//
- // Generate the Python mapping.
+ // Generate Python code.
//
- generate(u, all, checksum, includePaths, out);
+ generate(u, all, checksum, python3, includePaths, out);
out.close();
}