Skip to content
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

Allow bootstrapping to target multiple platform. Begining of the work on packaging. #8

Merged
merged 9 commits into from
Feb 6, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Physical Etoys - Installation Notes
+++++++++++++++++++++++++++++++++++

You do not have to *install* this project per-se: you
rather *bottstrap* it to generate a clean, suitable PkysicalEtoys
*Squeak image* that can be used as you like.

Pre-requistes
-------------

- Python (it has been tested on Linux and Windows with Python 2.6)
- an Internet connection (to download a blank EToys image and the
Windows Squeak VM)

Bootstrapping
-------------

- from the root directory, run 'python bootstrap.py' (or simply
'./bootstrap.py' if you are on a Unix machine) and follow the
instruction.
- Depending on the selected target, packages containing the image
are built. they are ready for distribution.
12 changes: 12 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
All images are licensed under CC Attribution-ShareALike (http://creativecommons.org/licenses/by-sa/3.0/). The Arduino images were created with Fritzing (http://fritzing.org/). The source code is licensed under the MIT License with parts under the Apache License.

Copyright (c) 1996-2010 Viewpoints Research Institute, and Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You may obtain a copy of the Apache License at http://www.apache.org/licenses/LICENSE-2.0

Copyright (c) 1996 Apple Computer, Inc. All Rights Reserved.

12 changes: 0 additions & 12 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,4 @@ Installed packages (from SqueakSource):
* DuinoBot-Richo.12


License:
--------
All images are licensed under CC Attribution-ShareALike (http://creativecommons.org/licenses/by-sa/3.0/). The Arduino images were created with Fritzing (http://fritzing.org/). The source code is licensed under the MIT License with parts under the Apache License.

Copyright (c) 1996-2010 Viewpoints Research Institute, and Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You may obtain a copy of the Apache License at http://www.apache.org/licenses/LICENSE-2.0

Copyright (c) 1996 Apple Computer, Inc. All Rights Reserved.
25 changes: 25 additions & 0 deletions bootstrap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /usr/bin/env python

APP_NAME = "PhysicalEtoys"
APP_VERSION = "2.0"

print("Welcome to the PhysicalEtoys bootstrapper\n"
"=========================================\n\n"
"What is your target platform?\n"
"w) Windows (.exe)\n"
"d) Ubuntu/Debian (.deb)\n"
"u) Generic Unixes (.tar.gz)\n"
"\n"
"a) Build all targets\n")
platform = raw_input("Enter a letter: ")

if platform.lower() in "aw":
from bootstrap.Win32Bootstrap import Win32Bootstrap
Win32Bootstrap(APP_NAME, APP_VERSION).bootstrap()

if platform.lower() in "da":
print("Debian package generation not yet supported :-( Falling back to tar.gz.")

if platform.lower() in "dua":
from bootstrap.UnixBootstrap import UnixBootstrap
UnixBootstrap(APP_NAME, APP_VERSION).bootstrap()
5 changes: 5 additions & 0 deletions bootstrap/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!.gitignore
!*.py
!*.st
!*.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

class GenericBootstrap:

PLATFORM = "Undefined"

ETOYS_REPO = "http://download.sugarlabs.org/sources/sucrose/glucose/etoys/"
ETOYS_NAME = "etoys-4.1.2390"

Expand Down Expand Up @@ -38,11 +40,16 @@ def bootstrap(self):
self.installArduinoStuff()
self.installNxtStuff()
self.installPE()
self.package()
print("***** We are done! ******")

#Accessing:
def appNameBase(self):
return self.appName + '-' + str(self.appVersion)

def appDir(self):
return os.path.join('.', self.appName + '.' + str(self.appVersion))
return os.path.join('.', self.appNameBase() + '-' + self.PLATFORM)


def absAppDir(self):
return os.path.join(os.getcwd(), self.appDir())
Expand Down Expand Up @@ -90,6 +97,9 @@ def installPE(self):
"""Run squeak with the install_pe script"""
raise Exception("Not implemented")

def package(self):
raise Exception("Not implemented")


#Utils:
def configureProxy(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import os
import subprocess
import tarfile

from GenericBootstrap import GenericBootstrap

class UnixBootstrap(GenericBootstrap):

PLATFORM = "Unix"

def installVM(self):
if not self.which("squeak"):
print("It seems that 'squeak' is not installed on your system.\n"
Expand All @@ -22,3 +25,10 @@ def installPE(self):
subprocess.Popen(["squeak", \
os.path.join(self.appDir(), "Content", self.appName + ".image"), \
os.path.join(os.getcwd(), "install_pe.st")]) .wait()

def package(self):
print("Creating the tar.gz package...")

tarfile.open(os.path.join(self.appDir(), self.appNameBase() + ".tar.gz"), "w:gz").add(os.path.join(self.appDir(), "Content"), arcname = self.appNameBase())
print(self.appNameBase() + ".tar.gz successfully created in " + self.appDir() + ".")

Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import os
import subprocess
import platform

import configure
from GenericBootstrap import GenericBootstrap

class Win32Bootstrap(GenericBootstrap):

WINDOWS_VM_NAME = "VM.win32.2"
PLATFORM = "Windows"
WINDOWS_VM_NAME = "VM.win32.2"

def installVM(self):
url = self.PE_BASE_REPO + self.WINDOWS_VM_NAME + ".tar.gz"
Expand All @@ -28,12 +31,33 @@ def installPE(self):
self.appDir(), \
self.tmpDir())
#Execute PhysicalEtoys with the startup script
subprocess.Popen([os.path.join(self.appDir(), "PhysicalEtoys"), \
os.path.join(self.absAppDir() , "Content", self.appName + ".image"), \
os.path.join(os.getcwd(), "install_pe.st")]).wait()

self.run(os.path.join(self.appDir(), "PhysicalEtoys"), \
[os.path.join(self.absAppDir() , "Content", self.appName + ".image"), \
os.path.join(os.getcwd(), "install_pe.st")])

#Move the .ini file back
if os.path.exists(os.path.join(self.appDir(), "PhysicalEtoys.ini")):
os.remove(os.path.join(self.appDir(), "PhysicalEtoys.ini"))
self.moveMatchingFiles("PhysicalEtoys.ini", \
self.tmpDir(), \
self.appDir())

def package(self):
configure.configure(self, os.path.join("win32", "physicaletoys.nsi.in"), os.path.join(self.tmpDir(), "physicaletoys.nsi"))

def run(self, app, params):
""" Launch an application, using wine when running on Linux.
"""

cmd = [app] + params

if platform.system() != "Windows":
print("Not running on Windows!")
if not self.which("wine"):
raise Exception("WINE is not installed. Install it to cross-compile to Windows.")
else:
print("Trying with wine...")
cmd = ["wine"] + cmd

subprocess.Popen(cmd).wait()
Empty file added bootstrap/__init__.py
Empty file.
18 changes: 18 additions & 0 deletions bootstrap/configure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import re

def configure(bootstrapper, in_file, out_file = None):

if not out_file:
out_file = in_file[:-3] # Blindly remove the '.in' suffix

def evaluate(exp):
if bootstrapper: # Useless 'if', required to import 'bootstrapper' in this scope
pass
m = "bootstrapper." + exp.group(0)[4:-5]
return eval(m)

with open(in_file, "r") as in_file:
with open(out_file, "w") as out_file:
for l in in_file.readlines():
out_file.write(re.sub(r"<py>.*?</py>", evaluate, l))

File renamed without changes.
Empty file added bootstrap/proxy.config
Empty file.
Binary file added cross-platform/boiteabots.ico
Binary file not shown.
14 changes: 0 additions & 14 deletions cross-platform/bootstrapping/bootstrap.py

This file was deleted.

5 changes: 5 additions & 0 deletions win32/Arduino/Sketches/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!.gitignore
!upload.bat
!ArduinoDirectMode/
!ArduinoDirectMode/*
Binary file removed win32/EtoysV4.stc
Binary file not shown.
Binary file removed win32/FT2Plugin.dll
Binary file not shown.
Binary file removed win32/ImmWin32Plugin.dll
Binary file not shown.
Binary file removed win32/KedamaPlugin.dll
Binary file not shown.
Binary file removed win32/KedamaPlugin2.dll
Binary file not shown.
Binary file removed win32/Mpeg3Plugin.dll
Binary file not shown.
Binary file removed win32/OggPlugin.dll
Binary file not shown.
Binary file removed win32/PhysicalEtoys.exe
Binary file not shown.
16 changes: 0 additions & 16 deletions win32/PhysicalEtoys.ini

This file was deleted.

Binary file removed win32/ProcessWrapperPlugin.dll
Binary file not shown.
Binary file removed win32/ScratchPlugin.dll
Binary file not shown.
Binary file removed win32/SqueakFFIPrims.dll
Binary file not shown.
Binary file removed win32/io.dll
Binary file not shown.
Binary file removed win32/localePlugin.dll
Binary file not shown.
131 changes: 131 additions & 0 deletions win32/physicaletoys.nsi.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
; <py>appName</py>.nsi
;--------------------------------


; The name of the installer
Name "<py>appNameBase()</py>"

; The file to write
OutFile "<py>appNameBase()</py>.exe"

; The default installation directory
InstallDir $PROGRAMFILES\SqueakBot

; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\<py>appName</py>" "Install_Dir"

; LoadLanguageFile "${NSISDIR}\Contrib\Language files\French.nlf"


XPStyle on


Icon "boiteabots.ico"
UninstallIcon "boiteabots.ico"

;--------------------------------

; Pages

Page components
Page directory
Page instfiles

UninstPage uninstConfirm
UninstPage instfiles

;--------------------------------

; The stuff to install
Section "<py>appName</py> (required)"

SectionIn RO

; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File "Content\<py>appName</py>.image"
File "Content\<py>appName</py>.changes"
File "EtoysV4.stc"
File "PhysicalEtoys.exe"
File "boiteabots.ico"
File "PhysicalEtoys.ini"
File *.dll
; File "CHANGELOG"
; File "LICENSE"

; Set output path to the installation directory.
SetOutPath $INSTDIR\locale\fr\LC_MESSAGES
File /r locale\*.*

; Do we have .inf file to install?
; SetOutPath $WINDIR\inf
; File "Pilotes\aspic_porkepic.inf"

; We may want to install dlls in windows/system32?
; SetOutPath $SYSDIR
; File "io.dll"

; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\<py>appName</py> "Install_Dir" "$INSTDIR"

; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<py>appName</py>" "DisplayName" "<py>appName</py> v.<py>appVersion</py>"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<py>appName</py>" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<py>appName</py>" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<py>appName</py>" "NoRepair" 1
WriteUninstaller "uninstall.exe"

SectionEnd

; Optional section (can be disabled by the user)
Section "Start Menu shortcuts"

; Let define the "Working directory"
SetOutPath $INSTDIR

CreateDirectory "$SMPROGRAMS\<py>appName</py>"

CreateShortCut "$SMPROGRAMS\SqueakBot\Launch <py>appName</py>.lnk" "$INSTDIR\PhysicalEtoys.exe" "<py>appNameBase()</py>.image" "$INSTDIR\uninstall.exe" 0 SW_SHOWMAXIMIZED

CreateShortCut "$SMPROGRAMS\SqueakBot\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0

SectionEnd

Section "Desktop shortcuts"



CreateShortCut "$DESKTOP\Launch <py>appName</py>.lnk" "$INSTDIR\PhysicalEtoys.exe" "<py>appNameBase()</py>.image" "$INSTDIR\uninstall.exe" 0 SW_SHOWMAXIMIZED

SectionEnd

;--------------------------------

; Uninstaller

Section "Uninstall"

; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<py>appName</py>"
DeleteRegKey HKLM SOFTWARE\<py>appName</py>

; Remove files and uninstaller
Delete $INSTDIR\*.*

; Remove shortcuts, if any
Delete "$SMPROGRAMS\<py>appName</py>\*.*"
Delete "$DESKTOP\Launch <py>appName</py>.lnk"

; Remove directories used
RMDir "$SMPROGRAMS\<py>appName</py>"
RMDir "$INSTDIR"

;the driver for the ASPIC board is not removed yet (not really necessary).

SectionEnd

;--------------------------------

Binary file removed win32/sapien.dll
Binary file not shown.
Binary file removed win32/wiiuse.dll
Binary file not shown.