Skip to content

Commit

Permalink
Use '-std=c++11', make extern C, bind GCC to g++ on Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
AjayP13 committed Nov 16, 2018
1 parent 9c5cd19 commit 71c49e3
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ MANIFEST
/.eggs/

# Third Party Folders
/supersqlite/third_party/sqlite3/sqlite3.h
/supersqlite/third_party/sqlite3/sqlite3.c
/supersqlite/third_party/sqlite3/icu.cpp
/supersqlite/third_party/_pysqlite/sqlite3.h
Expand Down
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ script:
- /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- brew install gcc@8 --without-multilib
- export CI_CC="/usr/local/Cellar/gcc/8.2.0/bin/gcc-8 -static-libgcc"
- export GPP_LOC=$(which g++)
- which g++
- mv $GPP_LOC $GPP_LOC.bak
- ls -alh $GPP_LOC || true
- ln -s /usr/local/Cellar/gcc/8.2.0/bin/g++-8 $GPP_LOC
- ls -alh $GPP_LOC || true
- which g++
- $PIP install pip setuptools -U
- $PIP install cibuildwheel==0.10.0
- eval "buildwheel() { cibuildwheel --output-dir wheelhouse >>buildwheel.log 2>&1; }"
Expand Down
28 changes: 25 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ def get_modules(THIRD_PARTY, INTERNAL, PROJ_PATH,
link_args.append('-L' + ICU)
SO_PREFIX = PACKAGE_NAME + '.third_party.sqlite3.'

SQLITE_H_PRE = os.path.relpath(
os.path.join(SQLITE3, 'sqlite3.h.pre.h'), PROJ_PATH)
SQLITE_H_POST = os.path.relpath(
os.path.join(SQLITE3, 'sqlite3.h'), PROJ_PATH)
SQLITE_PRE = os.path.relpath(
os.path.join(SQLITE3, 'sqlite3.c.pre.c'), PROJ_PATH)
SQLITE_POST = os.path.relpath(
Expand Down Expand Up @@ -153,9 +157,27 @@ def get_modules(THIRD_PARTY, INTERNAL, PROJ_PATH,
udata_setCommonData((const void*)"", &_PLASTICITY_SUPERSQLITE_SET_COMMON_DATA_STATUS);
return (int) _PLASTICITY_SUPERSQLITE_SET_COMMON_DATA_STATUS;
}
# endif
''')
with open(SQLITE_H_POST, 'w+') as outfile:
with open(SQLITE_H_PRE, 'r') as infile:
for line in infile:
outfile.write(line)
outfile.write(
'''
# ifndef PLASTICITY_SUPERSQLITE_SQLITE3_H
# define PLASTICITY_SUPERSQLITE_SQLITE3_H 1
#ifdef __cplusplus
extern "C" {
#endif
int _supersqlite_load_icu_data(void);
#ifdef __cplusplus
}
#endif
# endif
''')
with open(SQLITE_POST, 'w+') as outfile:
outfile.write('#define U_DISABLE_RENAMING 1' + '\n')
outfile.write('#define SQLITE_ENABLE_DBPAGE_VTAB 1' + '\n')
Expand Down Expand Up @@ -287,7 +309,7 @@ def sqlite_extension(ext, skip=[], module=None):
[pyinit_source]),
include_dirs=includes,
library_dirs=libraries,
extra_compile_args=["-O4"],
extra_compile_args=compile_args,
extra_link_args=link_args)

def sqlite_misc_extensions(skip=[], zlib=[], windirent=[]):
Expand Down Expand Up @@ -319,7 +341,7 @@ def sqlite_misc_extensions(skip=[], zlib=[], windirent=[]):
include_dirs=includes,
library_dirs=libraries,
libraries=libs,
extra_compile_args=["-O4"],
extra_compile_args=compile_args,
extra_link_args=link_args))
return miscs

Expand Down
2 changes: 1 addition & 1 deletion supersqlite/third_party/HOWTOUPGRADE.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ There are a few components that need updating when updating the version of `sqli

2. **Update `pysqlite`:** If the SQLite3 API has changed, `pysqlite` may be able to provide Python bindings for those new API functions. Replace the `third_party/_pysqlite` folder with the latest version. Some small changes are made to `third_party/_pysqlite/setup.py` all of which are commented with `# PLASTICITY`. The packaging source code (`setup.py`, `MANIFEST.in`) can be found on [GitHub](https://github.com/ghaering/pysqlite). The core source code for `_pysqlite` is taken from `python2`'s [internal modules](https://github.com/python/cpython/tree/ca079a3ea30098aff3197c559a0e32d42dda6d84/Modules/_sqlite) and `python3`'s [internal modules](https://github.com/python/cpython/tree/master/Modules/_sqlite) and placed under `third_party/_pysqlite/src2/` and `third_party/_pysqlite/src3/` respectively.

3. **Update SQLite3:** Download the latest SQLite Amalgamation package from the [SQLite website](https://www.sqlite.org/download.html). Update `third_party/sqlite3/sqlite3.c.pre.c` (with `sqlite3.c`) and update `third_party/sqlite3/sqlite3.h`, `third_party/sqlite3/sqlite3_ext.h`, and `third_party/sqlite3/shell.c` from the SQLite Amalgamation package.
3. **Update SQLite3:** Download the latest SQLite Amalgamation package from the [SQLite website](https://www.sqlite.org/download.html). Update `third_party/sqlite3/sqlite3.c.pre.c` (with `sqlite3.c`) and update `third_party/sqlite3/sqlite3.h.pre.h` (with `sqlite3.h`), `third_party/sqlite3/sqlite3_ext.h`, and `third_party/sqlite3/shell.c` from the SQLite Amalgamation package.

3. **Update SQLite3 Extensions:** Download the latest SQLite source code package from the [SQLite website](https://www.sqlite.org/download.html). Update the `third_party/sqlite3/ext` with the `ext` folder from the SQLite source code package. Also copy all of the files from the `src` folder to `third_party/sqlite3/raw`. Also copy `opcodes.c` and `opcodes.h` to `third_party/sqlite3/raw`.

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version_info__ = ('0', '0', '67')
__version_info__ = ('0', '0', '68')
__version__ = '.'.join(__version_info__)

0 comments on commit 71c49e3

Please sign in to comment.