This commit is contained in:
Matthias Koefferlein 2018-07-29 01:59:50 +02:00
commit 76db5d1714
7 changed files with 134 additions and 41 deletions

View File

@ -1,19 +1,77 @@
matrix: matrix:
include: include:
- os: osx - os: linux
osx_image: xcode9.3beta dist: trusty # Ubuntu 14.04
env: sudo: false
- MATRIX_EVAL="" language: python
python: '2.6'
env:
- MATRIX_EVAL=""
- os: linux
dist: trusty # Ubuntu 14.04
sudo: false
language: python
python: '2.7'
env:
- MATRIX_EVAL=""
- os: linux
dist: trusty # Ubuntu 14.04
sudo: false
language: python
python: '3.3'
env:
- MATRIX_EVAL=""
- os: linux
dist: trusty # Ubuntu 14.04
sudo: false
language: python
python: '3.4'
env:
- MATRIX_EVAL=""
- os: linux
dist: trusty # Ubuntu 14.04
sudo: false
language: python
python: '3.5'
env:
- MATRIX_EVAL=""
- os: linux
dist: trusty # Ubuntu 14.04
sudo: false
language: python
python: '3.6'
env:
- MATRIX_EVAL=""
- os: osx
osx_image: xcode9.3 # macOS 10.13
env:
- MATRIX_EVAL=""
- os: osx
osx_image: xcode8.3 # macOS 10.12
env:
- MATRIX_EVAL=""
- os: osx
osx_image: xcode8 # macOS 10.11
env:
- MATRIX_EVAL=""
before_install: before_install:
- eval "${MATRIX_EVAL}"
- brew update
- brew bundle
- env - env
- rvm install ruby --latest
- gem install dropbox-deployment
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew bundle; shopt -s expand_aliases; alias python='python3'; fi
- eval "${MATRIX_EVAL}"
- python -c "import distutils.sysconfig as sysconfig; print(sysconfig.__file__)"
install: install:
- python3 setup.py install - python setup.py build
- python setup.py bdist_wheel
- python setup.py install
script: script:
- python3 -c 'import klayout.db as db; print(dir(db))' - python -c 'import klayout.db as db; print(dir(db))'
- python3 -c 'import klayout.rdb as rdb; print(dir(rdb))' - python -c 'import klayout.rdb as rdb; print(dir(rdb))'
- python3 -c 'import klayout.tl as tl; print(dir(tl))' - python -c 'import klayout.tl as tl; print(dir(tl))'
after_success:
- dropbox-deployment

4
dropbox-deployment.yml Normal file
View File

@ -0,0 +1,4 @@
deploy:
dropbox_path: /Builds/klayout-pymod # The path to the folder on Dropbox where the files will go
artifacts_path: dist # can be a single file, or a path
debug: true # if you want to see more logs

View File

@ -58,7 +58,7 @@ from setuptools import setup, Extension, Distribution
import glob import glob
import os import os
import platform import platform
import sysconfig import distutils.sysconfig as sysconfig
# ---------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------
@ -78,6 +78,9 @@ class Config(object):
self.build_platlib = build_cmd.build_platlib self.build_platlib = build_cmd.build_platlib
self.ext_suffix = sysconfig.get_config_var("EXT_SUFFIX") self.ext_suffix = sysconfig.get_config_var("EXT_SUFFIX")
if self.ext_suffix is None:
self.ext_suffix = ".so"
self.root = "klayout" self.root = "klayout"
def libname_of(self, mod): def libname_of(self, mod):

View File

@ -26,6 +26,7 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h>
#if defined(_WIN32) #if defined(_WIN32)
# include <windows.h> # include <windows.h>

View File

