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

Add Jupyter trove classifier. #1905

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Create `Framework::Jupyter` as required on pypi-legace issue 210

Revision ID: 1430c9aefcd7
Revises: ad81a3452b5d
Create Date: 2017-04-06 22:03:40.917628
"""

from alembic import op
import sqlalchemy as sa


revision = '1430c9aefcd7'
down_revision = 'ad81a3452b5d'
classifier = "Framework :: Jupyter"

def upgrade():
op.execute(
"""
INSERT into trove_classifiers (classifier, l2, l3, l4, l5) VALUES ('{classifier}', 0, 0, 0, 0);
UPDATE trove_classifiers set l2=id where classifier='{classifier}';
""".format(classifier=classifier)
)

pass


def downgrade():
op.execute(
"""
DELETE from release_classifiers where trove_id=(SELECT id from trove_classifiers where classifier='{classifier}');
DELETE FROM trove_classifiers where classifier='{classifier}';
""".format(classifier=classifier)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autoincrement trove classifier id when inserting (if id not given).

Revision ID: ad81a3452b5d
Revises: 5b3f9e687d94
Create Date: 2017-04-04 21:00:25.205245
"""

from alembic import op

revision = 'ad81a3452b5d'
down_revision = '5b3f9e687d94'

def upgrade():
"""
Autoincrement the trove classifier ID when a new one get inserted.
"""
op.execute(
"""CREATE SEQUENCE trove_classifiers_seq;
SELECT setval('trove_classifiers_seq',
(SELECT max(id) from trove_classifiers)
);
ALTER TABLE trove_classifiers
ALTER COLUMN id
SET DEFAULT nextval('trove_classifiers_seq');
ALTER SEQUENCE trove_classifiers_seq
OWNED BY trove_classifiers.id;
""")


def downgrade():
op.execute(
"""ALTER TABLE trove_classifiers
ALTER COLUMN id SET DEFAULT 1;
DROP SEQUENCE trove_classifiers_seq;
""")