Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F8395845
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Subscribers
None
View Options
diff --git a/PKG-INFO b/PKG-INFO
index 53a92cc..a502622 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,28 +1,28 @@
Metadata-Version: 2.1
Name: swh.core
-Version: 0.0.46
+Version: 0.0.47
Summary: Software Heritage core utilities
Home-page: https://forge.softwareheritage.org/diffusion/DCORE/
Author: Software Heritage developers
Author-email: swh-devel@inria.fr
License: UNKNOWN
-Project-URL: Source, https://forge.softwareheritage.org/source/swh-core
Project-URL: Funding, https://www.softwareheritage.org/donate
Project-URL: Bug Reports, https://forge.softwareheritage.org/maniphest
+Project-URL: Source, https://forge.softwareheritage.org/source/swh-core
Description: swh-core
========
core library for swh's modules:
- config parser
- hash computations
- serialization
- logging mechanism
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 5 - Production/Stable
Description-Content-Type: text/markdown
Provides-Extra: testing
diff --git a/swh.core.egg-info/PKG-INFO b/swh.core.egg-info/PKG-INFO
index 53a92cc..a502622 100644
--- a/swh.core.egg-info/PKG-INFO
+++ b/swh.core.egg-info/PKG-INFO
@@ -1,28 +1,28 @@
Metadata-Version: 2.1
Name: swh.core
-Version: 0.0.46
+Version: 0.0.47
Summary: Software Heritage core utilities
Home-page: https://forge.softwareheritage.org/diffusion/DCORE/
Author: Software Heritage developers
Author-email: swh-devel@inria.fr
License: UNKNOWN
-Project-URL: Source, https://forge.softwareheritage.org/source/swh-core
Project-URL: Funding, https://www.softwareheritage.org/donate
Project-URL: Bug Reports, https://forge.softwareheritage.org/maniphest
+Project-URL: Source, https://forge.softwareheritage.org/source/swh-core
Description: swh-core
========
core library for swh's modules:
- config parser
- hash computations
- serialization
- logging mechanism
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 5 - Production/Stable
Description-Content-Type: text/markdown
Provides-Extra: testing
diff --git a/swh/core/cli.py b/swh/core/cli.py
index 1da8bdb..c8c7684 100755
--- a/swh/core/cli.py
+++ b/swh/core/cli.py
@@ -1,70 +1,71 @@
#!/usr/bin/env python3
# Copyright (C) 2018 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import warnings
warnings.filterwarnings("ignore") # noqa prevent psycopg from telling us sh*t
from os import path
import glob
import click
from importlib import import_module
from swh.core.utils import numfile_sortkey as sortkey
from swh.core.tests.db_testing import pg_createdb, pg_restore, DB_DUMP_TYPES
@click.command()
@click.argument('module', nargs=-1, required=True)
@click.option('--db-name', '-d', help='Database name.',
default='softwareheritage-dev', show_default=True)
-@click.option('--no-create', '-C',
- help='Do not attempt to create the database', default=False)
-def db_init(module, db_name=None, no_create=None):
- """Create and initialise a database for the Software Heritage <module>.
+@click.option('--create/--no-create', '-c',
+ help='Attempt to create the database', default=True)
+def db_init(module, db_name=None, create=True):
+ """Initialise a database for the Software Heritage <module>. By
+ default, attempts to create the database first.
Example:
swh-db-init storage -d swh-test
If you want to specify non-default postgresql connection parameters,
please provide them using standard environment variables.
See psql(1) man page (section ENVIRONMENTS) for details.
Example:
PGPORT=5434 swh-db-init indexer -d swh-indexer
"""
dump_files = []
for modname in module:
if not modname.startswith('swh.'):
modname = 'swh.{}'.format(modname)
try:
m = import_module(modname)
except ImportError:
raise click.BadParameter(
'Unable to load module {}'.format(modname))
sqldir = path.join(path.dirname(m.__file__), 'sql')
if not path.isdir(sqldir):
raise click.BadParameter(
'Module {} does not provide a db schema '
'(no sql/ dir)'.format(modname))
dump_files.extend(sorted(glob.glob(path.join(sqldir, '*.sql')),
key=sortkey))
- if not no_create:
+ if create:
pg_createdb(db_name)
dump_files = [(x, DB_DUMP_TYPES[path.splitext(x)[1]])
for x in dump_files]
for dump, dtype in dump_files:
click.secho('Loading {}'.format(dump), fg='yellow')
pg_restore(db_name, dump, dtype)
click.secho('DONE database is {}'.format(db_name), fg='green', bold=True)
diff --git a/version.txt b/version.txt
index 4da9ae7..b01633f 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-v0.0.46-0-g4753770
\ No newline at end of file
+v0.0.47-0-g386f8e2
\ No newline at end of file
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Jun 4 2025, 7:45 PM (11 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3282863
Attached To
rDCORE Foundations and core functionalities
Event Timeline
Log In to Comment