Added a python project skeleton

The provided app is identical to the C skeleton (just a window and a label)

Is still a bit minimal, but all the basic functions are implemented:
./setup.py check
./setup.py build
./setup.py run
./setup.py install / uninstall
./setup.py clean --all

Later I will extend the skeleton to support:
* gettext translations
* FDO stuff installation (.desktop and icons)
* Edje theme building
This commit is contained in:
Davide Andreoli 2017-05-29 21:37:37 +02:00
parent 06954e00ef
commit 2fb3280d07
7 changed files with 145 additions and 1 deletions

View File

@ -1,9 +1,14 @@
MAINTAINERCLEANFILES = Makefile.in
skeletondir = $(datadir)/$(PACKAGE)/skeleton
skeleton_DATA = eflproject.tar.gz
skeleton_DATA = \
eflproject.tar.gz \
eflproject_python.tar.gz
eflproject.tar.gz:
tar zcvf eflproject.tar.gz -C $(srcdir) eflproject
eflproject_python.tar.gz:
tar zcvf eflproject_python.tar.gz -C $(srcdir) eflproject_python
EXTRA_DIST = $(skeleton_DATA)

View File

@ -0,0 +1,29 @@
Copyright (C) ${Edi_Year} ${Edi_User} <${Edi_Email}>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1 @@
README

View File

@ -0,0 +1,6 @@
#!/usr/bin/env python
import sys
from ${Edi_Name}.main import main
sys.exit(main())

View File

@ -0,0 +1,70 @@
#!/usr/bin/env python
# encoding: utf-8
# python setup.py check
# python setup.py build
# python setup.py run
# python setup.py install
# python setup.py clean --all
from distutils.core import setup, Command
from distutils.version import StrictVersion
from efl.utils.setup import build_extra, build_edc, build_fdo, build_i18n, uninstall
from efl import __version__ as efl_version
MIN_EFL = '1.18'
if StrictVersion(efl_version) < MIN_EFL:
print('Your python-efl version is too old! Found: ' + efl_version)
print('You need at least version ' + MIN_EFL)
exit(1)
class run_in_tree(Command):
description = 'Run the main() from the build folder (without install)'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import sys, platform
sys.path.insert(0, 'build/lib.%s-%s-%d.%d' % (
platform.system().lower(), platform.machine(),
sys.version_info[0], sys.version_info[1]))
from ${Edi_Name}.main import main
sys.exit(main())
setup(
name = '${Edi_Name}',
version = '0.0.1',
description = 'Short description',
long_description = 'A longer description of your project',
author = '${Edi_User}',
author_email = '${Edi_Email}',
url = '${Edi_Url}',
license = "GNU GPL",
package_dir = {'${Edi_Name}': 'src'},
packages = ['${Edi_Name}'],
requires = ['efl'],
scripts = ['bin/${Edi_Name}'],
cmdclass = {
'build': build_extra,
# 'build_edc': build_edc,
# 'build_fdo': build_fdo,
# 'build_i18n': build_i18n,
'run': run_in_tree,
'uninstall': uninstall,
},
command_options = {
'install': {'record': ('setup.py', 'installed_files.txt')}
},
)

View File

@ -0,0 +1,33 @@
#!/usr/bin/env python
# encoding: utf-8
from __future__ import absolute_import, print_function, division
import sys
from efl import elementary as elm
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL, EXPAND_BOTH, FILL_BOTH
def main():
# make the application quit when the last window is closed
elm.policy_set(elm.ELM_POLICY_QUIT, elm.ELM_POLICY_QUIT_LAST_WINDOW_CLOSED)
# Create the main app window
win = elm.StandardWindow("main", "My first window",
autodel=True, size=(300, 200))
# Create a simple label
label = elm.Label(win, text="Hello World Python !",
size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
win.resize_object_add(label)
label.show()
# Show the window and start the efl main loop
win.show()
elm.run()
if __name__ == "main":
sys.exit(main())