Permalink
Browse files

merge

  • Loading branch information...
2 parents e5c276b + 6e6cf8f commit 619af4a34abfaeaaddcd3ab5858f8eabd2c2179b @fdev31 committed Feb 3, 2012
Showing with 35 additions and 8 deletions.
  1. +4 −1 _genexecutables.py
  2. +31 −7 manage
View
@@ -1,8 +1,9 @@
#!/usr/bin/env python
__all__ = ['gen', 'executables']
import os
+import sys
-script_base = """#!/usr/bin/env python
+script_base = """#!/usr/bin/env python%(pyver)s
import os
import sys
DB_DIR = os.path.expanduser(os.getenv('ZICDB_PATH') or '~/.zicdb')
@@ -33,10 +34,12 @@ def _try_chmod(n, m):
pass
def gen():
+ pyver = '.'.join(str(x) for x in sys.version_info[:2])
for name, mod, starter in executables:
_try_chmod(name, 0755)
file(name, 'w').write(script_base%{
'mod':mod,
+ 'pyver': pyver,
'exe':starter,
})
_try_chmod(name, 0755)
View
38 manage
@@ -4,14 +4,20 @@ __all__ = ['Cloner', 'Workdir', 'Installer']
import os
import sys
+import re
import urllib
import shutil
import tempfile
import zipfile
from functools import partial
+import easy_install
+
+EZ_INSTALL = 'easy_install-' + re.compile('python(\d+\.\d+)').search(easy_install.__file__).groups()[0]
first_run = not os.path.exists('bee.egg')
+PY_VER='.'.join(str(x) for x in sys.version_info[:2])
+
# Ensure correct dist folder
try:
os.mkdir('dist')
@@ -86,7 +92,7 @@ class Cloner(object):
If mercurial is installed, it will use it, if not, just get the latest version zipfile and unpack
"""
- HOST = "http://zicbee.gnux.info/hg"
+ HOST = "http://zicbee.gnux.info:5000"
BRANCH = "default" # change to "default" to get the stable version or tip to get latest
def _hg_get(self, name):
@@ -235,7 +241,7 @@ build = 1
arch = None
platform = 'linux2'
osdist = None
-python = '2.5'
+python = '%s'
packages = [
'buzhug 1.8',
'mutagen 1.20',
@@ -245,7 +251,7 @@ packages = [
'zicbee-vlc 0.9',
'zicbee-gst 0.6',
]
- """,
+ """%PY_VER,
}
def safe_readlines(path, mode='r'):
try:
@@ -317,10 +323,28 @@ packages = [
file(os.path.join(DEV_DIR, 'EGG-INFO', prop), 'w').write(content)
def hg(self, *args):
- from mercurial.dispatch import dispatch
+ from mercurial.dispatch import dispatch as hg_dispatch
+ dispatch = getattr(self, '_hg_dispatch', None)
+ if not dispatch:
+ from mercurial.__version__ import version as hg_version
+ if hg_version.startswith('2.'):
+ class _Mock(object):
+ def __init__(self, args):
+ self.args = args
+ self.ui = None
+ self.repo = None
+ self.fin = sys.stdin
+ self.fout = sys.stdout
+ self.ferr = sys.stderr
+ def dispatch(args):
+ return hg_dispatch(_Mock(args))
+ self._hg_dispatch = dispatch
+ else:
+ self._hg_dispatch = hg_dispatch
+
for soft in self.softs:
print "[%s]"%soft.upper()
- dispatch(list(args)+['-R', os.path.join(DEV_DIR, soft)])
+ self._hg_dispatch(list(args)+['-R', os.path.join(DEV_DIR, soft)])
def _gen_package(self, *args, **kw):
""" Will generate %s """%hivename
@@ -341,14 +365,14 @@ packages = [
if (forced and (not args or pkg.rsplit(os.sep, 1)[-1] in args)) or not os.path.exists(egg):
if not os.path.isfile(egg):
if not os.path.isdir(fullpath):
- os.system("easy_install -U -e %s -b '%s' '%s'"%(self.packages_extras.get(pkg, ''), DIST_DIR, pkg))
+ os.system("%s -U -e %s -b '%s' '%s'"%(EZ_INSTALL, self.packages_extras.get(pkg, ''), DIST_DIR, pkg))
for e in os.listdir(fullpath):
if e.endswith('.egg'):
rm(j(fullpath, DIST_DIR, e))
with Workdir(fullpath):
rm(j(fullpath, 'build'))
rm(j(fullpath, DIST_DIR))
- os.system('''python -c "import setuptools; execfile('setup.py')" bdist_egg''')
+ os.system('''%s -c "import setuptools; execfile('setup.py')" bdist_egg'''%sys.executable)
egg_file = [j(fullpath, DIST_DIR, e) for e in os.listdir(DIST_DIR) if e.endswith('.egg')][0]
shutil.move(egg_file, egg)
print "extracting %s..."%egg

0 comments on commit 619af4a

Please sign in to comment.