Skip to content

Instantly share code, notes, and snippets.

@redj
Last active May 25, 2018 00:06
Show Gist options
  • Save redj/43e0585997fa39b9cc1775a550456b04 to your computer and use it in GitHub Desktop.
Save redj/43e0585997fa39b9cc1775a550456b04 to your computer and use it in GitHub Desktop.
from pyeC import Bool, Instance, String, Module, *
from pyecere import *
from pyEDA import *
directory structure
\setup.py
\bindings\py\EcereSDK\__init__.py
\bindings\py\EcereSDK\pyeC.py
\bindings\py\EcereSDK\pyecere.py
\bindings\py\EcereSDK\pyEDA.py
and *all* the directory structure of the Ecere SDK (https://github.com/ecere/ecere-sdk) repository.
I'm trying to create a light package with only the python files and the wheels for the underlying sdk.
see output of python setup.py sdist bdist_wheel command:
https://gist.github.com/redj/add3dfef226b4049d3c2ad23dfbb5e88
exclude *.3ds
global-exclude *.3ds
"""The setuptools based Ecere SDK setup module."""
from setuptools import Command
from setuptools import find_packages
from setuptools import setup
from setuptools.command.install import install
from codecs import open
from os import path
import os
import subprocess
import sys
import bindings.py.build_eC
import distutils.command.build
dir = path.abspath(path.dirname(__file__))
sys.path.insert(0, dir)
#dddd = path.join(here, 'bindings/py')
#version_from_git = subprocess.check_output(['git', 'describe', '--tags', '--abbrev=0']).rstrip().decode('u8')
version_from_git = '0.44.15'
with open(path.join(dir, 'README.md'), encoding='u8') as f:
long_description = f.read()
class BuildCommand(distutils.command.build.build):
"""Customized setuptools build command."""
def run(self):
proc = subprocess.Popen(['make', '-j8'], shell=False)
proc.communicate()
if proc.returncode == 0:
proc = subprocess.Popen(['make', 'prepinstall'], shell=False)
proc.communicate()
if proc.returncode == 0:
owd = os.getcwd()
os.chdir(os.path.join(dir, 'bindings'))
proc = subprocess.Popen(['make', 'py'], shell=False)
proc.communicate()
if proc.returncode == 0:
os.chdir(owd)
distutils.command.build.build.run(self)
else: os.chdir(owd)
#class BuildCommand(Command):
# user_options = []
# def initialize_options(self):
# """Abstract method that is required to be overwritten"""
# def finalize_options(self):
# """Abstract method that is required to be overwritten"""
# def run(self):
# print(" => bootstrapping development environment ...")
# proc = subprocess.Popen(['make', '-j8'], shell=False)
# proc.communicate()
#class BuildPyCommand(setuptools.command.build_py.build_py):
# """Custom build command."""
# def run(self):
# self.run_command('make -j8')
# setuptools.command.build_py.build_py.run(self)
class CustomInstallCommand(install):
"""Customized setuptools install command."""
def run(self):
proc = subprocess.Popen(['make', 'ECERE_AUDIO=y', 'ENABLE_SSL=y', 'EDASQLiteCipher=y', '-j8'], shell=False)
proc.communicate()
if proc.returncode == 0:
install.run(self)
#class TestConsole(TestCase):
# def test_basic(self):
# main()
# platform specific:
objdir = 'obj/win32/bin'
libext = '.dll'
exeext = '.exe'
setup(
name='EcereSDK',
version=version_from_git + '.dev1',
description='The Ecere Software Development Kit (SDK)',
long_description=long_description,
url='https://ecere.org',
author='Jérôme Jacovella-St-Louis, Ecere Corporation',
author_email='jerome@ecere.com',
license='BSD 3-Clause (Revised)',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
#'Environment :: Console :: Curses',
#'Environment :: Console :: Framebuffer',
'Environment :: Handhelds/PDA\'s',
'Environment :: MacOS X',
'Environment :: No Input/Output (Daemon)',
'Environment :: Web Environment',
'Environment :: Win32 (MS Windows)',
'Environment :: X11 Applications',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: Android',
#'Operating System :: BeOS',
#'Operating System :: iOS',
#'Operating System :: MacOS',
#'Operating System :: MacOS :: MacOS 9',
'Operating System :: MacOS :: MacOS X',
#'Operating System :: Microsoft',
#'Operating System :: Microsoft :: MS-DOS',
#'Operating System :: Microsoft :: Windows',
'Operating System :: Microsoft :: Windows :: Windows 10',
#'Operating System :: Microsoft :: Windows :: Windows 3.1 or Earlier',
'Operating System :: Microsoft :: Windows :: Windows 7',
'Operating System :: Microsoft :: Windows :: Windows 8',
'Operating System :: Microsoft :: Windows :: Windows 8.1',
#'Operating System :: Microsoft :: Windows :: Windows 95/98/2000',
#'Operating System :: Microsoft :: Windows :: Windows CE',
#'Operating System :: Microsoft :: Windows :: Windows NT/2000',
'Operating System :: Microsoft :: Windows :: Windows Server 2003',
'Operating System :: Microsoft :: Windows :: Windows Server 2008',
#'Operating System :: Microsoft :: Windows :: Windows Vista',
#'Operating System :: Microsoft :: Windows :: Windows XP',
#'Operating System :: OS/2',
#'Operating System :: OS Independent',
#'Operating System :: Other OS',
#'Operating System :: PalmOS',
#'Operating System :: PDA Systems',
#'Operating System :: POSIX',
#'Operating System :: POSIX :: AIX',
'Operating System :: POSIX :: BSD',
#'Operating System :: POSIX :: BSD :: BSD/OS',
#'Operating System :: POSIX :: BSD :: FreeBSD',
#'Operating System :: POSIX :: BSD :: NetBSD',
#'Operating System :: POSIX :: BSD :: OpenBSD',
#'Operating System :: POSIX :: GNU Hurd',
#'Operating System :: POSIX :: HP-UX',
#'Operating System :: POSIX :: IRIX',
'Operating System :: POSIX :: Linux',
#'Operating System :: POSIX :: Other',
#'Operating System :: POSIX :: SCO',
#'Operating System :: POSIX :: SunOS/Solaris',
#'Operating System :: Unix',
'Programming Language :: C',
#'Programming Language :: eC',
#'Programming Language :: Python :: 2',
#'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3',
'Topic :: Software Development',
'Topic :: Software Development :: User Interfaces',
],
keywords='cross-platform gui 2D 3D development',
#packages=['eceresdk'],
packages=find_packages(where='bindings/py'),
package_dir={'':'bindings/py'},
#cmdclass={'install': CustomInstallCommand},
cmdclass={
#'pylint': PylintCommand,
#'build_py': BuildPyCommand,
#'build_py': BuildPyCommand,
'build': BuildCommand,
},
# include everything in source control
#include_package_data=True,
# ...but exclude README.txt from all packages
exclude_package_data={'': ['.gitattributes', '.gitignore', '.mailmap', '.travis.yml', '*.3ds', '*.3DS', 'samples']},
#setup_requires=['setuptools_git >= 0.3', 'cffi >= 1.0.0'],
setup_requires=['cffi >= 1.0.0'],
cffi_modules=['bindings/py/build_eC.py:ffi_eC', 'bindings/py/build_ecere.py:ffi_ecere'],
install_requires=['cffi >= 1.0.0'],
#extras_require={
# 'dev': ['check-manifest'],
# 'test': ['coverage'],
#},
package_data={
# 'sample': ['package_data.dat'],
},
data_files=[
('bin', [
os.path.join(objdir, 'ecereCOM' + libext),
os.path.join(objdir, 'ecereCOM_c' + libext),
os.path.join(objdir, 'ecere' + libext),
os.path.join(objdir, 'ecere_c' + libext),
os.path.join(objdir, 'ec' + libext),
os.path.join(objdir, 'ec2' + libext),
os.path.join(objdir, 'EcereAudio' + libext),
os.path.join(objdir, 'EDA' + libext),
os.path.join(objdir, 'EDA_c' + libext),
os.path.join(objdir, 'EDASQLite' + libext),
#os.path.join(objdir, 'EDASQLiteCipher' + libext),
os.path.join(objdir, 'ecp' + exeext),
os.path.join(objdir, 'ecc' + exeext),
os.path.join(objdir, 'ecs' + exeext),
os.path.join(objdir, 'ear' + exeext),
os.path.join(objdir, 'epj2make' + exeext),
os.path.join(objdir, 'bgen' + exeext),
os.path.join(objdir, 'documentor' + exeext),
os.path.join(objdir, 'ecere-ide' + exeext),
])
],
entry_points={
'console_scripts': [
#'build_eC=build_eC:compile_eC',
'sample=sample:main',
],
},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment