Skip to content

Ipython3 icon, optional R and Julia launchers #54

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

Merged
merged 2 commits into from
Feb 12, 2015
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
12 changes: 6 additions & 6 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ def _run_complement_batch_scripts(self):
print('launch "%s" for "%s"' % (filepath, self.winpydir))
try:
retcode = subprocess.call('"%s" "%s"' % (filepath, self.winpydir),
shell=True, stdout=sys.stderr)
shell=True, stdout=sys.stderr)
if retcode < 0:
print("Child was terminated by signal", -retcode, file=sys.stderr)
except OSError as e:
Expand Down Expand Up @@ -1045,7 +1045,7 @@ def make_winpython(build_number, release_level, architecture,
os.mkdir(builddir)

# Create 1 wheel directory to receive all packages whished for build
wheeldir = osp.join(builddir, 'wheels_tmp' + suffix)
wheeldir = osp.join(builddir, 'wheels_tmp' + suffix)
if osp.isdir(wheeldir):
shutil.rmtree(wheeldir, onerror=utils.onerror)
os.mkdir(wheeldir)
Expand All @@ -1054,7 +1054,7 @@ def make_winpython(build_number, release_level, architecture,
osp.join(basedir, 'packages.src'),
osp.join(basedir, flavor, 'packages' + suffix),
osp.join(basedir, flavor, 'packages.src')]
for m in list(set(source_dirs)):
for m in list(set(source_dirs)):
if osp.isdir(m):
src_files = os.listdir(m)
for file_name in src_files:
Expand Down Expand Up @@ -1090,9 +1090,9 @@ def make_winpython(build_number, release_level, architecture,
for flavor_docs in [docsdir3, docsdir4]:
if osp.isdir(flavor_docs):
docsdirs.append(flavor_docs)
install_options=['--no-index' , '--find-links=%s' % wheeldir]

install_options = ['--no-index', '--find-links=%s' % wheeldir]

dist = WinPythonDistribution(build_number, release_level,
builddir, wheeldir, toolsdirs,
verbose=verbose, simulation=simulation,
Expand Down
Binary file added portable/icons/ijulia.ico
Binary file not shown.
Binary file added portable/icons/julia.ico
Binary file not shown.
Binary file added portable/icons/jupyter.ico
Binary file not shown.
Binary file added portable/icons/r.ico
Binary file not shown.
32 changes: 17 additions & 15 deletions winpython/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def get_env(name, current=True):
break



def set_env(name, value, current=True):
"""Set HKCU/HKLM environment variables"""
root = winreg.HKEY_CURRENT_USER if current else winreg.HKEY_LOCAL_MACHINE
Expand Down Expand Up @@ -275,7 +274,7 @@ def get_python_infos(path):


def get_python_long_version(path):
"""Return long version (X.Y.Z) for the Python distribution located in
"""Return long version (X.Y.Z) for the Python distribution located in
*path*"""
ver = python_query("import sys; print('%d.%d.%d' % "
"(sys.version_info.major, sys.version_info.minor,"
Expand All @@ -284,6 +283,7 @@ def get_python_long_version(path):
ver = None
return ver


# =============================================================================
# Patch chebang line (courtesy of Christoph Gohlke)
# =============================================================================
Expand Down Expand Up @@ -324,7 +324,7 @@ def patch_sourcefile(fname, in_text, out_text, silent_mode=False):
new_content = content.replace(in_text, out_text)
if not new_content == content:
if not silent_mode:
print("patching " , fname, "from", in_text, "to", out_text)
print("patching ", fname, "from", in_text, "to", out_text)
with io.open(fname, 'wt') as fh:
fh.write(new_content)

Expand Down Expand Up @@ -352,12 +352,13 @@ def extract_msi(fname, targetdir=None, verbose=False):
args += ['/qn']
args += ['TARGETDIR=%s' % targetdir]
subprocess.call([extract]+args, cwd=osp.dirname(fname))
print ('fname=%s' % fname)
print ('TARGETDIR=%s' % targetdir)
print('fname=%s' % fname)
print('TARGETDIR=%s' % targetdir)
# ensure pip if it's not 3.3
if '-3.3' not in targetdir:
subprocess.call([r'%s\%s' %(targetdir, 'python.exe'), '-m' , 'ensurepip'],
cwd=osp.dirname(r'%s\%s' %(targetdir, 'pythons.exe')))
subprocess.call(
[r'%s\%s' % (targetdir, 'python.exe'), '-m', 'ensurepip'],
cwd=osp.dirname(r'%s\%s' % (targetdir, 'pythons.exe')))
# We patch ensurepip live (shame) !!!!
# rational: https://github.com/pypa/pip/issues/2328
import glob
Expand Down Expand Up @@ -442,7 +443,7 @@ def build_wininst(root, python_exe=None, copy_to=None,
archstr = 'win32' if architecture == 32 else 'win-amd64'
cmd += ['--plat-name=%s' % archstr]
cmd += [installer]
# root = a tmp dir in windows\tmp,
# root = a tmp dir in windows\tmp,
if verbose:
subprocess.call(cmd, cwd=root)
else:
Expand All @@ -468,13 +469,13 @@ def build_wininst(root, python_exe=None, copy_to=None,
# for wheels (winpython here)
match = re.match(SOURCE_PATTERN, distname)
if match is not None:
break
break
match = re.match(WHEELBIN_PATTERN, distname)
if match is not None:
break
else:
raise RuntimeError("Build failed: not a pure Python package? %s" %
distdir)
distdir)
src_fname = osp.join(distdir, distname)
if copy_to is None:
return src_fname
Expand Down Expand Up @@ -507,7 +508,7 @@ def build_wheel(this_whl, python_exe=None, copy_to=None,
assert osp.isfile(python_exe)
myroot = os.path.dirname(python_exe)

#cmd = [python_exe, myroot + r'\Scripts\pip-script.py', 'install']
# cmd = [python_exe, myroot + r'\Scripts\pip-script.py', 'install']
cmd = [python_exe, '-m', 'pip', 'install']
if install_options:
cmd += install_options # typically ['--no-deps']
Expand Down Expand Up @@ -539,14 +540,14 @@ def do_script(this_script, python_exe=None, copy_to=None,
assert osp.isfile(python_exe)
myroot = os.path.dirname(python_exe)

#cmd = [python_exe, myroot + r'\Scripts\pip-script.py', 'install']
# cmd = [python_exe, myroot + r'\Scripts\pip-script.py', 'install']
cmd = [python_exe]
if install_options:
cmd += install_options # typically ['--no-deps']
print('script install_options', install_options)
cmd += [this_script]
# print('build_wheel', myroot, cmd)
print("Executing " , cmd)
# print('build_wheel', myroot, cmd)
print("Executing ", cmd)

if verbose:
subprocess.call(cmd, cwd=myroot)
Expand All @@ -559,7 +560,8 @@ def do_script(this_script, python_exe=None, copy_to=None,
if verbose:
print("Executed " % cmd)
return 'ok'



def wheel_to_wininst(fname, python_exe=None,
architecture=None, verbose=False, install_options=None):
"""Just install a wheel !"""
Expand Down
16 changes: 8 additions & 8 deletions winpython/wppm.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def get_package_metadata(database, name):
metadata = dict(description='', url='http://pypi.python.org/pypi/' + name)
for key in metadata:
name1 = name.lower()
# wheel replace '-' per '_' in key
# wheel replace '-' per '_' in key
for name2 in (name1, name1.split('-')[0],
'-'.join(name1.split('_'))):
'-'.join(name1.split('_'))):
try:
metadata[key] = db.get(name2, key)
break
Expand Down Expand Up @@ -233,7 +233,7 @@ def __init__(self, target, verbose=False, indent=False):
self.init_log_dir()
self.to_be_removed = [] # list of directories to be removed later
self.version, self.architecture = utils.get_python_infos(target)

def clean_up(self):
"""Remove directories which couldn't be removed when building"""
for path in self.to_be_removed:
Expand All @@ -242,7 +242,7 @@ def clean_up(self):
except WindowsError:
print("Directory %s could not be removed" % path,
file=sys.stderr)

def remove_directory(self, path):
"""Try to remove directory -- on WindowsError, remove it later"""
try:
Expand Down Expand Up @@ -371,20 +371,20 @@ def install(self, package, install_options=None):
package.save_log(self.logdir)
if tmp_fname is not None:
os.remove(tmp_fname)

# We minimal post-install pywin (pywin32_postinstall.py do too much)
if package.name == "pywin32":
origin = self.target + (r"\Lib\site-packages\pywin32_system32")
destin = self.target
for name in os.listdir(origin):
print("shutil.copy ", osp.join(origin, name), " ", osp.join(destin, name))
shutil.copyfile(osp.join(origin, name), osp.join(destin, name))
shutil.copyfile(osp.join(origin, name), osp.join(destin, name))

# We patch pip live (around line 100) !!!!
# rational: https://github.com/pypa/pip/issues/2328
if package.name == "get-pip":
# self.exec_script
my_script_is=osp.join(self.target, 'Scripts', 'get-pip.py')
my_script_is = osp.join(self.target, 'Scripts', 'get-pip.py')
self.install_script(my_script_is, install_options=None)
if package.name == "pip" or package.name == "get-pip":
import glob
Expand Down Expand Up @@ -527,7 +527,7 @@ def install_script(self, script, install_options=None):
if not self.verbose:
print("Failed!")
raise

def install_bdist_msi(self, package):
"""Install a distutils package built with the bdist_msi option
(binary distribution, .msi file)"""
Expand Down