@ -23,12 +23,12 @@
#if !defined(HAVE_QT) #if !defined(HAVE_QT)
#include "tlThreads.h" #include "tlThreads.h"
#include "tlUtils.h"
#include "tlLog.h" #include "tlLog.h"
#include "tlInternational.h" #include "tlInternational.h"
#include <map> #include <map>
#include <pthread.h> #include <pthread.h>
#include <time.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#if defined(_WIN32) #if defined(_WIN32)
@ -82,7 +82,7 @@ public:
if (time < std::numeric_limits<unsigned long>::max ()) { if (time < std::numeric_limits<unsigned long>::max ()) {
struct timespec end_time; struct timespec end_time;
clock_gettime (CLOCK_REALTIME, &end_time); current_utc_time (&end_time);
end_time.tv_sec += (time / 1000); end_time.tv_sec += (time / 1000);
end_time.tv_nsec += (time % 1000) * 1000000; end_time.tv_nsec += (time % 1000) * 1000000;
@ -270,7 +270,7 @@ bool Thread::wait (unsigned long time)
if (time < std::numeric_limits<unsigned long>::max ()) { if (time < std::numeric_limits<unsigned long>::max ()) {
struct timespec end_time; struct timespec end_time;
clock_gettime (CLOCK_REALTIME, &end_time); current_utc_time (&end_time);
end_time.tv_sec += (time / 1000); end_time.tv_sec += (time / 1000);
end_time.tv_nsec += (time % 1000) * 1000000; end_time.tv_nsec += (time % 1000) * 1000000;
@ -285,7 +285,7 @@ bool Thread::wait (unsigned long time)
while (isRunning ()) { while (isRunning ()) {
struct timespec current_time; struct timespec current_time;
clock_gettime (CLOCK_REALTIME, &current_time); current_utc_time (&current_time);
if (end_time.tv_sec < current_time.tv_sec || (end_time.tv_sec == current_time.tv_sec && end_time.tv_nsec < current_time.tv_nsec)) { if (end_time.tv_sec < current_time.tv_sec || (end_time.tv_sec == current_time.tv_sec && end_time.tv_nsec < current_time.tv_nsec)) {
return false; return false;
} }

View File

@ -22,6 +22,7 @@
#include "tlTimer.h" #include "tlTimer.h"
#include "tlUtils.h"
#include "tlLog.h" #include "tlLog.h"
#include "tlString.h" #include "tlString.h"
@ -30,7 +31,6 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <time.h>
#ifndef _MSC_VER // not available on MS VC++ #ifndef _MSC_VER // not available on MS VC++
# include <unistd.h> # include <unistd.h>
@ -45,7 +45,7 @@ namespace tl
static int64_t ms_time () static int64_t ms_time ()
{ {
struct timespec spec; struct timespec spec;
clock_gettime (CLOCK_REALTIME, &spec); current_utc_time (&spec);
return int64_t (spec.tv_sec) * 1000 + int64_t (0.5 + spec.tv_nsec / 1.0e6); return int64_t (spec.tv_sec) * 1000 + int64_t (0.5 + spec.tv_nsec / 1.0e6);
} }
@ -77,7 +77,7 @@ Timer::start ()
#endif #endif
struct timespec spec; struct timespec spec;
clock_gettime (CLOCK_REALTIME, &spec); current_utc_time (&spec);
m_wall_ms += ms_time (); m_wall_ms += ms_time ();
} }

View File

@ -27,10 +27,37 @@
#include "tlAssert.h" #include "tlAssert.h"
#include <map> #include <map>
#include <time.h>
#if defined(__MACH__)
#include <mach/clock.h>
#include <mach/mach.h>
#endif
namespace tl namespace tl
{ {
/**
* @brief clock_gettime is not implemented in Mac OS X 10.11 and lower
* From: https://gist.githubusercontent.com/jbenet/1087739/raw/638b37f76cdd9dc46d617443cab27eac297e2ee3/current_utc_time.c
*/
inline void current_utc_time(struct timespec *ts) {
#if defined(__MACH__)
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
ts->tv_sec = mts.tv_sec;
ts->tv_nsec = mts.tv_nsec;
#else
clock_gettime(CLOCK_REALTIME, ts);
#endif
}
/** /**
* @brief A template class mapping a begin .. end iterator pair to the at_end semantics * @brief A template class mapping a begin .. end iterator pair to the at_end semantics
*/ */