Home > documentation, open source software, programming, Python > Default files for projects

Default files for projects

Anyone who has peered into the compressed tarballs of various open source projects under the GNU GPL would notice that these projects have many things in common. Obviously they are distributed under the terms of the GPL. But for people who are involved in development, they would need to consider creating and/or reviewing the following files:

  • AUTHORS
  • Changelog
  • COPYING
  • INSTALL
  • NEWS
  • README
  • Todo

Integrated development environments such as KDevelop can automagically create the above files each time you start a new project. It’s not difficult to write your own little script that does the same thing. As a simple exercise in learning Python, I’ve written a script called gnufiles.py that generates the above default files. The script is rather lengthy, but not difficult for a beginner to understand. Here’s an excerpt of gnufiles.py that contains its main part:

[...]
# create required empty files
for name in EMPTY_FILES:
    path = [os.getcwd()]
    path.append(SLASH)
    path.append(name)
    path = "".join(path)
    file = open(path, "w")
    file.close()

# create file containing the GNU GPL v2
path = [os.getcwd()]
path.append(SLASH)
path.append("COPYING")
path = "".join(path)
file = open(path, "w")
file.write(GNU_LICENSE)
file.close()

# create file containing generic installation instruction
path = [os.getcwd()]
path.append(SLASH)
path.append("INSTALL")
path = "".join(path)
file = open(path, "w")
file.write(INSTALL_INSTRUCTION)
file.close()
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: