Skip to content

Commit

Permalink
Merge branch 'master' into pip-improvements
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/rez/utils/_version.py
  • Loading branch information
ajohns committed Aug 19, 2019
2 parents 4edcbee + c4cbd37 commit 02ef3c1
Show file tree
Hide file tree
Showing 12 changed files with 648 additions and 104 deletions.
96 changes: 96 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,101 @@
# Change Log

## 2.40.3 (2019-08-15)
[Source](https:/nerdvegas/rez/tree/2.40.3) | [Diff](https:/nerdvegas/rez/compare/2.40.2...2.40.3)

**Notes**

This update allows custom plugins to override the builtin rez plugins. It does so by reversing the order
in which plugins are loaded, so that builtins are loaded last.

**Merged pull requests:**

- Reverse order for plugins loading [\#692](https:/nerdvegas/rez/pull/692) ([predat](https:/predat))

**Closed issues:**

- rezplugins loading order [\#677](https:/nerdvegas/rez/issues/677)

## 2.40.2 (2019-08-15)
[Source](https:/nerdvegas/rez/tree/2.40.2) | [Diff](https:/nerdvegas/rez/compare/2.40.1...2.40.2)

**Notes**

This release fixes an issue on Windows, which has non-case-sensitive filepaths. Requesting a package with a case
differing from that on disk would cause two packages to exist in the resolve, which really were just different
cases of the same package.

The behaviour on Windows is now:

- Packages are case-sensitive - `rez-env Foo` will fail if the package folder on disk is `foo`;
- Package repository paths are case-insensitive - `~/packages` and `~/Packages` are regarded as the same repo.

**Merged pull requests:**

- [FIX] Make package resolve request respect case sensitivity -- Windows [\#689](https:/nerdvegas/rez/pull/689) ([lambdaclan](https:/lambdaclan))

## 2.40.1 (2019-08-07)
[Source](https:/nerdvegas/rez/tree/2.40.1) | [Diff](https:/nerdvegas/rez/compare/2.40.0...2.40.1)

**Notes**

Fixes regression introduced in v2.39.0.

**Merged pull requests:**

- added missing plugin config [\#690](https:/nerdvegas/rez/pull/690) ([nerdvegas](https:/nerdvegas))

**Closed issues:**

- [Regression - Version >= 2.39.0] ConfigurationError: Error in Rez configuration under plugins.shell [\#688](https:/nerdvegas/rez/issues/688)

## 2.40.0 (2019-08-07)
[Source](https:/nerdvegas/rez/tree/2.40.0) | [Diff](https:/nerdvegas/rez/compare/2.39.0...2.40.0)

**Notes**

- Adds new Zsh shell plugin (**BETA**)

**Merged pull requests:**

- initial implementation of zsh shell plugin [\#686](https:/nerdvegas/rez/pull/686) ([maxnbk](https:/maxnbk))

**Closed issues:**

- zsh plugin for rez [\#451](https:/nerdvegas/rez/issues/451)

## 2.39.0 (2019-08-07)
[Source](https:/nerdvegas/rez/tree/2.39.0) | [Diff](https:/nerdvegas/rez/compare/2.38.2...2.39.0)

**Notes**

- Fixes errors in new powershell plugin
- Adds new powershell core 6+ plugin (**BETA**).

**Merged pull requests:**

- Fix missing import in powershell plugin [\#674](https:/nerdvegas/rez/pull/674) ([instinct-vfx](https:/instinct-vfx))
- Add powershell core 6+ support (pwsh) [\#679](https:/nerdvegas/rez/pull/679) ([instinct-vfx](https:/instinct-vfx))

**Closed issues:**

- Add shell plugin for poweshell 6+ [\#678](https:/nerdvegas/rez/issues/678)

## 2.38.2 (2019-07-23)
[Source](https:/nerdvegas/rez/tree/2.38.2) | [Diff](https:/nerdvegas/rez/compare/2.38.1...2.38.2)

**Notes**

Fixes regression in 2.38.0 that unintentionally renamed _rez_fwd tool to _rez-fwd.

**Merged pull requests:**

- fixed regression in 2.38.0 that unintentionally renamed _rez_fwd to _rez-fwd [\#676](https:/nerdvegas/rez/pull/676) ([nerdvegas](https:/nerdvegas))

**Closed issues:**

- build scripts generated with incorrect shebang arg [\#671](https:/nerdvegas/rez/issues/671)

## 2.38.1 (2019-07-20)
[Source](https:/nerdvegas/rez/tree/2.38.1) | [Diff](https:/nerdvegas/rez/compare/2.38.0...2.38.1)

Expand Down
16 changes: 15 additions & 1 deletion release-rez.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,21 @@ def parse_topmost_changelog():
result["name"] = result["version"] + ' '.join(parts[2:])

elif result.get("version"):
body_lines.append(line)
# GitHub seems to treat separate lines in the md as line breaks,
# rather than keeping them in the same paragraph as a typical
# md renderer would. So patch that up here.
#
br_chars = ('*', '-', '#', '[')

if body_lines and \
body_lines[-1].strip() and \
body_lines[-1][0] not in br_chars and \
line.strip() and \
line[0] not in br_chars:
# append to previous line
body_lines[-1] = body_lines[-1].rstrip() + ' ' + line
else:
body_lines.append(line)

# should never get here
assert False
Expand Down
2 changes: 1 addition & 1 deletion src/rez/cli/_entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def run_rez_complete():
return run("complete")


@scriptname("_rez-fwd")
@scriptname("_rez_fwd")
def run_rez_fwd():
check_production_install()
from rez.cli._main import run
Expand Down
84 changes: 46 additions & 38 deletions src/rez/plugin_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def extend_path(path, name):
init_py = "__init__" + os.extsep + "py"
path = path[:]

for dir in config.plugin_path:
if not os.path.isdir(dir):
for dir_ in config.plugin_path:
if not os.path.isdir(dir_):
if config.debug("plugins"):
print_debug("skipped nonexistant rez plugin path: %s" % dir)
print_debug("skipped nonexistant rez plugin path: %s" % dir_)
continue

subdir = os.path.join(dir, pname)
subdir = os.path.join(dir_, pname)
# XXX This may still add duplicate entries to path on
# case-insensitive filesystems
initfile = os.path.join(subdir, init_py)
Expand Down Expand Up @@ -106,49 +106,57 @@ def load_plugins(self):
# 'rezplugins/type_name' sub-directory).
paths = [package.__path__] if isinstance(package.__path__, basestring) \
else package.__path__

# reverse plugin path order, so that custom plugins have a chance to
# override the builtin plugins (from /rezplugins).
paths = reversed(paths)

for path in paths:
for loader, modname, ispkg in pkgutil.walk_packages(
[path], package.__name__ + '.'):
if loader is not None:
plugin_name = modname.split('.')[-1]
if plugin_name.startswith('_'):
continue
if config.debug("plugins"):
print_debug("loading %s plugin at %s: %s..."
% (self.type_name, path, modname))
try:
# load_module will force reload the module if it's
# already loaded, so check for that
module = sys.modules.get(modname)
if module is None:
module = loader.find_module(modname).load_module(modname)
if hasattr(module, 'register_plugin') and \
hasattr(module.register_plugin, '__call__'):
plugin_class = module.register_plugin()
if plugin_class != None:
self.register_plugin(plugin_name, plugin_class, module)
else:
if config.debug("plugins"):
print_warning(
"'register_plugin' function at %s: %s did not return a class."
% (path, modname))

if loader is None:
continue

plugin_name = modname.split('.')[-1]
if plugin_name.startswith('_'):
continue
if config.debug("plugins"):
print_debug("loading %s plugin at %s: %s..."
% (self.type_name, path, modname))
try:
# load_module will force reload the module if it's
# already loaded, so check for that
module = sys.modules.get(modname)
if module is None:
module = loader.find_module(modname).load_module(modname)
if hasattr(module, 'register_plugin') and \
hasattr(module.register_plugin, '__call__'):
plugin_class = module.register_plugin()
if plugin_class != None:
self.register_plugin(plugin_name, plugin_class, module)
else:
if config.debug("plugins"):
print_warning(
"no 'register_plugin' function at %s: %s"
"'register_plugin' function at %s: %s did not return a class."
% (path, modname))
else:
if config.debug("plugins"):
print_warning(
"no 'register_plugin' function at %s: %s"
% (path, modname))

# delete from sys.modules?
# delete from sys.modules?

except Exception as e:
nameish = modname.split('.')[-1]
self.failed_plugins[nameish] = str(e)
if config.debug("plugins"):
import traceback
from StringIO import StringIO
out = StringIO()
traceback.print_exc(file=out)
print_debug(out.getvalue())
except Exception as e:
nameish = modname.split('.')[-1]
self.failed_plugins[nameish] = str(e)
if config.debug("plugins"):
import traceback
from StringIO import StringIO
out = StringIO()
traceback.print_exc(file=out)
print_debug(out.getvalue())

# load config
data, _ = _load_config_from_filepaths([os.path.join(path, "rezconfig")])
Expand Down
2 changes: 1 addition & 1 deletion src/rez/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create_executable_script(filepath, body, program=None):
# setting the permissions, but this will need to change.
if os.name == "posix":
os.chmod(filepath, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
| stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
| stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)


def create_forwarding_script(filepath, module, func_name, *nargs, **kwargs):
Expand Down
1 change: 1 addition & 0 deletions src/rez/utils/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import os
import re
import stat
import platform


class TempDirs(object):
Expand Down
8 changes: 8 additions & 0 deletions src/rez/utils/platform_.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ def logical_cores(self):
% str(e))
return 1

@property
def has_case_sensitive_filesystem(self):
return True

# -- implementation

def _arch(self):
Expand Down Expand Up @@ -477,6 +481,10 @@ def _os(self):
final_version = str('.').join(toks)
return "windows-%s" % final_version

@property
def has_case_sensitive_filesystem(self):
return False

def _image_viewer(self):
# os.system("file.jpg") will open default viewer on windows
return ''
Expand Down
31 changes: 25 additions & 6 deletions src/rezplugins/package_repository/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import stat
import errno
import time
import platform

from rez.package_repository import PackageRepository
from rez.package_resources_ import PackageFamilyResource, VariantResourceHelper, \
Expand All @@ -21,6 +22,7 @@
from rez.utils.logging_ import print_warning
from rez.utils.memcached import memcached, pool_memcached_connections
from rez.utils.filesystem import make_path_writable
from rez.utils.platform_ import platform_
from rez.serialise import load_from_file, FileFormat
from rez.config import config
from rez.backport.lru_cache import lru_cache
Expand Down Expand Up @@ -461,6 +463,12 @@ def __init__(self, location, resource_pool):
Args:
location (str): Path containing the package repository.
"""

# ensure that differing case doesn't get interpreted as different repos
# on case-insensitive platforms (eg windows)
if not platform_.has_case_sensitive_filesystem:
location = location.lower()

super(FileSystemPackageRepository, self).__init__(location, resource_pool)

global _settings
Expand Down Expand Up @@ -785,20 +793,31 @@ def _get_families(self):
def _get_family(self, name):
is_valid_package_name(name, raise_error=True)
if os.path.isdir(os.path.join(self.location, name)):
family = self.get_resource(
# force case-sensitive match on pkg family dir, on case-insensitive platforms
if not platform_.has_case_sensitive_filesystem and \
name not in os.listdir(self.location):
return None

return self.get_resource(
FileSystemPackageFamilyResource.key,
location=self.location,
name=name)
return family
name=name
)
else:
filepath, format_ = self.get_file(self.location, package_filename=name)
if filepath:
family = self.get_resource(
# force case-sensitive match on pkg filename, on case-insensitive platforms
if not platform_.has_case_sensitive_filesystem:
ext = os.path.splitext(filepath)[-1]
if (name + ext) not in os.listdir(self.location):
return None

return self.get_resource(
FileSystemCombinedPackageFamilyResource.key,
location=self.location,
name=name,
ext=format_.extension)
return family
ext=format_.extension
)
return None

def _get_packages(self, package_family_resource):
Expand Down
Loading

0 comments on commit 02ef3c1

Please sign in to comment.