Skip to content
Snippets Groups Projects
Commit cdb61b7b authored by COLLET Ismael's avatar COLLET Ismael
Browse files

created binary

parent d585904c
Branches master
No related tags found
No related merge requests found
Showing
with 3178 additions and 0 deletions
File added
No preview for this file type
File added
"./__constants.o"
"./__constants_data.o"
"./__helpers.o"
"./__loader.o"
"./module.__main__.o"
"./static_src/MainProgram.o"
"./static_src/CompiledCellType.o"
"./static_src/CompiledFunctionType.o"
"./static_src/CompiledGeneratorType.o"
"./static_src/CompiledCodeHelpers.o"
"./static_src/InspectPatcher.o"
"./static_src/MetaPathBasedLoader.o"
File added
#include "nuitka/prelude.h"
#include "structseq.h"
// Global constants storage
PyObject *global_constants[69];
// Sentinel PyObject to be used for all our call iterator endings. It will
// become a PyCObject pointing to NULL. It's address is unique, and that's
// enough for us to use it as sentinel value.
PyObject *_sentinel_value = NULL;
PyObject *Nuitka_dunder_compiled_value = NULL;
#ifdef _NUITKA_STANDALONE
extern PyObject *getStandaloneSysExecutablePath(PyObject *basename);
#endif
static void _createGlobalConstants(void) {
// The empty name means global.
loadConstantsBlob(&global_constants[0], "", 69);
#if _NUITKA_EXE
/* Set the "sys.executable" path to the original CPython executable or point to inside the
distribution for standalone. */
PySys_SetObject(
(char *)"executable",
#ifndef _NUITKA_STANDALONE
global_constants[67]
#else
getStandaloneSysExecutablePath(global_constants[67])
#endif
);
#ifndef _NUITKA_STANDALONE
/* Set the "sys.prefix" path to the original one. */
PySys_SetObject(
(char *)"prefix",
global_constants[68]
);
/* Set the "sys.prefix" path to the original one. */
PySys_SetObject(
(char *)"exec_prefix",
global_constants[68]
);
#if PYTHON_VERSION >= 0x300
/* Set the "sys.base_prefix" path to the original one. */
PySys_SetObject(
(char *)"base_prefix",
global_constants[68]
);
/* Set the "sys.exec_base_prefix" path to the original one. */
PySys_SetObject(
(char *)"base_exec_prefix",
global_constants[68]
);
#endif
#endif
#endif
static PyTypeObject Nuitka_VersionInfoType;
// Same fields as "sys.version_info" except no serial number.
static PyStructSequence_Field Nuitka_VersionInfoFields[] = {
{(char *)"major", (char *)"Major release number"},
{(char *)"minor", (char *)"Minor release number"},
{(char *)"micro", (char *)"Micro release number"},
{(char *)"releaselevel", (char *)"'alpha', 'beta', 'candidate', or 'release'"},
{0}
};
static PyStructSequence_Desc Nuitka_VersionInfoDesc = {
(char *)"__nuitka_version__", /* name */
(char *)"__compiled__\\n\\nVersion information as a named tuple.", /* doc */
Nuitka_VersionInfoFields, /* fields */
4
};
PyStructSequence_InitType(&Nuitka_VersionInfoType, &Nuitka_VersionInfoDesc);
Nuitka_dunder_compiled_value = PyStructSequence_New(&Nuitka_VersionInfoType);
assert(Nuitka_dunder_compiled_value != NULL);
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 0, PyInt_FromLong(0));
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 1, PyInt_FromLong(6));
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 2, PyInt_FromLong(11));
PyStructSequence_SET_ITEM(Nuitka_dunder_compiled_value, 3, Nuitka_String_FromString("release"));
// Prevent users from creating the Nuitka version type object.
Nuitka_VersionInfoType.tp_init = NULL;
Nuitka_VersionInfoType.tp_new = NULL;
}
// In debug mode we can check that the constants were not tampered with in any
// given moment. We typically do it at program exit, but we can add extra calls
// for sanity.
#ifndef __NUITKA_NO_ASSERT__
void checkGlobalConstants(void) {
// TODO: Ask constant code to check values.
}
#endif
void createGlobalConstants(void) {
if (_sentinel_value == NULL) {
#if PYTHON_VERSION < 0x300
_sentinel_value = PyCObject_FromVoidPtr(NULL, NULL);
#else
// The NULL value is not allowed for a capsule, so use something else.
_sentinel_value = PyCapsule_New((void *)27, "sentinel", NULL);
#endif
assert(_sentinel_value);
_createGlobalConstants();
}
}
File added
#ifndef __NUITKA_GLOBAL_CONSTANTS_H__
#define __NUITKA_GLOBAL_CONSTANTS_H__
extern PyObject *global_constants[69];
// ()
#define const_tuple_empty global_constants[0]
// {}
#define const_dict_empty global_constants[1]
// 0
#define const_int_0 global_constants[2]
// 1
#define const_int_pos_1 global_constants[3]
// -1
#define const_int_neg_1 global_constants[4]
// 0.0
#define const_float_0_0 global_constants[5]
// -0.0
#define const_float_minus_0_0 global_constants[6]
// 1.0
#define const_float_1_0 global_constants[7]
// -1.0
#define const_float_minus_1_0 global_constants[8]
// ''
#define const_str_empty global_constants[9]
// b''
#define const_bytes_empty global_constants[10]
// '__module__'
#define const_str_plain___module__ global_constants[11]
// '__class__'
#define const_str_plain___class__ global_constants[12]
// '__name__'
#define const_str_plain___name__ global_constants[13]
// '__package__'
#define const_str_plain___package__ global_constants[14]
// '__metaclass__'
#define const_str_plain___metaclass__ global_constants[15]
// '__dict__'
#define const_str_plain___dict__ global_constants[16]
// '__doc__'
#define const_str_plain___doc__ global_constants[17]
// '__file__'
#define const_str_plain___file__ global_constants[18]
// '__path__'
#define const_str_plain___path__ global_constants[19]
// '__enter__'
#define const_str_plain___enter__ global_constants[20]
// '__exit__'
#define const_str_plain___exit__ global_constants[21]
// '__builtins__'
#define const_str_plain___builtins__ global_constants[22]
// '__all__'
#define const_str_plain___all__ global_constants[23]
// '__cmp__'
#define const_str_plain___cmp__ global_constants[24]
// '__iter__'
#define const_str_plain___iter__ global_constants[25]
// '__compiled__'
#define const_str_plain___compiled__ global_constants[26]
// 'inspect'
#define const_str_plain_inspect global_constants[27]
// 'compile'
#define const_str_plain_compile global_constants[28]
// 'range'
#define const_str_plain_range global_constants[29]
// 'open'
#define const_str_plain_open global_constants[30]
// 'sum'
#define const_str_plain_sum global_constants[31]
// 'format'
#define const_str_plain_format global_constants[32]
// '__import__'
#define const_str_plain___import__ global_constants[33]
// 'bytearray'
#define const_str_plain_bytearray global_constants[34]
// 'staticmethod'
#define const_str_plain_staticmethod global_constants[35]
// 'classmethod'
#define const_str_plain_classmethod global_constants[36]
// 'name'
#define const_str_plain_name global_constants[37]
// 'globals'
#define const_str_plain_globals global_constants[38]
// 'locals'
#define const_str_plain_locals global_constants[39]
// 'fromlist'
#define const_str_plain_fromlist global_constants[40]
// 'level'
#define const_str_plain_level global_constants[41]
// 'read'
#define const_str_plain_read global_constants[42]
// 'rb'
#define const_str_plain_rb global_constants[43]
// 'getattr'
#define const_str_plain_getattr global_constants[44]
// '__cached__'
#define const_str_plain___cached__ global_constants[45]
// '__loader__'
#define const_str_plain___loader__ global_constants[46]
// 'print'
#define const_str_plain_print global_constants[47]
// 'end'
#define const_str_plain_end global_constants[48]
// 'file'
#define const_str_plain_file global_constants[49]
// 'bytes'
#define const_str_plain_bytes global_constants[50]
// '.'
#define const_str_dot global_constants[51]
// '__loader__'
#define const_str_plain___loader__ global_constants[46]
// 'send'
#define const_str_plain_send global_constants[52]
// 'throw'
#define const_str_plain_throw global_constants[53]
// 'close'
#define const_str_plain_close global_constants[54]
// 'site'
#define const_str_plain_site global_constants[55]
// 'type'
#define const_str_plain_type global_constants[56]
// 'len'
#define const_str_plain_len global_constants[57]
// 'range'
#define const_str_plain_range global_constants[29]
// 'repr'
#define const_str_plain_repr global_constants[58]
// 'int'
#define const_str_plain_int global_constants[59]
// 'iter'
#define const_str_plain_iter global_constants[60]
// '__spec__'
#define const_str_plain___spec__ global_constants[61]
// '_initializing'
#define const_str_plain__initializing global_constants[62]
// 'parent'
#define const_str_plain_parent global_constants[63]
// 'types'
#define const_str_plain_types global_constants[64]
// '__main__'
#define const_str_plain___main__ global_constants[65]
// '__class_getitem__'
#define const_str_plain___class_getitem__ global_constants[66]
#endif
File added
#define INCBIN_PREFIX
#define INCBIN_STYLE INCBIN_STYLE_SNAKE
#define INCBIN_LOCAL
#include "nuitka/incbin.h"
INCBIN(constant_bin, "__constants.bin");
unsigned char const *getConstantsBlobData() {
return constant_bin_data;
}
File added
This diff is collapsed.
#ifndef __NUITKA_CALLS_H__
#define __NUITKA_CALLS_H__
extern PyObject *CALL_FUNCTION_WITH_ARGS2(PyObject *called, PyObject **args);
extern PyObject *CALL_FUNCTION_WITH_ARGS3(PyObject *called, PyObject **args);
extern PyObject *CALL_FUNCTION_WITH_ARGS4(PyObject *called, PyObject **args);
extern PyObject *CALL_FUNCTION_WITH_ARGS5(PyObject *called, PyObject **args);
#endif
File added
/* Code to register embedded modules for meta path based loading if any. */
#include <Python.h>
#include "nuitka/constants_blob.h"
#include "nuitka/unfreezing.h"
/* Type bool */
#ifndef __cplusplus
#include "stdbool.h"
#endif
#if 0 > 0
static unsigned char *bytecode_data[0];
#else
static unsigned char **bytecode_data = NULL;
#endif
/* Table for lookup to find compiled or bytecode modules included in this
* binary or module, or put along this binary as extension modules. We do
* our own loading for each of these.
*/
extern PyObject *modulecode___main__(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
static struct Nuitka_MetaPathBasedLoaderEntry meta_path_loader_entries[] = {
{"__main__", modulecode___main__, 0, 0, },
{NULL, NULL, 0, 0, 0}
};
void setupMetaPathBasedLoader(void) {
static bool init_done = false;
if (init_done == false) {
loadConstantsBlob((PyObject **)bytecode_data, ".bytecode", 0);
registerMetaPathBasedUnfreezer(meta_path_loader_entries, bytecode_data);
init_done = true;
}
}
// This provides the frozen (compiled bytecode) files that are included if
// any.
// These modules should be loaded as bytecode. They may e.g. have to be loadable
// during "Py_Initialize" already, or for irrelevance, they are only included
// in this un-optimized form. These are not compiled by Nuitka, and therefore
// are not accelerated at all, merely bundled with the binary or module, so
// that CPython library can start out finding them.
struct frozen_desc {
char const *name;
int index;
int size;
};
static struct frozen_desc _frozen_modules[] = {
{NULL, 0, 0}
};
void copyFrozenModulesTo(struct _frozen *destination) {
loadConstantsBlob((PyObject **)bytecode_data, ".bytecode", 0);
struct frozen_desc *current = _frozen_modules;
for(;;) {
destination->name = (char *)current->name;
destination->code = bytecode_data[current->index];
destination->size = current->size;
if (destination->name == NULL) break;
current += 1;
destination += 1;
};
}
File added
#define NO_PYTHON_WARNINGS 0
#define SYSFLAG_BYTES_WARNING 0
#define SYSFLAG_NO_RANDOMIZATION 0
#define SYSFLAG_NO_SITE 0
#define SYSFLAG_OPTIMIZE 0
#define SYSFLAG_UTF8 0
#define SYSFLAG_VERBOSE 0
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment