pkgstruct


Namepkgstruct JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/nanigashi-uji/pkgstruct.git
SummaryUtility module for formalising the directory structure of software package
upload_time2025-02-16 13:24:35
maintainerNone
docs_urlNone
authorNanigashi Uji
requires_pythonNone
licenseBSD-3-Clause
keywords directory structure gnu coding standards fhs
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            pkgstruct
=========

-  Utility module for formalising the directory structure of software
   package. The top directory path can be infered from the script path.

-  ``pkgstruct`` supports having a directory structure under the top
   directory, such as ``var``, ``share``,\ ``etc``,… under the top
   directory, and supports the creation of directory structures
   according to the GNU Coding Standard and the Filesystem Hierarchy
   Standard.

Requirement
-----------

-  ``pkgstruct`` uses only standard modules.

Usage
-----

install
~~~~~~~

::

   % pip install pkgstruct

Example
~~~~~~~

Example usage of pkgstruct.py

First, import the module and define an entity of class PkgStruct that
uses it. The top directory name is inferred from the script name given
in the constructor argument.

::

   import pkgstruct
   ...
       Pkg_info = pkgstruct.PkgStruct(script_path=sys.argv[0])
       # pkg_info.dump(relpath=False, with_seperator=True)
   ...
       pkg_info.make_subdirs(‘pkg_sysconfdir’, 0o755, True, ‘kivy’)
       os.environ[‘KIVY_HOME’] = pkg_info.concat_path(‘pkg_sysconfdir’, ‘kivy’)
   ....

What subdirectories are defined by it can be displayed with the member
function dump().

If the script path (``base_script``) given as argument is
``~/tmp/py_working_tool/lib/python/show_status3.py``, Further parent
directories of the upper than ``lib/python/``, which is its directory
name ``py_working_tool``, is interpreted as the package
name:``pkg_name``, and the location of that directory
``~/tmp/py_working_tool`` is recognized as the top of the directory
structure (``prefix``). Then the following directory structure is
deteremied according the rules similar to the GNU Coding Standard or
FHS.

-  ``bindir``: ~/tmp/py_working_tool/bin
-  ``datadir``: ~/tmp/py_working_tool/share
-  ``sysconfdir``: ~/tmp/py_working_tool/etc
-  ``localstatedir``: ~/tmp/py_working_tool/var
-  ``runstatedir``: ~/tmp/py_working_tool/var/run
-  ``tmpdir``: ~/tmp/py_working_tool/tmp

and other subdirectories of the package name (``pkg_name``) directly
under these directory names

-  ``pkg_datadir``: ~/tmp/py_working_tool/share/py_working_tool
-  ``pkg_sysconfdir``: ~/tmp/py_working_tool/etc/py_working_tool
-  ``pkg_cachedir``: ~/tmp/py_working_tool/var/cache/py_working_tool
-  ``pkg_statedatadir``: ~/tmp/py_working_tool/var/lib/py_working_tool
-  ``pkg_logdir``: ~/tmp/py_working_tool/var/log/py_working_tool
-  ``pkg_spooldir``: ~/tmp/py_working_tool/var/spool/py_working_tool

The equivalent string is defined and can be accessed as a property of
the ``PkgStruct`` class. What properties (subdirectory names) are
defined can also be checked by directly executing ``pkgstruct.py`` on
its own. (``********`` will be the name of the executing user).

Then following is the Example of running ``pkgstruct.py``

