Skip to content
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

Eliminate symbolic links #20

Merged
merged 2 commits into from Sep 16, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions clonevirtualenv.py
Expand Up @@ -291,8 +291,8 @@ def main():
except ValueError:
print("virtualenv-clone {}".format(__version__))
parser.error("not enough arguments given.")
old_dir = os.path.normpath(os.path.abspath(old_dir))
new_dir = os.path.normpath(os.path.abspath(new_dir))
old_dir = os.path.realpath(os.path.normpath(os.path.abspath(old_dir)))
new_dir = os.path.realpath(os.path.normpath(os.path.abspath(new_dir)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems that os.path.realpath is all that is actually needed as it expands to the full, canonical path and the usage of both normpath and abspath can be removed.

In [10]: x
Out[10]: 'foodir2'

In [11]: os.path.islink(x)
Out[11]: True

In [12]: os.path.realpath(x)
Out[12]: '/Users/xxxxxx/Workspace/projects/xxxxxxxxxxx/foodir'

so this could just be:

old_dir = os.path.realpath(old_dir)
new_dir = os.path.realpath(new_dir)

do you agree?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed. i'll update thanks for looking into it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benrudolph can you update this to remove the unnecessary path code here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I was looking at just the first commit, and you changed this in a second one. Merged, thanks @benrudolph!

loglevel = (logging.WARNING, logging.INFO, logging.DEBUG)[min(2,
options.verbose)]
logging.basicConfig(level=loglevel, format='%(message)s')
Expand Down