Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] setup.py fixes for Windows #37

Merged
merged 3 commits into from
Mar 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python/brotlimodule.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#define PY_SSIZE_T_CLEAN 1
#include <Python.h>
#include <bytesobject.h>
#include "enc/encode.h"
#include "dec/decode.h"
#include "../enc/encode.h"
#include "../dec/decode.h"

#if PY_MAJOR_VERSION >= 3
#define PyInt_Check PyLong_Check
Expand Down
1 change: 0 additions & 1 deletion python/dec

This file was deleted.

1 change: 0 additions & 1 deletion python/enc

This file was deleted.

94 changes: 49 additions & 45 deletions python/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from distutils.core import setup, Extension
from distutils.command.build_ext import build_ext
import platform
from os.path import abspath

class BuildExt(build_ext):
def get_source_files(self):
Expand All @@ -21,8 +22,11 @@ def build_extension(self, ext):

objects = []
for lang, sources in (("c", c_sources), ("c++", cxx_sources)):
if lang == "c++":
extra_args.append("-std=c++0x")
if lang == "c++":
if self.compiler.compiler_type in ["unix", "cygwin", "mingw32"]:
extra_args.append("-std=c++0x")
elif self.compiler.compiler_type == "msvc":
extra_args.append("/EHsc")

macros = ext.define_macros[:]
if platform.system() == "Darwin":
Expand Down Expand Up @@ -62,51 +66,51 @@ def build_extension(self, ext):
brotli = Extension("brotli",
sources=[
"brotlimodule.cc",
"enc/backward_references.cc",
"enc/block_splitter.cc",
"enc/brotli_bit_stream.cc",
"enc/encode.cc",
"enc/entropy_encode.cc",
"enc/histogram.cc",
"enc/literal_cost.cc",
"dec/bit_reader.c",
"dec/decode.c",
"dec/huffman.c",
"dec/safe_malloc.c",
"dec/streams.c",
abspath("../enc/backward_references.cc"),
abspath("../enc/block_splitter.cc"),
abspath("../enc/brotli_bit_stream.cc"),
abspath("../enc/encode.cc"),
abspath("../enc/entropy_encode.cc"),
abspath("../enc/histogram.cc"),
abspath("../enc/literal_cost.cc"),
abspath("../dec/bit_reader.c"),
abspath("../dec/decode.c"),
abspath("../dec/huffman.c"),
abspath("../dec/safe_malloc.c"),
abspath("../dec/streams.c"),
],
depends=[
"enc/backward_references.h",
"enc/bit_cost.h",
"enc/block_splitter.h",
"enc/brotli_bit_stream.h",
"enc/cluster.h",
"enc/command.h",
"enc/context.h",
"enc/dictionary.h",
"enc/encode.h",
"enc/entropy_encode.h",
"enc/fast_log.h",
"enc/find_match_length.h",
"enc/hash.h",
"enc/histogram.h",
"enc/literal_cost.h",
"enc/port.h",
"enc/prefix.h",
"enc/ringbuffer.h",
"enc/static_dict.h",
"enc/transform.h",
"enc/write_bits.h",
"dec/bit_reader.h",
"dec/context.h",
"dec/decode.h",
"dec/dictionary.h",
"dec/huffman.h",
"dec/prefix.h",
"dec/safe_malloc.h",
"dec/streams.h",
"dec/transform.h",
"dec/types.h",
abspath("../enc/backward_references.h"),
abspath("../enc/bit_cost.h"),
abspath("../enc/block_splitter.h"),
abspath("../enc/brotli_bit_stream.h"),
abspath("../enc/cluster.h"),
abspath("../enc/command.h"),
abspath("../enc/context.h"),
abspath("../enc/dictionary.h"),
abspath("../enc/encode.h"),
abspath("../enc/entropy_encode.h"),
abspath("../enc/fast_log.h"),
abspath("../enc/find_match_length.h"),
abspath("../enc/hash.h"),
abspath("../enc/histogram.h"),
abspath("../enc/literal_cost.h"),
abspath("../enc/port.h"),
abspath("../enc/prefix.h"),
abspath("../enc/ringbuffer.h"),
abspath("../enc/static_dict.h"),
abspath("../enc/transform.h"),
abspath("../enc/write_bits.h"),
abspath("../dec/bit_reader.h"),
abspath("../dec/context.h"),
abspath("../dec/decode.h"),
abspath("../dec/dictionary.h"),
abspath("../dec/huffman.h"),
abspath("../dec/prefix.h"),
abspath("../dec/safe_malloc.h"),
abspath("../dec/streams.h"),
abspath("../dec/transform.h"),
abspath("../dec/types.h"),
],
language="c++",
)
Expand Down