internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: python-poetry/poetry

Issue:
mtime set to 0 on setup.py and PKG-INFO in sdist package
<!--
  Hi there! Thank you for discovering and submitting an issue.

  Before you submit this; let's make sure of a few things.
  Please make sure the following boxes are ticked if they are correct.
  If not, please try and fulfill these first.
-->

<!-- Checked checkbox should look like this: [x] -->
- [x] I am on the [latest](https://github.com/sdispater/poetry/releases/latest) Poetry version.
- [x] I have searched the [issues](https://github.com/sdispater/poetry/issues) of this repo and believe that this is not a duplicate.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).

<!--
  Once those are done, if you're able to fill in the following list with your information,
  it'd be very helpful to whoever handles the issue.
-->

- **OS version and name**: Ubuntu 18.04.1 LTS
- **Poetry version**: 0.12.10
- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: <!-- Gist Link Here -->

## Issue
<!-- Now feel free to write your issue, but please be descriptive! Thanks again 🙌 ❤️ -->
`poetry build` creates an `sdist` tarball. If you unpack that tarball, both the `setup.py` file and the `PKG-INFO` file have an `mtime` of 0. `ctime` and `atime` are set properly.

This is clearly visible if you do an `ls -al` in the unpacked tarball directory. Or you can do `stat -c '%X %Y %Z' setup.py`.

This should repro with any `pyproject.toml` but if it doesn't, happy to upload mine.


Discussion:

Resolving patch:
diff --git a/poetry/masonry/builders/sdist.py b/poetry/masonry/builders/sdist.py
--- a/poetry/masonry/builders/sdist.py
+++ b/poetry/masonry/builders/sdist.py
@@ -2,6 +2,7 @@
 import os
 import re
 import tarfile
+import time
 
 from collections import defaultdict
 from copy import copy
@@ -83,12 +84,14 @@ def build(self, target_dir=None):  # type: (Path) -> Path
             setup = self.build_setup()
             tar_info = tarfile.TarInfo(pjoin(tar_dir, "setup.py"))
             tar_info.size = len(setup)
+            tar_info.mtime = time.time()
             tar.addfile(tar_info, BytesIO(setup))
 
             pkg_info = self.build_pkg_info()
 
             tar_info = tarfile.TarInfo(pjoin(tar_dir, "PKG-INFO"))
             tar_info.size = len(pkg_info)
+            tar_info.mtime = time.time()
             tar.addfile(tar_info, BytesIO(pkg_info))
         finally:
             tar.close()


Test patch:
diff --git a/tests/masonry/builders/test_sdist.py b/tests/masonry/builders/test_sdist.py
--- a/tests/masonry/builders/test_sdist.py
+++ b/tests/masonry/builders/test_sdist.py
@@ -408,6 +408,9 @@ def test_default_with_excluded_data(mocker):
         assert "my-package-1.2.3/pyproject.toml" in names
         assert "my-package-1.2.3/setup.py" in names
         assert "my-package-1.2.3/PKG-INFO" in names
+        # all last modified times should be set to a valid timestamp
+        for tarinfo in tar.getmembers():
+            assert 0 < tarinfo.mtime
 
 
 def test_proper_python_requires_if_two_digits_precision_version_specified():
Repository: python-poetry/poetry

Issue:
`poetry shell` with fish does not echo in python REPL
- [x] I am on the [latest](https://github.com/sdispater/poetry/releases/latest) Poetry version.
- [x] I have searched the [issues](https://github.com/sdispater/poetry/issues) of this repo and believe that this is not a duplicate.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).

- **OS version and name**: MacOS Catalina 10.15.1
- **Poetry version**: 1.0.0b8
- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: N/A

## Issue
As described by [L0stLink](https://github.com/sdispater/poetry/issues/1593#issuecomment-555132468) in a now-closed issue, `fish` still appears to have some issues when using `poetry shell`. Specifically, in the Python REPL "typed text not visible, but pressing enter shows that the input was registered and whatever was typed, executes".

It appears that the fix in #1621 only addressed the `bash` case.


Discussion:

Resolving patch:
diff --git a/poetry/utils/shell.py b/poetry/utils/shell.py
--- a/poetry/utils/shell.py
+++ b/poetry/utils/shell.py
@@ -58,7 +58,7 @@ def activate(self, env):  # type: (VirtualEnv) -> None
                 self._path, ["-i"], dimensions=(terminal.height, terminal.width)
             )
 
-        if not self._name == "bash":
+        if self._name == "zsh":
             c.setecho(False)
 
         activate_script = self._get_activate_script()


Test patch:
Repository: python-poetry/poetry

Issue:
Fix simple typo: specificed -> specified
- [x] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version.
- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).

## Issue

# Issue Type

[x] Bug (Typo)

# Steps to Replicate

1. Examine poetry/masonry/builders/builder.py.
2. Search for `specificed`.

# Expected Behaviour

1. Should read `specified`.



Discussion:

Resolving patch:
diff --git a/poetry/masonry/builders/builder.py b/poetry/masonry/builders/builder.py
--- a/poetry/masonry/builders/builder.py
+++ b/poetry/masonry/builders/builder.py
@@ -162,7 +162,7 @@ def find_files_to_add(self, exclude_build=True):  # type: (bool) -> list
             )
             to_add.append(license_file.relative_to(self._path))
 
-        # If a README is specificed we need to include it
+        # If a README is specified we need to include it
         # to avoid errors
         if "readme" in self._poetry.local_config:
             readme = self._path / self._poetry.local_config["readme"]


Test patch:
Repository: python-poetry/poetry

Issue:
Document the --no-root option
<!--
  Hi there! Thank you for wanting to make Poetry better.

  Before you submit this; let's make sure of a few things.
  Please make sure the following boxes are ticked if they are correct.
  If not, please try and fulfill these first.
-->

<!-- Checked checkbox should look like this: [x] -->
- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [x] I have searched the [documentation](https://python-poetry.org/docs/) and believe that my question is not covered.

## Feature Request
<!-- Now feel free to write your idea for improvement. Thanks again 🙌 ❤️ -->
The `--no-root` option described in https://github.com/python-poetry/poetry/issues/1525 works fine for installation. Unfortunately I found it only when looking for duplicate issues before raising this. `poetry help install` does not describe that option.

Please add it to the `help install` output.
Document the --no-root option
<!--
  Hi there! Thank you for wanting to make Poetry better.

  Before you submit this; let's make sure of a few things.
  Please make sure the following boxes are ticked if they are correct.
  If not, please try and fulfill these first.
-->

<!-- Checked checkbox should look like this: [x] -->
- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [x] I have searched the [documentation](https://python-poetry.org/docs/) and believe that my question is not covered.

## Feature Request
<!-- Now feel free to write your idea for improvement. Thanks again 🙌 ❤️ -->
The `--no-root` option described in https://github.com/python-poetry/poetry/issues/1525 works fine for installation. Unfortunately I found it only when looking for duplicate issues before raising this. `poetry help install` does not describe that option.

Please add it to the `help install` output.


Discussion:

Resolving patch:
diff --git a/poetry/console/commands/install.py b/poetry/console/commands/install.py
--- a/poetry/console/commands/install.py
+++ b/poetry/console/commands/install.py
@@ -34,6 +34,12 @@ class InstallCommand(EnvCommand):
 exist it will look for <comment>pyproject.toml</> and do the same.
 
 <info>poetry install</info>
+
+By default, the above command will also install the current project. To install only the
+dependencies and not including the current project, run the command with the
+<info>--no-root</info> option like below:
+
+<info> poetry install --no-root</info>
 """
 
     _loggers = ["poetry.repositories.pypi_repository"]


Test patch:
Repository: python-poetry/poetry

Issue:
poetry tries to reinstall from git when using annotated tags as references
- [x] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version.
- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).


- **OS version and name**: Debian Buster
- **Poetry version**: 1.0.2
- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: https://gist.github.com/jrmlhermitte/bbfda76d59b820560bf2ff4a1e57d42d

## Issue
This came from a discussion on issue #691 

If we re-run the gist included above, poetry will try re-installing the referred library, even though the git tag has not changed.

This was discovered on the issue mentioned above. Here is the reply from @bibz 
> Thanks for the MRE.

> I can reproduce your example now.
> You found a different bug than we had, due to how git handled signed annotated tags.

> To summarise:

>    The (annotated) tag v5.1.3 itself is a git object with the short sha 73f60e6
>    The tree pointed to by the tag has the short sha 4056bbb

> The lock file refers to the tag object, because it is what v5.1.3 resolves to directly.
 Since the checked-out tree has a different sha, poetry thinks it is not up-to-date (the references are      different) and then re-install it.

> I think we need a new issue for this.


Would it be possible to investigate this, and possibly change the behaviour to not re-install the package?

Thanks for the great work on this wonderful library, keep it up!


Discussion:
Would you guys need help with this?
I can try to use [this commit](https://github.com/python-poetry/poetry/commit/bf2d515a1bc53e0d913ef117f3bd0656b57680a1) as a model (referenced by @bibz). I'm a bit busy until the weekend though, and I may be slow.

If you have it covered, no worries, just trying to offer help when I can, awesome library :)

(PS: I've switched to non-annotated tags so it's not pressing for me, but I don't want others to encounter this :) )
Hello @jrmlhermitte ,

we appreciate any help. So if you like to work on this issue, just go on. :+1: 

Thank you for your help!

fin swimmer

Resolving patch:
diff --git a/poetry/vcs/git.py b/poetry/vcs/git.py
--- a/poetry/vcs/git.py
+++ b/poetry/vcs/git.py
@@ -229,7 +229,9 @@ def rev_parse(self, rev, folder=None):  # type: (...) -> str
                 folder.as_posix(),
             ]
 
-        args += ["rev-parse", rev]
+        # We need "^{commit}" to ensure that the commit SHA of the commit the
+        # tag points to is returned, even in the case of annotated tags.
+        args += ["rev-parse", rev + "^{commit}"]
 
         return self.run(*args)
 


Test patch:
Repository: python-poetry/poetry

Issue:
Self install to PATH of other shell profiles
Using a vanilla macOS Catalina v10.15.5. The default shell profile Terminal uses is zsh. (~/.zshrc)
Poetry does not automatically install to PATH for this type of set up (possibly others).
Could it be set up to handle the different types of shell profiles?

Example:
I installed poetry via curl:

```
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
```

And I receive the message:
```
Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

$HOME/.poetry/bin

This path will then be added to your `PATH` environment variable by
modifying the profile files located at:

$HOME/.profile
$HOME/.zprofile

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing version: 1.0.9
  - Downloading poetry-1.0.9-darwin.tar.gz (10.46MB)

Poetry (1.0.9) is installed now. Great!

To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH`
environment variable. Next time you log in this will be done
automatically.

To configure your current shell run `source $HOME/.poetry/env`
```

I do not have either `$HOME/.profile` or `$HOME/.zprofile`, after install I run `poetry --version` and receive:
```
zsh: command not found: poetry
```

The ticket #507 was opened before but was closed since the user found that you can manually modify `~/.zshrc` and add `export PATH="$HOME/.poetry/bin:$PATH"` to get it to work. (verified it does work)

This ticket is to request the feature of having poetry automatically detect the shell profile and add to the PATH automatically.


Discussion:
`zsh` doesn't create `.zprofile` automatically - https://www.reddit.com/r/zsh/comments/fjcd35/theres_no_zprofile_file_in_my_home_directory_in/ It also doesn't use `.profile` because it may be not compatible. `.zprofile` is also not loaded by graphical terminals - https://askubuntu.com/questions/708924/zprofile-is-not-read-on-graphical-login-when-user-s-default-shell-is-zsh

I see the solution to add to `.zshrc `, because it is run for both login and non-login shells https://www.reddit.com/r/zsh/comments/e882c4/what_is_the_difference_between_zshrc_and_zprofile/

Resolving patch:
diff --git a/get-poetry.py b/get-poetry.py
--- a/get-poetry.py
+++ b/get-poetry.py
@@ -903,7 +903,7 @@ def get_unix_profiles(self):
 
         if "zsh" in SHELL:
             zdotdir = os.getenv("ZDOTDIR", HOME)
-            profiles.append(os.path.join(zdotdir, ".zprofile"))
+            profiles.append(os.path.join(zdotdir, ".zshrc"))
 
         bash_profile = os.path.join(HOME, ".bash_profile")
         if os.path.exists(bash_profile):


Test patch:
Repository: python-poetry/poetry

Issue:
Throw a RuntimeError on hash mismatch in Chooser._get_links
Throw a specific exception in the case of finding a matching name+version, but none of the digests for a link matching the `poetry.lock` metadata.

Resolves: #2422

- [✅] Added **tests** for changed code.
- [✅] Updated **documentation** for changed code.



Discussion:
This will work best with https://github.com/python-poetry/poetry-core/pull/159

Resolving patch:
diff --git a/poetry/installation/chooser.py b/poetry/installation/chooser.py
--- a/poetry/installation/chooser.py
+++ b/poetry/installation/chooser.py
@@ -109,6 +109,13 @@ def _get_links(self, package):  # type: (Package) -> List[Link]
 
             selected_links.append(link)
 
+        if links and not selected_links:
+            raise RuntimeError(
+                "Retrieved digest for link {}({}) not in poetry.lock metadata {}".format(
+                    link.filename, h, hashes
+                )
+            )
+
         return selected_links
 
     def _sort_key(self, package, link):  # type: (Package, Link) -> Tuple


Test patch:
diff --git a/tests/installation/test_chooser.py b/tests/installation/test_chooser.py
--- a/tests/installation/test_chooser.py
+++ b/tests/installation/test_chooser.py
@@ -195,3 +195,32 @@ def test_chooser_chooses_distributions_that_match_the_package_hashes(
     link = chooser.choose_for(package)
 
     assert "isort-4.3.4.tar.gz" == link.filename
+
+
+@pytest.mark.parametrize("source_type", ["", "legacy"])
+def test_chooser_throws_an_error_if_package_hashes_do_not_match(
+    env, mock_pypi, mock_legacy, source_type, pool,
+):
+    chooser = Chooser(pool, env)
+
+    package = Package("isort", "4.3.4")
+    files = [
+        {
+            "hash": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
+            "filename": "isort-4.3.4.tar.gz",
+        }
+    ]
+    if source_type == "legacy":
+        package = Package(
+            package.name,
+            package.version.text,
+            source_type="legacy",
+            source_reference="foo",
+            source_url="https://foo.bar/simple/",
+        )
+
+    package.files = files
+
+    with pytest.raises(RuntimeError) as e:
+        chooser.choose_for(package)
+    assert files[0]["hash"] in str(e)
Repository: python-poetry/poetry

Issue:
 'install-poetry.py' throws 'ModuleNotFoundError' if 'pip' is not available.
<!--
  Hi there! Thank you for discovering and submitting an issue.

  Before you submit this; let's make sure of a few things.
  Please make sure the following boxes are ticked if they are correct.
  If not, please try and fulfill these first.
-->

<!-- Checked checkbox should look like this: [x] -->
- [x] I tried to install [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version.
- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [x] There is no debug mode (`-vvv`) in `install-poetry.py`

<!--
  Once those are done, if you're able to fill in the following list with your information,
  it'd be very helpful to whoever handles the issue.
-->

- **OS version and name**: Debian 11 (Bullseye) Kernel: v5+
- **Poetry version**: v1.1.9
- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: _Not Required_

## Issue
<!-- Now feel free to write your issue, but please be descriptive! Thanks again 🙌 ❤️ -->
The `install-poetry.py` fails after throwing Exception: `ModuleNotFoundError: No module named 'virtualenv'` when installing on Linux System with `pip3` present but `pip` not present.

This is not a desired behavior as this exception should be caught as `CalledProcessError` in the `Installer.install()` method.

I checked the code in `install_poetry.py`, the issue seems to be the use of `subprocess.call()` method (in `Installer.make_env()` method) instead of `subprocess.check_call()` or better instead `subprocess.run()` method (with `check=True` param).

The command invoked through `subprocess.call()` fails and the return code is non-zero too, however, it doesn't throw `CalledProcessError` exception, hence the `import virtualenv` fails later and raises `ModuleNotFoundError` exception.


Discussion:
By _...`pip` not present..._, I mean I don't have the relevant link to `pip3` present in `/usr/[local]/bin`.

Resolving patch:
diff --git a/install-poetry.py b/install-poetry.py
--- a/install-poetry.py
+++ b/install-poetry.py
@@ -516,10 +516,11 @@ def make_env(self, version: str) -> Path:
         env_path = self._data_dir.joinpath("venv")
 
         with temporary_directory() as tmp_dir:
-            subprocess.call(
+            subprocess.run(
                 [sys.executable, "-m", "pip", "install", "virtualenv", "-t", tmp_dir],
                 stdout=subprocess.PIPE,
                 stderr=subprocess.STDOUT,
+                check=True,
             )
 
             sys.path.insert(0, tmp_dir)


Test patch:
Repository: python-poetry/poetry

Issue:
Duplicated console output in 1.2.0b2
Poetry 1.2.0b1:

```
$ poetry build -f wheel
Building projectname (0.1.0)
  - Building wheel
  - Built projectname-0.1.0-py3-none-any.whl
```

Poetry 1.2.0b2 (and latest master):

```
$ poetry build -f wheel
Building projectname (0.1.0)
  - Building wheel
  - Building wheel
  - Built projectname-0.1.0-py3-none-any.whl
  - Built projectname-0.1.0-py3-none-any.whl
```

After some testing I found the behavior changed after commit https://github.com/python-poetry/poetry/commit/50ef22753b4aec2a9825a4b74531b3d99e285678

(Tested in Kubuntu 22.04, Python 3.10.4)


Discussion:
Probably [this line](https://github.com/python-poetry/poetry/blob/9932e2608d5a50e9cbe512574b3f2504f5c3ca7c/src/poetry/console/application.py#L267) just wants removing: the handler is attached to the root logger ten lines previously and does not need separately to be added to the individual loggers.

Resolving patch:
diff --git a/src/poetry/console/application.py b/src/poetry/console/application.py
--- a/src/poetry/console/application.py
+++ b/src/poetry/console/application.py
@@ -264,8 +264,6 @@ def register_command_loggers(
         for name in loggers:
             logger = logging.getLogger(name)
 
-            logger.handlers = [handler]
-
             _level = level
             # The builders loggers are special and we can actually
             # start at the INFO level.


Test patch:
Repository: python-poetry/poetry

Issue:
Make config file relocation instructions more explicit
- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.

## Issue

After upgrading from `1.1` to `1.2` I received the following message:
```
Configuration file exists at /Users/xxx/Library/Application Support/pypoetry, reusing this directory.

Consider moving configuration to /Users/xxx/Library/Preferences/pypoetry, as support for the legacy directory will be removed in an upcoming release.
```

Similar to #6854 I (naively) assumed (based on above message) that the entire directory was configuration related and therefore moved it from `~/Library/Application Support/` to `~/Library/Preferences`.

Of course this lead to poetry no longer functioning.

If an automatic move of the config file is not in the cards, at least the warning message needs to be more explicit what file(s) actually need to be moved.


Discussion:
merge requests improving documentation are usually welcome!

Resolving patch:
diff --git a/src/poetry/locations.py b/src/poetry/locations.py
--- a/src/poetry/locations.py
+++ b/src/poetry/locations.py
@@ -34,9 +34,12 @@
     if any(file.exists() for file in (auth_toml, config_toml)):
         logger.warning(
             (
-                "Configuration file exists at %s, reusing this directory.\n\nConsider"
-                " moving configuration to %s, as support for the legacy directory will"
-                " be removed in an upcoming release."
+                (
+                    "Configuration file exists at %s, reusing this"
+                    " directory.\n\nConsider moving TOML configuration files to %s, as"
+                    " support for the legacy directory will be removed in an upcoming"
+                    " release."
+                ),
             ),
             _LEGACY_CONFIG_DIR,
             CONFIG_DIR,


Test patch: