-
Notifications
You must be signed in to change notification settings - Fork 12
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
Template Cleanup #38
Template Cleanup #38
Conversation
@Korusuke cool, this will definitely help with readability of the templates! However, I would say the indentation for Have you tried fiddling around with the lines below in the jinja2.Environment?
|
Yes I did but to no luck, turning |
Ok so changing a bunch of things "it works" technically but in my view the readability of the base portfile now is next to none. I will try a bit more if its possible in some other way. |
You will need to add a
|
Yep. You could run a little script that runs "upt -b macports" with all known frontends and makes sure it does not crash in order to catch these issues :) |
there are still issues with empty lines; I know that these templates are a bit cryptic, but the Portfiles we output should be correct |
Ok I checked and there were 2 empty lines in ruby portfile after checksums and the 2 empty lines at the end in ruby and perl portfiles. Now everything should be fixed. |
no, it's still not correct. There are empty lines in the ruby template within the |
Still there is one empty line remaining at end of |
okay, I will take a look at this myself then - you should focus on more useful things ;) I had fixed the ruby template this afternoon in a few minutes, but now you force-pushed all kind of other changes again so I can't tell anymore what has changed. If I have permission to push to this branch I will do so, otherwise I'll put a copy of the corrected templates somewhere so that you can take a look at them. |
@Korusuke @Steap these templates are a serious pain in the ***.... It took quite a bit of time throughout the weekend to get it to a state where I think it's consistent/correct for all things I have tried (~250 random ports of the Python/Perl/Ruby categories). I ended up with starting from the current I have moved around some stuff in the templates, corrected the whitespacing/newlines, and a few other things that didn't work correctly. One of them being the build/config dependencies in the Perl template, which didn't work correctly if either I have left the kind-of-messy commits in my branch so that you can follow it. I am not sure how you want to proceed? Why don't you start by taking a look at it and then you can either take my commits, squash some of them, and perhaps merge parts in here? |
Codecov Report
@@ Coverage Diff @@
## master #38 +/- ##
=========================================
- Coverage 87.74% 85.8% -1.94%
=========================================
Files 1 1
Lines 155 162 +7
Branches 7 7
=========================================
+ Hits 136 139 +3
- Misses 19 23 +4
Continue to review full report at Codecov.
|
okay, I see you took the code from my branch. Did you do some additional testing yourself to make sure everything works as you want to? If you agree/confirm here that this indeed works as intended I'll merge it. |
Yes I did test it and went over the whole code...I had considered doing this way(using if else for every scenario) but personally I don't really like it much but seeing nothing else works, I guess this is the only way we have :) |
It would be nice to solve in another way, but I think we both agree that it seems quite impossible.... In the end of the day, I think these jinja2 templates are intended for HTML code and there some extra whitespace doesn't really matter. In any case, this solution works and give the output we want so I am fine with some It would be nice to add some tests for the actual templates to make sure the fields/whitespaces are correct. One option would be to add "correct" templates for a a few ports in every category and compare the |
Ok I'll see how we can add tests but I guess that can be done in an another PR. |
@Steap any concerns with merging this? Kind of the only thing I am not a big fan of is the handling of the build/config dependencies in the Perl template. But the readability isn't too bad and I cannot figure out an easier, robust way of doing this - at least not in the template. I guess one could merge the config/build dependencies in the backend code, but I am not sure if this is more useful... |
okay, I am going to merge this now. |
As of now I have just done for python Portfile.
It works but there are issues with spacing, as for this code we get the following output
for upt:
which is right but for upt-cpan it is:
I already tried many different combination both logically and brute forcing but none gets the expected result.
The if statement around macro call is totally unnecessary and is just there as it was a possible solution as per this.
I will try a bit more if this can be fixed.