-
-
Notifications
You must be signed in to change notification settings - Fork 25
A few changes that made mutate_cpp working on Ubuntu 16.04 #1
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
Conversation
|
Thanks for the PR. I shall have a look at it soon. I hope that the project was still useful. |
|
mutate_cpp is really interesting but usual C++ file mutates approximately 700 times. This is 700 rebuilds for one file (if code places in header). In a small project on usual hardware this is a working day. That is why I see mutate_cpp as a toy for developers... But it can help... If a developer has enough time or a good hardware. |
README.md
Outdated
| ```bash | ||
| virtualenv -p python3 venv | ||
| venv/bin/pip install -r requirements | ||
| python3 -m venv venv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assumes that the module venv is installed, right? I tried this on a Ubuntu system today, and virtualenv worked, whereas python -m venv did not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have opposite situation. virtualenv -p python3 venv doesn't work for me on Ubuntu 16.04 whereas python3 -m venv venv is working. And on page https://docs.python.org/3/tutorial/venv.html you can see example:
"To create a virtual environment, decide upon a directory where you want to place it, and run the venv module as a script with the directory path"
python3 -m venv tutorial-env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then there is apparently more than 1 way to do this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Please leave this as it is. Maybe add a comment below that some systems require python3 -m venv venv to create a virtual environment.
| import os.path | ||
| import sys | ||
|
|
||
| sys.path.append( os.path.dirname( os.path.abspath( __file__ ) ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never needed that so far. Is this to make the code robust against the working directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this line is for create_db.py to be working when launched exactly from the root directory of the repository. I had problems with from config import ... Python couldn't find module config. And when I added this line to app/__init__.py create_db.py became working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, user can tune python's environment so all will work without this line. But I'm not sure about from config import ...., why not from app.config import ....?
|
|
||
| # lines: context before | ||
| patch_lines += [' ' + x + '\n' for x in context_before] | ||
| patch_lines += [' ' + x + "\r\n" for x in context_before] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is \r\n needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Git can clone files with different line endings mode. By default, as I guess, git clone with \r\n and pushes with \n. So on my Ubuntu 16.04 I have repositories with \r\n line endings in files. So patch didn't work with \n and works with \r\n. But to be fair it's better to handle both situations...
README.md
Outdated
| ```bash | ||
| virtualenv -p python3 venv | ||
| venv/bin/pip install -r requirements | ||
| python3 -m venv venv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Please leave this as it is. Maybe add a comment below that some systems require python3 -m venv venv to create a virtual environment.
|
|
||
| # step 4: revert patch | ||
| self.__execute_command_timeout('patch -p1 --reverse --input={patchfile} {inputfile}'.format(patchfile=patchfile.name, inputfile=file.filename), | ||
| cwd='/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the rationale for this changed block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to work properly on Ubuntu 16.04. If launch patch -p1 --reverse --input={patchfile} then patch will fail and request file name to patch. And with patch -p1 --reverse --input={patchfile} {inputfile} all works as expected.
| from config import SQLALCHEMY_MIGRATE_REPO | ||
| from app.config import SQLALCHEMY_DATABASE_URI | ||
| from app.config import SQLALCHEMY_MIGRATE_REPO | ||
| from app import db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't these changes also be required in db_migrate.py and db_upgrade.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. I didn't use these scripts, so didn't make any changes to them.
|
I restored README.md and replaced |
|
Thanks a lot! |
|
Hello, just wanted to let you guys know that this PR breaks something on OS X (10.11). I'm not looking for a fix, I just needed to use the library for a university project, and I'm not familiar with Python to fix it. Everything works fine, except for the queue start action. I managed to get the project working by reverting to the commit before this PR was approved. |
|
Could you run |
|
I caught exactly the same problem on my Ubuntu on that days, that is why I created a PR that solved the problem for me. You can edit And change |
|
I can suggest to refuse from |
Now it's simple to initialize and run mutate_cpp in the repository, just clone and do the job. Patches made to work on Ubuntu 16.04. But patches now use \r\n line endings, this is default behavior for git?!