This previously used the `machine` tag that was turned off when a user de-activated the version,
but never turned back on when they re-activated it.
This changes to just use the `active` flag on the Version,
so we will update the stable version if the existing one is `active`,
and not if it isn't,
which makes _way_ more sense.
Now, this logic is like this:
- if the project has any Version that is a TAG, the highest version
will only be a TAG also (BRANCH are not considered)
- if the project doesn't have any TAG the highest version will be a
BRANCH (or UNKNOWN in the worst case)
This allows us to have the same `verbose_name` for different type of
versions (for example, '2.0' could both a tag and a branch). If this
happen, we want to keep them both.
In the UI, it will say just `"2.0"` for the branch and
`"2.0 (c0d25453)"` for the tag. This could be improved later if
necessary.
* Allow BUILD_IMAGES to be updated from a setting
Fixes#3524
* Styles
* Style updates
Config changes:
- ignore D107 (__init__ method must have a docstring) in flake8
- readthedocs and readthedocsinc are marked as FIRSTPARTY in isort
- readthedocs_build is marked as THIRDPARTY
* Rename setting to DOCKER_BUILD_IMAGES
* Do not show Build button when user is not project admin
Closes#3303
* Add test to check for Build section
* Fix old test to make sure a public branch is listed
`pk` exists only for Builds that are retrieved from the database, but
when it's retrieved using the API, the `id` must be used.
Using the `id` is compatible with both instances.
Related to #2963
* Config files for auto linting
autoflake, autopep8, docformatter, isort, yapf
* readthedocs.projects.views.base with auto styling applied
* readthedocs.core.models auto styling applied
* readthedocs.builds.urls with auto styling applied
* Do not make multi line summaries
* Improve isort settings
* Use 80 columns as maximum
* pre-commit config file
Use the `pre-commit` tool to run some linting commands before each
commit:
http://pre-commit.com/
* Update yapf config file to 0.20.0
* Add i18n functions to yapf config
* Remove django as a special section for isort
* Rename config to be automatically discovered
* Add annoying as a third party lib for isort
* Use the new config for all the files modified as a test
I had to add a couple of "trailing commas" to keep the format as we want
* Install additional dependencies for each of the hooks
Remove the auto-lint.txt requirements file since it's not needed anymore
* Use default config name for autopep8
* Include autoflake as pre-commit hook
* Exclude D105 from flake8
D105: Missing docstring in magic method
* Minor fixes from flake8
* autoflake with --in-place
* Arguments for docformatter
* Autofix D203 with yapf
D203 / 1 blank line required before class docstring
* Ignore local_settings.py on prospector
* Update Build state at the end of UpdateDocsTask.run
Use the `update_build` method that handles most of the cases but fill
the `failure` with a unhandled exception in case it was risen.
* Fix lint style
* Fix attribute name
* Return the object we already have in memory instead of doing API call
* Use a str variable
* Update build from database at __exit__
When an exception happens and it's handled by __exit__ our Build in
the database is not updated and it stay in 'Installing' forever. So,
when something bad happens we force a call to `update_build` with the
FINISHED state
Attempt to fix#3285
* `update_build` when FINISHED in the right place
* Extra way to check OOM of a command ran inside Docker
Easy way to reproduce this error:
1. Import a project that compiles lxml (Read the Docs, for example)
2. The `pip` command will be killed and Docker won't return a specific
status code, it will just return 1
3. In these cases, the `Killed` word will probably appear in the last
15 lines
* Check status code and 'Killed' word
* Add supervisord contrib example
Useful for running a development instance really quickly.
Doesn't yet support:
* ipdb/pdb, but still supports rdb
* color log output
* Revert to celery concurrency
* Updates
* Do not convert to bytes the `refresh_token`
When the body is encoded, a mix of bytes and unicode happens and it
fails at this line
c472e6bf04/requests_oauthlib/oauth2_session.py (L285)
(Pdb) body
u'grant_type=refresh_token&allow_redirects=True&refresh_token=b%27z9BSRKqf2QD4pcDhqj%27&client_id=CLIENT_ID&client_secret=CLIENT_SECRET'
(note those weird `%27` in the string)
* Handle OAuth specific exception properly at `paginate`
* Do not convert the `acess_token` to bytes
* Fix lint :(
* Refactor `paginate` to handle exception in Bitbucket and Github
`paginate` method is shared between both services and each service
implement `get_next_url_to_paginate` and `get_paginated_results`.
* Names and attributes fixes