Skip to content

Instantly share code, notes, and snippets.

@zhangchunlin
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhangchunlin/e764f034526512096daa to your computer and use it in GitHub Desktop.
Save zhangchunlin/e764f034526512096daa to your computer and use it in GitHub Desktop.
Scancopyright install&usage

Scancopyright is a tool which can be used to scan copyright info of source code,you can use it to identity source code as GPL/other license or propriertary. I wrote it for the open source of our android source code. You can submit issue for improvement or questions.

Install

Scancopyright can be run cross platform(linux/windows...) in theory,but only linux installration is tested.

Install dependent modules

Scancopyright depend on python(2.6+)/uliweb/plugs/sqlalchemy,you should install them firstly. Example steps in ubuntu:

apt-get install python-setuptools easy_install uliweb easy_install plugs easy_install sqlalchemy

Install scancopyright

  1. get scancopyright source code

    you can get source code from github:

    git clone https://github.com/zhangchunlin/scancopyright.git cd scancopyright
  2. cd source code root directory

Scan copyright

follow the "uliweb schelp" instructions to use scancopyright(the whole scan process may take a few hours for big source code project i.e. android source code):

zhangclb@zhangclb2:~/devel/scancopyright$ uliweb schelp

follow these steps to scan copyright:

  • copy apps/local_settings.ini.example as apps/local_settings.ini
  • modify local_settings.ini SCAN.DIR = 'YOUR_SOURCE_CODE_PATH' ORM.CONNECTION = 'sqlite:///DATABASE_NAME_YOU_WANT.db'
  • uliweb syncdb (if you want to recreate database use: uliweb reset)
  • uliweb scap (scan all path)
  • uliweb scac (scan all copyright)
  • uliweb scdad (decide all direcotry status)

View scan result

  1. Run uliweb server

    uliweb runserver
  2. Visit http://localhost:8000 in your browser,google chrome recommanded.

    scan result view

  3. You can click + icon to expand the directory in tree view

    expand the directory

  4. When click a node of tree,you can go to file view

    file view

  5. File exts statistics

    File exts statistics

  6. Copyright tools

    tools

    1. list all file copyright conflicted

      all confilcted

    2. list all copyright types ![all copyright types] [http://uliweb.cpython.org/uploads/tutorial/13/8bd589aefb0a11e1a00ff23c91df0780.png]

    3. list all copyright files and snippets all copyright files and snippets

    4. search tools search tools

Mark open soruce directory and export

  1. click the directory you want to release and √ the "Release this package" option,then click submit

  2. after mark all the directory you want to release,you can see a release directory list in home page of scancopyright

  3. add setting in local_settings.ini

    [SCAN] DIR_EXPORT = 'DIRECTORY_PATH_YOU_WANT_TO_EXPORT'
  4. then use "uliweb sceos" to export

Config scan setting

If you want to add or modify scan rules,you should edit SCAN.RE_LIST part in apps/Scan/settings.ini ,before it you should know Regular Expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment