summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2012-07-28 18:46:52 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2012-07-28 18:46:52 (GMT)
commit96d97ec9c08a95201e9d7f0b7819ca6328002693 (patch)
tree2aec50fcefb564593ad7ea30a51330a39e26281c /Modules
parent79b7ea1629243868b6971953e15dfb499d14c022 (diff)
downloadcpython-96d97ec9c08a95201e9d7f0b7819ca6328002693.zip
cpython-96d97ec9c08a95201e9d7f0b7819ca6328002693.tar.gz
cpython-96d97ec9c08a95201e9d7f0b7819ca6328002693.tar.bz2
Issue #15431: Add _freeze_importlib project to regenerate importlib.h on Windows.
Patch by Kristján Valur Jónsson.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_freeze_importlib.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/_freeze_importlib.c b/Modules/_freeze_importlib.c
index 0900d37..a96e76e 100644
--- a/Modules/_freeze_importlib.c
+++ b/Modules/_freeze_importlib.c
@@ -8,7 +8,9 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
+#ifndef MS_WINDOWS
#include <unistd.h>
+#endif
/* To avoid a circular dependency on frozen.o, we create our own structure
@@ -19,9 +21,6 @@ static struct _frozen _PyImport_FrozenModules[] = {
{0, 0, 0} /* sentinel */
};
-struct _frozen *PyImport_FrozenModules = _PyImport_FrozenModules;
-
-
const char header[] = "/* Auto-generated by Modules/_freeze_importlib.c */";
int
@@ -35,6 +34,8 @@ main(int argc, char *argv[])
unsigned char *data;
PyObject *code, *marshalled;
+ PyImport_FrozenModules = _PyImport_FrozenModules;
+
if (argc != 3) {
fprintf(stderr, "need to specify input and output paths\n");
return 2;
@@ -89,7 +90,9 @@ main(int argc, char *argv[])
data = (unsigned char *) PyBytes_AS_STRING(marshalled);
data_size = PyBytes_GET_SIZE(marshalled);
- outfile = fopen(outpath, "wb");
+ /* Open the file in text mode. The hg checkout should be using the eol extension,
+ which in turn should cause the existing file to use CRLF */
+ outfile = fopen(outpath, "wt");
if (outfile == NULL) {
fprintf(stderr, "cannot open '%s' for writing\n", outpath);
return 1;