Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2006-11-30 23:44:39 (GMT)
committer Simon Schampijer <simon@schampijer.de>2006-11-30 23:44:39 (GMT)
commit935be6a733888127cedad743358668374b960c33 (patch)
tree134774955d0e832c596e1dd4b63f15a90413e04f /setup.py
parent1c29fca2f8423a71fa5759cc70df57b752656d70 (diff)
The new setup.py for marcos interface
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py98
1 files changed, 2 insertions, 96 deletions
diff --git a/setup.py b/setup.py
index 42820f8..8d93d78 100755
--- a/setup.py
+++ b/setup.py
@@ -16,100 +16,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-import sys
-import os
-import zipfile
+from sugar.activity import bundlebuilder
-from sugar.activity.bundle import Bundle
-
-class SvnFileList(list):
- def __init__(self):
- f = os.popen('svn list -R')
- for line in f.readlines():
- filename = line.strip()
- if os.path.isfile(filename):
- self.append(filename)
- f.close()
-
-class GitFileList(list):
- def __init__(self):
- f = os.popen('git-ls-files')
- for line in f.readlines():
- filename = line.strip()
- if not filename.startswith('.'):
- self.append(filename)
- f.close()
-
-def get_source_path():
- return os.path.dirname(os.path.abspath(__file__))
-
-def get_activities_path():
- path = os.path.expanduser('~/Activities')
- if not os.path.isdir(path):
- os.mkdir(path)
- return path
-
-def get_bundle_dir():
- bundle_name = os.path.basename(get_source_path())
- return bundle_name + '.activity'
-
-def get_bundle_path():
- return os.path.join(get_activities_path(), get_bundle_dir())
-
-def print_help():
- print 'Usage: \n\
-setup.py dev - setup for development \n\
-setup.py package - create a bundle package \n\
-setup.py clean - cleans the directory \n\
-setup.py help - print this message \n\
-'
-
-def setup_dev():
- bundle_path = get_bundle_path()
- try:
- os.symlink(get_source_path(), bundle_path)
- except OSError:
- if os.path.islink(bundle_path):
- print 'ERROR - The bundle has been already setup for development.'
- else:
- print 'ERROR - A bundle with the same name is already installed.'
-
-def build_package():
- orig_path = os.getcwd()
- os.chdir(get_source_path())
-
- if os.path.isdir('.git'):
- file_list = GitFileList()
- elif os.path.isdir('.svn'):
- file_list = SvnFileList()
- else:
- print 'ERROR - The command works only with git or svn repositories.'
-
- bundle = Bundle(get_source_path())
-
- zipname = '%s-%d.xo' % (bundle.get_name(), bundle.get_activity_version())
- bundle_zip = zipfile.ZipFile(zipname, 'w', zipfile.ZIP_DEFLATED)
-
- for filename in file_list:
- arcname = os.path.join(get_bundle_dir(), filename)
- bundle_zip.write(filename, arcname)
-
- bundle_zip.close()
-
- os.chdir(orig_path)
-
-def clean():
- os.path.walk('.', delete_backups, None)
-def delete_backups(arg, dirname, names):
- for name in names:
- if name.endswith('~') or name.endswith('pyc'):
- os.remove(os.path.join(dirname, name))
-
-if len(sys.argv) < 2 or sys.argv[1] == 'help':
- print_help()
-elif sys.argv[1] == 'dev':
- setup_dev()
-elif sys.argv[1] == 'package':
- build_package()
-elif sys.argv[1] == 'clean':
- clean()
+bundlebuilder.start()