Skip to content

Commit

Permalink
Improve docstring; don't bother caching
Browse files Browse the repository at this point in the history
If we pass in different CWDs in the same git repo, we'll end up firing
off git multiple times. Let the consumer worry about it if it's that
important.
  • Loading branch information
David Robertson committed Jun 6, 2022
1 parent 1b58254 commit aaa6c39
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/matrix_common/versionstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import functools
import logging
import subprocess
from typing import Optional
Expand All @@ -27,7 +26,6 @@
logger = logging.getLogger(__name__)


@functools.lru_cache()
def get_distribution_version_string(
distribution_name: str, cwd: Optional[str] = None
) -> str:
Expand All @@ -46,9 +44,11 @@ def get_distribution_version_string(
Args:
distribution_name: The name of the distribution package to check the version of
cwd: if provided, the directory to run all git commands in. If omitted, the
function will attempt to locate the distribution's source on disk and use
that location instead, but this is not reliable.
cwd: if provided, the directory to run all git commands in. `cwd` may also be
the path to a file, in which case `os.path.dirname(cwd)` is used instead.
If omitted, the function will attempt to locate the distribution's source
on disk and use that location instead---but this fallback is not reliable.
Raises:
importlib.metadata.PackageNotFoundError if the given distribution name doesn't
Expand Down

0 comments on commit aaa6c39

Please sign in to comment.