-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Garden requirements #41
Changes from 6 commits
0970738
0bec489
dd7a2fd
61e5349
f05587e
f7783a0
22c0ee1
81619b0
19845cb
df02289
3e6ee48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,9 @@ def prepare_for_build(self): | |
self.info('Check application requirements') | ||
self.check_application_requirements() | ||
|
||
self.info('Check garden requirements') | ||
self.check_garden_requirements() | ||
|
||
self.info('Compile platform') | ||
self.target.compile_platform() | ||
|
||
|
@@ -386,6 +389,40 @@ def _install_application_requirement(self, module): | |
env=self.env_venv, | ||
cwd=self.buildozer_dir) | ||
|
||
def check_garden_requirements(self): | ||
'''Ensure required garden packages are available to be included. | ||
''' | ||
garden_requirements = self.config.getlist('app', | ||
'garden_requirements', '') | ||
|
||
# have we installed the garden packages? | ||
if exists(self.gardenlibs_dir) and \ | ||
self.state.get('cache.gardenlibs', '') == garden_requirements: | ||
self.debug('Garden requirements already installed, pass') | ||
return | ||
|
||
self._ensure_virtualenv() | ||
self.cmd('pip-2.7 install -e git+git@github.com:Ian-Foote/kivy_garden.git#egg=garden', | ||
env=self.env_venv, | ||
) | ||
|
||
# recreate gardenlibs | ||
self.rmdir(self.gardenlibs_dir) | ||
self.mkdir(self.gardenlibs_dir) | ||
|
||
for requirement in garden_requirements: | ||
self._install_garden_package(requirement) | ||
|
||
# save gardenlibs state | ||
self.state['cache.gardenlibs'] = garden_requirements | ||
|
||
def _install_garden_package(self, package): | ||
self._ensure_virtualenv() | ||
self.debug('Install garden package {} in buildozer_dir'.format(package)) | ||
self.cmd('garden install --app {}'.format(package), | ||
env=self.env_venv, | ||
cwd=self.buildozer_dir) | ||
|
||
def _ensure_virtualenv(self): | ||
if hasattr(self, 'venv'): | ||
return | ||
|
@@ -529,6 +566,7 @@ def get_version(self): | |
def build_application(self): | ||
self._copy_application_sources() | ||
self._copy_application_libs() | ||
self._copy_garden_libs() | ||
self._add_sitecustomize() | ||
|
||
def _copy_application_sources(self): | ||
|
@@ -617,6 +655,9 @@ def _copy_application_libs(self): | |
# copy also the libs | ||
copytree(self.applibs_dir, join(self.app_dir, '_applibs')) | ||
|
||
def _copy_garden_libs(self): | ||
copytree(self.gardenlibs_dir, join(self.app_dir, 'libs')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be better to make the appropriate changes to let the garden packages in _applibs instead of libs. If you are afraid about the conflict with standard lib, then let's do _applibs/garden and _applibs/system. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I'll look into it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As we discussed in irc, I think this would require changes to kivy and garden as well as buildozer. I would prefer to stay with this solution and re-think later if it causes any issues. |
||
|
||
def _add_sitecustomize(self): | ||
copyfile(join(dirname(__file__), 'sitecustomize.py'), | ||
join(self.app_dir, 'sitecustomize.py')) | ||
|
@@ -651,6 +692,10 @@ def app_dir(self): | |
def applibs_dir(self): | ||
return join(self.buildozer_dir, 'applibs') | ||
|
||
@property | ||
def gardenlibs_dir(self): | ||
return join(self.buildozer_dir, 'libs') | ||
|
||
@property | ||
def global_buildozer_dir(self): | ||
return join(expanduser('~'), '.buildozer') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,9 @@ version.filename = %(source.dir)s/main.py | |
# (list) Application requirements | ||
requirements = kivy | ||
|
||
# (list) Garden requirements | ||
#garden_requirements | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #garden_requirements = |
||
|
||
# (str) Presplash of the application | ||
#presplash.filename = %(source.dir)s/data/presplash.png | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to link over the kivy_garden of the garden community instead ? (i don't know if it exist, but if not, it should :))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I split /~https://github.com/Ian-Foote/kivy_garden out of the main kivy repo - I was hoping my fork would get picked up officially as the one source of the garden install scripts.