Skip to content

Commit

Permalink
Fix rez bind python
Browse files Browse the repository at this point in the history
It was copying way too much stuff
  • Loading branch information
mottosso committed May 1, 2019
1 parent dfcc6e8 commit a18f2d3
Showing 1 changed file with 2 additions and 38 deletions.
40 changes: 2 additions & 38 deletions src/rez/bind/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
"""
from __future__ import absolute_import
from rez.bind._utils import check_version, find_exe, extract_version, \
make_dirs, log, run_python_command
log
from rez.package_maker__ import make_package
from rez.system import system
from rez.utils.lint_helper import env
from rez.utils.platform_ import platform_
from rez.vendor.version.version import Version
import shutil
import os.path


def setup_parser(parser):
Expand Down Expand Up @@ -45,45 +41,13 @@ def bind(path, version_range=None, opts=None, parser=None):
check_version(version, version_range)
log("binding python: %s" % exepath)

# find builtin modules
builtin_paths = {}
entries = [("lib", "os"),
("extra", "setuptools")]

for dirname, module_name in entries:
success, out, err = run_python_command([
"import %s" % module_name,
"print(%s.__file__)" % module_name])

if success:
pypath = os.path.dirname(out)
if os.path.basename(pypath) == module_name:
pypath = os.path.dirname(pypath)

if pypath not in builtin_paths.values():
builtin_paths[dirname] = pypath

# make the package
#

def make_root(variant, root):
if builtin_paths:
pypath = make_dirs(root, "python")
for dirname, srcpath in builtin_paths.iteritems():
destpath = os.path.join(pypath, dirname)
log("Copying builtins from %s to %s..." % (srcpath, destpath))
shutil.copytree(srcpath, destpath)

with make_package("python", path, make_root=make_root) as pkg:
with make_package("python", path) as pkg:
pkg.version = version
pkg.tools = ["python"]
pkg.commands = commands
pkg.variants = [system.variant]
pkg.exe = exepath

if builtin_paths:
pkg.post_commands = post_commands

return pkg.installed_variants


Expand Down

0 comments on commit a18f2d3

Please sign in to comment.