Skip to content

Commit

Permalink
Merge branch 'master' of github.com:kivy/pyobjus
Browse files Browse the repository at this point in the history
  • Loading branch information
tito committed Nov 20, 2018
2 parents 5a8debc + 20e01ac commit 50ef649
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 17 deletions.
16 changes: 14 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ matrix:
env: RUN=unit PY=3 HOMEBREW_NO_AUTO_UPDATE=1
os: osx

- language: generic
env: RUN=sdist PY=3 HOMEBREW_NO_AUTO_UPDATE=1
os: osx

before_install:
- echo PATH=$PATH;

Expand Down Expand Up @@ -59,8 +63,16 @@ install:

- source env/bin/activate;
- pip install --upgrade cython pytest
- make test_lib

script:
- make test_lib
- make
- NOSE_VERBOSE=3 make tests
- make tests
- if [ "$RUN" == "sdist" ]; then
if [ "$PYOBJUS_DEPLOY" == "1" ]; then
git clean -dxf --exclude=env;
pip install requests[security] twine;
python setup_sdist.py sdist;
python -m twine upload dist/*;
fi;
fi;
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include *LICENSE
recursive-include pyobjus *.pyx *.pxi *.h
1 change: 1 addition & 0 deletions pyobjus/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__version__ = '1.1.0'
from .pyobjus import *
30 changes: 15 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
import subprocess
import platform
from setup_sdist import SETUP_KWARGS

dev_platform = sys.platform
kivy_ios_root = environ.get('KIVYIOSROOT', None)
Expand Down Expand Up @@ -55,18 +56,17 @@
'pyobjus.pyx')]

# create the extension
setup(name='pyobjus',
version='1.0',
cmdclass={'build_ext': build_ext},
packages=['pyobjus', 'pyobjus.consts'],
ext_package='pyobjus',
ext_modules=[
Extension(
'pyobjus', [join('pyobjus', x) for x in files],
depends=depends,
libraries=libraries,
library_dirs=library_dirs,
include_dirs=include_dirs,
extra_link_args=extra_link_args)
]
)
setup(
cmdclass={'build_ext': build_ext},
ext_modules=[
Extension(
'pyobjus', [join('pyobjus', x) for x in files],
depends=depends,
libraries=libraries,
library_dirs=library_dirs,
include_dirs=include_dirs,
extra_link_args=extra_link_args
)
],
**SETUP_KWARGS
)
71 changes: 71 additions & 0 deletions setup_sdist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
'''
Setup.py only for creating a source distributions.
This file holds all the common setup.py keyword arguments between the source
distribution and the ordinary setup.py for binary distribution. Running this
instead of the default setup.py will create a GitHub-like archive with setup.py
meant for installing via pip.
'''

# pylint: disable=import-error,no-name-in-module
from distutils.core import setup
from os import walk
from os.path import join, dirname


with open(join('pyobjus', '__init__.py')) as fd:
VERSION = [
x for x in fd.readlines()
if x.startswith('__version__')
][0].split("'")[-2]

data_allowed_ext = (
'readme', 'py', 'wav', 'png', 'jpg', 'svg', 'json', 'avi', 'gif', 'txt',
'ttf', 'obj', 'mtl', 'kv', 'mpg', 'glsl', 'zip', 'h', 'm'
)

def tree(source, allowed_ext=data_allowed_ext, tree_name='share/pyobjus-'):
found = {}

for root, subfolders, files in walk(source):
for fn in files:
ext = fn.split('.')[-1].lower()
if ext not in allowed_ext:
continue
filename = join(root, fn)
directory = '%s%s' % (tree_name, dirname(filename))
if directory not in found:
found[directory] = []
found[directory].append(filename)
return found

SETUP_KWARGS = {
'name': 'pyobjus',
'version': VERSION,
'packages': ['pyobjus', 'pyobjus.consts'],
'py_modules': ['setup'],
'ext_package': 'pyobjus',
'data_files': [
item
for data in [
list(tree('examples').items()),
list(tree('objc_classes', tree_name='objc_classes/').items())
]
for item in data
],
'classifiers': [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: MacOS',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries :: Application Frameworks'
]
}

if __name__ == '__main__':
setup(**SETUP_KWARGS)

0 comments on commit 50ef649

Please sign in to comment.