::

   ‘pkg_name': py_working_tool
   ‘pkg_path': ~/tmp/py_working_tool
   ----------------------------------------------------------------------
   ‘base_script': ~/tmp/py_working_tool/lib/python/pkgstruct.py
   ----------------------------------------------------------------------
   ‘script_mnemonic': pkgstruct
   ‘script_path': ~/tmp/py_working_tool/lib/python/pkgstruct.py
   ‘script_location': ~/tmp/py_working_tool/lib/python
   ‘script_basename': pkgstruct.py
   ----------------------------------------------------------------------
   ‘prefix': ~/tmp/py_working_tool
   ----------------------------------------------------------------------
   ‘exec_user’: ********
   ----------------------------------------------------------------------
   'exec_prefix':       '${prefix}'
   'bindir':            '${prefix}'/bin
   'datarootdir':       '${prefix}'/share
   'datadir':           '${prefix}'/share
   'sysconfdir':        '${prefix}'/etc
   'sharedstatedir':    '${prefix}'/com
   'localstatedir':     '${prefix}'/var
   'include':           '${prefix}'/include
   'libdir':            '${prefix}'/lib
   'srcdir':            '${prefix}'/src
   'infodir':           '${prefix}'/share/info
   'runstatedir':       '${prefix}'/var/run
   'localedir':         '${prefix}'/share/locale
   'lispdir':           '${prefix}'/emacs/lisp
   'docdir':            '${prefix}'/doc/py_working_tool
   'htmldir':           '${prefix}'/doc/py_working_tool
   'dvidir':            '${prefix}'/doc/py_working_tool
   'pdfdir':            '${prefix}'/doc/py_working_tool
   'psdir':             '${prefix}'/doc/py_working_tool
   'mandir':            '${prefix}'/share/man
   'man0dir':           '${prefix}'/share/man/man0
   'man1dir':           '${prefix}'/share/man/man1
   'man2dir':           '${prefix}'/share/man/man2
   'man3dir':           '${prefix}'/share/man/man3
   'man4dir':           '${prefix}'/share/man/man4
   'man5dir':           '${prefix}'/share/man/man5
   'man6dir':           '${prefix}'/share/man/man6
   'man7dir':           '${prefix}'/share/man/man7
   'man8dir':           '${prefix}'/share/man/man8
   'man9dir':           '${prefix}'/share/man/man9
   'manndir':           '${prefix}'/share/man/mann
   'sbindir':           '${prefix}'/sbin
   'bootdir':           '${prefix}'/boot
   'devdir':            '${prefix}'/dev
   'mediadir':          '${prefix}'/media
   'mntdir':            '${prefix}'/mnt
   'optdir':            '${prefix}'/opt
   'tmpdir':            '${prefix}'/tmp
   'xmldir':            '${prefix}'/etc/xml
   'etcoptdir':         '${prefix}'/etc/opt
   'cachedir':          '${prefix}'/var/cache
   'statedatadir':      '${prefix}'/var/lib
   'lockdir':           '${prefix}'/var/lock
   'logdir':            '${prefix}'/var/log
   'spooldir':          '${prefix}'/var/spool
   'statetmpdir':       '${prefix}'/var/tmp
   'user_home':         '${prefix}'/Users/********
   'home':              '${prefix}'/Users/********
   'homedir':           '${prefix}'/Users
   ----------------------------------------------------------------------
   'pkg_datadir':       '${prefix}'/share/py_working_tool
   'pkg_sysconfdir':    '${prefix}'/etc/py_working_tool
   'pkg_runstatedir':   '${prefix}'/var/run/py_working_tool
   'pkg_include':       '${prefix}'/include/py_working_tool
   'pkg_libdir':        '${prefix}'/lib/py_working_tool
   'pkg_srcdir':        '${prefix}'/src/py_working_tool
   'pkg_tmpdir':        '${prefix}'/tmp/py_working_tool
   'pkg_xmldir':        '${prefix}'/etc/xml/py_working_tool
   'pkg_cachedir':      '${prefix}'/var/cache/py_working_tool
   'pkg_statedatadir':  '${prefix}'/var/lib/py_working_tool
   'pkg_lockdir':       '${prefix}'/var/lock/py_working_tool
   'pkg_logdir':        '${prefix}'/var/log/py_working_tool
   'pkg_spooldir':      '${prefix}'/var/spool/py_working_tool
   'pkg_statetmpdir':   '${prefix}'/var/tmp/py_working_tool
   ----------------------------------------------------------------------

In addition, the member function ``concat_path()`` was implemented to
create another directory/file name string under these. The member
function ``make_subdirs()`` was also implemented to actually create the
directory. Example:

::

   pkg_info.make_subdirs(‘pkg_sysconfdir’, 0o755, True, ‘kivy’)
   os.environ[‘KIVY_HOME’] = pkg_info.concat_path(‘pkg_sysconfdir’, ‘kivy’)

The above is the code that creates the directory
``~/tmp/py_working_tool/etc/py_working_tool/kivy`` and sets this
directory in the environment variable ``'KIVY_HOME'``.

Author
------

Nanigashi Uji (53845049+nanigashi-uji@users.noreply.github.com)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nanigashi-uji/pkgstruct.git",
    "name": "pkgstruct",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Directory Structure, GNU Coding Standards, FHS",
    "author": "Nanigashi Uji",
    "author_email": "53845049+nanigashi-uji@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/36/bc/6891c4dea441669824be9533578208e33bdf06a4ba54fc654a2240affba1/pkgstruct-0.0.1.tar.gz",
    "platform": null,
    "description": "pkgstruct\n=========\n\n-  Utility module for formalising the directory structure of software\n   package. The top directory path can be infered from the script path.\n\n-  ``pkgstruct`` supports having a directory structure under the top\n   directory, such as ``var``, ``share``,\\ ``etc``,\u2026 under the top\n   directory, and supports the creation of directory structures\n   according to the GNU Coding Standard and the Filesystem Hierarchy\n   Standard.\n\nRequirement\n-----------\n\n-  ``pkgstruct`` uses only standard modules.\n\nUsage\n-----\n\ninstall\n~~~~~~~\n\n::\n\n   % pip install pkgstruct\n\nExample\n~~~~~~~\n\nExample usage of pkgstruct.py\n\nFirst, import the module and define an entity of class PkgStruct that\nuses it. The top directory name is inferred from the script name given\nin the constructor argument.\n\n::\n\n   import pkgstruct\n   ...\n       Pkg_info = pkgstruct.PkgStruct(script_path=sys.argv[0])\n       # pkg_info.dump(relpath=False, with_seperator=True)\n   ...\n       pkg_info.make_subdirs(\u2018pkg_sysconfdir\u2019, 0o755, True, \u2018kivy\u2019)\n       os.environ[\u2018KIVY_HOME\u2019] = pkg_info.concat_path(\u2018pkg_sysconfdir\u2019, \u2018kivy\u2019)\n   ....\n\nWhat subdirectories are defined by it can be displayed with the member\nfunction dump().\n\nIf the script path (``base_script``) given as argument is\n``~/tmp/py_working_tool/lib/python/show_status3.py``, Further parent\ndirectories of the upper than ``lib/python/``, which is its directory\nname ``py_working_tool``, is interpreted as the package\nname:``pkg_name``, and the location of that directory\n``~/tmp/py_working_tool`` is recognized as the top of the directory\nstructure (``prefix``). Then the following directory structure is\ndeteremied according the rules similar to the GNU Coding Standard or\nFHS.\n\n-  ``bindir``: ~/tmp/py_working_tool/bin\n-  ``datadir``: ~/tmp/py_working_tool/share\n-  ``sysconfdir``: ~/tmp/py_working_tool/etc\n-  ``localstatedir``: ~/tmp/py_working_tool/var\n-  ``runstatedir``: ~/tmp/py_working_tool/var/run\n-  ``tmpdir``: ~/tmp/py_working_tool/tmp\n\nand other subdirectories of the package name (``pkg_name``) directly\nunder these directory names\n\n-  ``pkg_datadir``: ~/tmp/py_working_tool/share/py_working_tool\n-  ``pkg_sysconfdir``: ~/tmp/py_working_tool/etc/py_working_tool\n-  ``pkg_cachedir``: ~/tmp/py_working_tool/var/cache/py_working_tool\n-  ``pkg_statedatadir``: ~/tmp/py_working_tool/var/lib/py_working_tool\n-  ``pkg_logdir``: ~/tmp/py_working_tool/var/log/py_working_tool\n-  ``pkg_spooldir``: ~/tmp/py_working_tool/var/spool/py_working_tool\n\nThe equivalent string is defined and can be accessed as a property of\nthe ``PkgStruct`` class. What properties (subdirectory names) are\ndefined can also be checked by directly executing ``pkgstruct.py`` on\nits own. (``********`` will be the name of the executing user).\n\nThen following is the Example of running ``pkgstruct.py``\n\n::\n\n   \u2018pkg_name': py_working_tool\n   \u2018pkg_path': ~/tmp/py_working_tool\n   ----------------------------------------------------------------------\n   \u2018base_script': ~/tmp/py_working_tool/lib/python/pkgstruct.py\n   ----------------------------------------------------------------------\n   \u2018script_mnemonic': pkgstruct\n   \u2018script_path': ~/tmp/py_working_tool/lib/python/pkgstruct.py\n   \u2018script_location': ~/tmp/py_working_tool/lib/python\n   \u2018script_basename': pkgstruct.py\n   ----------------------------------------------------------------------\n   \u2018prefix': ~/tmp/py_working_tool\n   ----------------------------------------------------------------------\n   \u2018exec_user\u2019: ********\n   ----------------------------------------------------------------------\n   'exec_prefix':       '${prefix}'\n   'bindir':            '${prefix}'/bin\n   'datarootdir':       '${prefix}'/share\n   'datadir':           '${prefix}'/share\n   'sysconfdir':        '${prefix}'/etc\n   'sharedstatedir':    '${prefix}'/com\n   'localstatedir':     '${prefix}'/var\n   'include':           '${prefix}'/include\n   'libdir':            '${prefix}'/lib\n   'srcdir':            '${prefix}'/src\n   'infodir':           '${prefix}'/share/info\n   'runstatedir':       '${prefix}'/var/run\n   'localedir':         '${prefix}'/share/locale\n   'lispdir':           '${prefix}'/emacs/lisp\n   'docdir':            '${prefix}'/doc/py_working_tool\n   'htmldir':           '${prefix}'/doc/py_working_tool\n   'dvidir':            '${prefix}'/doc/py_working_tool\n   'pdfdir':            '${prefix}'/doc/py_working_tool\n   'psdir':             '${prefix}'/doc/py_working_tool\n   'mandir':            '${prefix}'/share/man\n   'man0dir':           '${prefix}'/share/man/man0\n   'man1dir':           '${prefix}'/share/man/man1\n   'man2dir':           '${prefix}'/share/man/man2\n   'man3dir':           '${prefix}'/share/man/man3\n   'man4dir':           '${prefix}'/share/man/man4\n   'man5dir':           '${prefix}'/share/man/man5\n   'man6dir':           '${prefix}'/share/man/man6\n   'man7dir':           '${prefix}'/share/man/man7\n   'man8dir':           '${prefix}'/share/man/man8\n   'man9dir':           '${prefix}'/share/man/man9\n   'manndir':           '${prefix}'/share/man/mann\n   'sbindir':           '${prefix}'/sbin\n   'bootdir':           '${prefix}'/boot\n   'devdir':            '${prefix}'/dev\n   'mediadir':          '${prefix}'/media\n   'mntdir':            '${prefix}'/mnt\n   'optdir':            '${prefix}'/opt\n   'tmpdir':            '${prefix}'/tmp\n   'xmldir':            '${prefix}'/etc/xml\n   'etcoptdir':         '${prefix}'/etc/opt\n   'cachedir':          '${prefix}'/var/cache\n   'statedatadir':      '${prefix}'/var/lib\n   'lockdir':           '${prefix}'/var/lock\n   'logdir':            '${prefix}'/var/log\n   'spooldir':          '${prefix}'/var/spool\n   'statetmpdir':       '${prefix}'/var/tmp\n   'user_home':         '${prefix}'/Users/********\n   'home':              '${prefix}'/Users/********\n   'homedir':           '${prefix}'/Users\n   ----------------------------------------------------------------------\n   'pkg_datadir':       '${prefix}'/share/py_working_tool\n   'pkg_sysconfdir':    '${prefix}'/etc/py_working_tool\n   'pkg_runstatedir':   '${prefix}'/var/run/py_working_tool\n   'pkg_include':       '${prefix}'/include/py_working_tool\n   'pkg_libdir':        '${prefix}'/lib/py_working_tool\n   'pkg_srcdir':        '${prefix}'/src/py_working_tool\n   'pkg_tmpdir':        '${prefix}'/tmp/py_working_tool\n   'pkg_xmldir':        '${prefix}'/etc/xml/py_working_tool\n   'pkg_cachedir':      '${prefix}'/var/cache/py_working_tool\n   'pkg_statedatadir':  '${prefix}'/var/lib/py_working_tool\n   'pkg_lockdir':       '${prefix}'/var/lock/py_working_tool\n   'pkg_logdir':        '${prefix}'/var/log/py_working_tool\n   'pkg_spooldir':      '${prefix}'/var/spool/py_working_tool\n   'pkg_statetmpdir':   '${prefix}'/var/tmp/py_working_tool\n   ----------------------------------------------------------------------\n\nIn addition, the member function ``concat_path()`` was implemented to\ncreate another directory/file name string under these. The member\nfunction ``make_subdirs()`` was also implemented to actually create the\ndirectory. Example:\n\n::\n\n   pkg_info.make_subdirs(\u2018pkg_sysconfdir\u2019, 0o755, True, \u2018kivy\u2019)\n   os.environ[\u2018KIVY_HOME\u2019] = pkg_info.concat_path(\u2018pkg_sysconfdir\u2019, \u2018kivy\u2019)\n\nThe above is the code that creates the directory\n``~/tmp/py_working_tool/etc/py_working_tool/kivy`` and sets this\ndirectory in the environment variable ``'KIVY_HOME'``.\n\nAuthor\n------\n\nNanigashi Uji (53845049+nanigashi-uji@users.noreply.github.com)\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Utility module for formalising the directory structure of software package",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://github.com/nanigashi-uji/pkgstruct.git"
    },
    "split_keywords": [
        "directory structure",
        " gnu coding standards",
        " fhs"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9edc1c3fa9a2d231de0eb6a0221fbc5e5140d1124b7f0affd429fcdbe4db2d03",
                "md5": "233d8b17c6bc1edde6fd28fda6c712f8",
                "sha256": "0ef0be41d807de4f06751284d2ab97503d62b2e6099771d3b142f71753a5952c"
            },
            "downloads": -1,
            "filename": "pkgstruct-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "233d8b17c6bc1edde6fd28fda6c712f8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9177,
            "upload_time": "2025-02-16T13:24:34",
            "upload_time_iso_8601": "2025-02-16T13:24:34.101669Z",
            "url": "https://files.pythonhosted.org/packages/9e/dc/1c3fa9a2d231de0eb6a0221fbc5e5140d1124b7f0affd429fcdbe4db2d03/pkgstruct-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "36bc6891c4dea441669824be9533578208e33bdf06a4ba54fc654a2240affba1",
                "md5": "4de77d0848ed32b74fb8de9cb5e1ccca",
                "sha256": "9a25712630a0da9a7bfebace3483bd49e1b88237188a4262e106672a6e780fb1"
            },
            "downloads": -1,
            "filename": "pkgstruct-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4de77d0848ed32b74fb8de9cb5e1ccca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 13074,
            "upload_time": "2025-02-16T13:24:35",
            "upload_time_iso_8601": "2025-02-16T13:24:35.493352Z",
            "url": "https://files.pythonhosted.org/packages/36/bc/6891c4dea441669824be9533578208e33bdf06a4ba54fc654a2240affba1/pkgstruct-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-16 13:24:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nanigashi-uji",
    "github_project": "pkgstruct",
    "github_not_found": true,
    "lcname": "pkgstruct"
}
        
Elapsed time: 0.47116s