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

Conversation

benrudolph
Copy link
Contributor

This removes any references to symbolic links when cloning. We were seeing a bug due to this in our deploy process. For example, suppose current is the symlink to the current release deployed.

release1 -> current
release2

virtualenv-clone current/python_env release2/python_env

old_dir will be current/python_env but in actuality the proper old path is release1/python_env and thus the find and replace fails

@dannyroberts
Copy link

Nice work @benrudolph, this would be great to have

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!

@edwardgeorge
Copy link
Owner

thanks @benrudolph. let me see if i can get travis or circleci set up with this repo and then i'll merge

@benrudolph
Copy link
Contributor Author

👍 sounds good

@timabbott timabbott merged commit 15f8395 into edwardgeorge:master Sep 16, 2017
@benrudolph
Copy link
Contributor Author

benrudolph commented Sep 16, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants